[next] telepathy-glib: properties test: create and manage GTestDBus explicitly
Simon McVittie
smcv at kemper.freedesktop.org
Wed Mar 19 13:00:51 PDT 2014
Module: telepathy-glib
Branch: next
Commit: 51666c8fa0a2532986b3a8daa9cd810709768506
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=51666c8fa0a2532986b3a8daa9cd810709768506
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Tue Mar 18 16:31:27 2014 +0000
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
---
tests/dbus/properties.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/tests/dbus/properties.c b/tests/dbus/properties.c
index 5ba9ae8..bff1064 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;
}
More information about the telepathy-commits
mailing list