summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-01-27 13:01:29 -0500
committerColin Walters <walters@verbum.org>2010-01-27 13:46:40 -0500
commitf1c3f7bf585d6010c84491372b0a6f0ae3b1432a (patch)
tree317f57ca9917f4044ff83692d00b02c3a90024e5 /test
parent87c645ed17d6fef350e8c26e322ecde566a27d42 (diff)
Add GMainContext to dbus_g_bus_get_private, add a test case
To even sort of work with threads right now, a common workaround is to open a private connection. This patch more explicitly supports creating a private connection, associating it with the GMainContext which will be used for a thread. Also, add a (very simple) test case which just uses a private connection for the default main context.
Diffstat (limited to 'test')
-rw-r--r--test/core/test-dbus-glib.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/core/test-dbus-glib.c b/test/core/test-dbus-glib.c
index 288606f..0e3c12f 100644
--- a/test/core/test-dbus-glib.c
+++ b/test/core/test-dbus-glib.c
@@ -2123,6 +2123,27 @@ main (int argc, char **argv)
lose ("Duplicate proxy wasn'tdestroyed");
g_print ("Proxy and duplicate destroyed successfully\n");
+
+ g_print ("Beginning private connection tests\n");
+
+ {
+ DBusGConnection *privconn = dbus_g_bus_get_private (DBUS_BUS_SESSION, NULL, &error);
+
+ if (privconn == NULL)
+ lose_gerror ("Failed to open private connection to bus", error);
+ g_assert (privconn != connection);
+
+ proxy = dbus_g_proxy_new_for_name (privconn,
+ "org.freedesktop.DBus.GLib.TestService",
+ "/org/freedesktop/DBus/GLib/Tests/MyTestObject",
+ "org.freedesktop.DBus.GLib.Tests.MyObject");
+
+ g_print ("[private connection] Calling (wrapped) do_nothing\n");
+ if (!org_freedesktop_DBus_GLib_Tests_MyObject_do_nothing (proxy, &error))
+ lose_gerror ("Failed to complete (wrapped) DoNothing call", error);
+
+ g_object_unref (G_OBJECT (proxy));
+ }
g_object_unref (G_OBJECT (driver));