aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-04-20 14:44:25 -0500
committerTed Gould <ted@canonical.com>2009-04-20 14:44:25 -0500
commitecad1e36dce18875461e76d2a47d8a0e11570ff6 (patch)
tree1194e137bb35005c88e97fc2aabf5b1a1356b9ef /tests
parentc5cc32d7fa7c6abe909f3d19a7e1deb529bcc4a9 (diff)
downloadlibayatana-indicator-ecad1e36dce18875461e76d2a47d8a0e11570ff6.tar.gz
libayatana-indicator-ecad1e36dce18875461e76d2a47d8a0e11570ff6.tar.bz2
libayatana-indicator-ecad1e36dce18875461e76d2a47d8a0e11570ff6.zip
Adding in multiple servers connecting in to declare interest test
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am60
-rw-r--r--tests/test-interests-server1.c41
-rw-r--r--tests/test-interests-server2.c41
-rw-r--r--tests/test-interests-server3.c41
-rw-r--r--tests/test-interests-server4.c41
-rw-r--r--tests/test-interests-server5.c41
-rwxr-xr-xtests/test_interests_multi5
7 files changed, 269 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 256a699..6117bee 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,11 +1,17 @@
TESTS = \
test_simple \
- test_interests
+ test_interests \
+ test_interests_multi
libexec_PROGRAMS = \
test-interests-client \
test-interests-server \
+ test-interests-server1 \
+ test-interests-server2 \
+ test-interests-server3 \
+ test-interests-server4 \
+ test-interests-server5 \
test-simple-client \
test-simple-server
@@ -56,3 +62,55 @@ test_interests_server_LDADD = \
../libindicate/libindicate.la \
$(LIBINDICATE_LIBS)
+test_interests_multi: test-interests-client test-interests-server1 test-interests-server2 test-interests-server3 test-interests-server4 test-interests-server5
+
+test_interests_server1_SOURCES = \
+ test-interests-server1.c
+
+test_interests_server1_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server1_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_interests_server2_SOURCES = \
+ test-interests-server2.c
+
+test_interests_server2_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server2_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_interests_server3_SOURCES = \
+ test-interests-server3.c
+
+test_interests_server3_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server3_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_interests_server4_SOURCES = \
+ test-interests-server4.c
+
+test_interests_server4_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server4_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
+test_interests_server5_SOURCES = \
+ test-interests-server5.c
+
+test_interests_server5_CFLAGS = \
+ $(LIBINDICATE_CFLAGS) -I$(srcdir)/..
+
+test_interests_server5_LDADD = \
+ ../libindicate/libindicate.la \
+ $(LIBINDICATE_LIBS)
+
diff --git a/tests/test-interests-server1.c b/tests/test-interests-server1.c
new file mode 100644
index 0000000..e0d77f3
--- /dev/null
+++ b/tests/test-interests-server1.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 1
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server2.c b/tests/test-interests-server2.c
new file mode 100644
index 0000000..0416c21
--- /dev/null
+++ b/tests/test-interests-server2.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 2
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server3.c b/tests/test-interests-server3.c
new file mode 100644
index 0000000..7d889b1
--- /dev/null
+++ b/tests/test-interests-server3.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 3
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server4.c b/tests/test-interests-server4.c
new file mode 100644
index 0000000..50e6db1
--- /dev/null
+++ b/tests/test-interests-server4.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 4
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test-interests-server5.c b/tests/test-interests-server5.c
new file mode 100644
index 0000000..d415716
--- /dev/null
+++ b/tests/test-interests-server5.c
@@ -0,0 +1,41 @@
+
+#include <glib.h>
+#include "libindicate/listener.h"
+
+static gboolean passed = TRUE;
+static GMainLoop * mainloop = NULL;
+
+static void
+server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data)
+{
+ g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type);
+ #define INTEREST 5
+ g_debug("Setting Interest: %d", INTEREST);
+ indicate_listener_server_show_interest(listener, server, INTEREST);
+ return;
+}
+
+static gboolean
+failed_cb (gpointer data)
+{
+ g_debug("Done indicatating interest");
+ g_main_loop_quit(mainloop);
+ return FALSE;
+}
+
+int
+main (int argc, char * argv)
+{
+ g_type_init();
+
+ IndicateListener * listener = indicate_listener_ref_default();
+
+ g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL);
+
+ g_timeout_add_seconds(2, failed_cb, NULL);
+
+ mainloop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(mainloop);
+
+ return !passed;
+}
diff --git a/tests/test_interests_multi b/tests/test_interests_multi
new file mode 100755
index 0000000..96b23c9
--- /dev/null
+++ b/tests/test_interests_multi
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+DBUS_RUNNER="/home/ted/Development/dbus-play/dbus-test-runner --dbus-config /home/ted/Development/dbus-play/session.conf"
+
+${DBUS_RUNNER} --task ./test-interests-client --task-name Client --task ./test-interests-server1 --task-name Server1 --task ./test-interests-server2 --task-name Server2 --task ./test-interests-server3 --task-name Server3 --task ./test-interests-server4 --task-name Server4 --task ./test-interests-server5 --task-name Server5