From 9014c28fd503ea0fa44cf990cc2450996e3eceab Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 26 Sep 2013 16:55:12 +0200 Subject: [PATCH 3/6] tests/dbus/test-tpl-log-iters-xml: use tpl_test_create_and_prepare_account() This test will rely on the TpAccount to be prepared soon. https://bugs.freedesktop.org/show_bug.cgi?id=69814 --- tests/dbus/test-tpl-log-iter-xml.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/tests/dbus/test-tpl-log-iter-xml.c b/tests/dbus/test-tpl-log-iter-xml.c index 044bf47..ab98fbd 100644 --- a/tests/dbus/test-tpl-log-iter-xml.c +++ b/tests/dbus/test-tpl-log-iter-xml.c @@ -1,5 +1,6 @@ #include "config.h" +#include "lib/logger-test-helper.h" #include "lib/util.h" #include "telepathy-logger/call-event.h" @@ -17,10 +18,12 @@ typedef struct { + GMainLoop *main_loop; TplLogStore *store; TpAccount *account; TpDBusDaemon *bus; TpSimpleClientFactory *factory; + TpTestsSimpleAccount *account_service; } XmlTestCaseFixture; @@ -30,6 +33,8 @@ setup (XmlTestCaseFixture* fixture, { GError *error = NULL; + fixture->main_loop = g_main_loop_new (NULL, FALSE); + fixture->store = g_object_new (TPL_TYPE_LOG_STORE_XML, "testmode", TRUE, NULL); @@ -37,16 +42,19 @@ setup (XmlTestCaseFixture* fixture, fixture->bus = tp_tests_dbus_daemon_dup_or_die (); g_assert (fixture->bus != NULL); + tp_dbus_daemon_request_name (fixture->bus, + TP_ACCOUNT_MANAGER_BUS_NAME, + FALSE, + &error); + g_assert_no_error (error); + fixture->factory = tp_simple_client_factory_new (fixture->bus); g_assert (fixture->factory != NULL); - /* We can get away without preparing the account */ - fixture->account = tp_simple_client_factory_ensure_account (fixture->factory, + tpl_test_create_and_prepare_account (fixture->bus, fixture->factory, + fixture->main_loop, TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/user_40collabora_2eco_2euk", - NULL, - &error); - g_assert_no_error (error); - g_assert (fixture->account != NULL); + &fixture->account, &fixture->account_service); tp_debug_divert_messages (g_getenv ("TPL_LOGFILE")); @@ -60,7 +68,15 @@ static void teardown (XmlTestCaseFixture *fixture, gconstpointer user_data) { - g_clear_object (&fixture->account); + GError *error = NULL; + + tp_dbus_daemon_release_name (fixture->bus, TP_ACCOUNT_MANAGER_BUS_NAME, + &error); + g_assert_no_error (error); + + tpl_test_release_account (fixture->bus, fixture->account, + fixture->account_service); + g_clear_object (&fixture->factory); g_clear_object (&fixture->bus); g_clear_object (&fixture->store); -- 1.8.3.1