summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-18 16:31:27 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2014-03-19 17:30:26 +0000
commit51666c8fa0a2532986b3a8daa9cd810709768506 (patch)
tree8d0a5efd4f4f56512eac40b561c1136e440f36f9
parent35103e5332e88046cb1fb9c4e9c5e1cc06852ef3 (diff)
downloadtelepathy-glib-51666c8fa0a2532986b3a8daa9cd810709768506.tar.gz
properties test: create and manage GTestDBus explicitly
We call tp_tests_dbus_daemon_dup_or_die() before entering the actual test. This only works because tp_tests_run_with_bus() shares a static GTestDBus * with the one implicitly created by tp_tests_dbus_daemon_dup_or_die(), which is a special hack that I want to remove. Reviewed-by: Xavier Claessens
-rw-r--r--tests/dbus/properties.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/dbus/properties.c b/tests/dbus/properties.c
index 5ba9ae8f6..bff106414 100644
--- a/tests/dbus/properties.c
+++ b/tests/dbus/properties.c
@@ -224,9 +224,15 @@ main (int argc, char **argv)
{
Context ctx;
TpDBusDaemon *dbus_daemon;
+ GTestDBus *test_dbus;
+ int ret;
tp_tests_init (&argc, &argv);
+ g_test_dbus_unset ();
+ test_dbus = g_test_dbus_new (G_TEST_DBUS_NONE);
+ g_test_dbus_up (test_dbus);
+
dbus_daemon = tp_tests_dbus_daemon_dup_or_die ();
ctx.obj = tp_tests_object_new_static_class (TEST_TYPE_PROPERTIES, NULL);
tp_dbus_daemon_register_object (dbus_daemon, "/", ctx.obj);
@@ -246,11 +252,14 @@ main (int argc, char **argv)
g_test_add_data_func ("/properties/changed", &ctx, (GTestDataFunc) test_emit_changed);
- tp_tests_run_with_bus ();
+ ret = g_test_run ();
g_object_unref (ctx.obj);
g_object_unref (ctx.proxy);
g_object_unref (dbus_daemon);
- return 0;
+ g_test_dbus_down (test_dbus);
+ tp_tests_assert_last_unref (&test_dbus);
+
+ return ret;
}