[next] telepathy-glib: future-account test: register account manager and account services

Jonny Lamb jonny at kemper.freedesktop.org
Fri May 11 02:41:34 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 72db0d4c167db8e1c0147418ee6aa0a06f910abe
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=72db0d4c167db8e1c0147418ee6aa0a06f910abe

Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date:   Thu Apr 26 15:16:28 2012 +0100

future-account test: register account manager and account services

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>

---

 tests/dbus/future-account.c |   34 +++++++++++++++++++++++++++++++---
 1 files changed, 31 insertions(+), 3 deletions(-)

diff --git a/tests/dbus/future-account.c b/tests/dbus/future-account.c
index 5bf59e8..c32dd78 100644
--- a/tests/dbus/future-account.c
+++ b/tests/dbus/future-account.c
@@ -11,12 +11,17 @@
 
 #include <telepathy-glib/future-account.h>
 
+#include "tests/lib/simple-account.h"
+#include "tests/lib/simple-account-manager.h"
 #include "tests/lib/util.h"
 
 typedef struct {
   GMainLoop *mainloop;
   TpDBusDaemon *dbus;
 
+  TpTestsSimpleAccountManager *am;
+  TpTestsSimpleAccount *account_service;
+
   TpAccountManager *account_manager;
   TpFutureAccount *account;
 
@@ -32,9 +37,26 @@ setup (Test *test,
   test->dbus = tp_tests_dbus_daemon_dup_or_die ();
   g_assert (test->dbus != NULL);
 
+  /* create the account manager service */
+  tp_dbus_daemon_request_name (test->dbus,
+      TP_ACCOUNT_MANAGER_BUS_NAME, FALSE, &test->error);
+  g_assert_no_error (test->error);
+  test->am = tp_tests_object_new_static_class (
+      TP_TESTS_TYPE_SIMPLE_ACCOUNT_MANAGER, NULL);
+  tp_dbus_daemon_register_object (test->dbus, TP_ACCOUNT_MANAGER_OBJECT_PATH,
+      test->am);
+
+  /* and now the account manager proxy */
   test->account_manager = tp_account_manager_dup ();
   g_assert (test->account_manager != NULL);
 
+  /* finally create the account service */
+  test->account_service = tp_tests_object_new_static_class (
+      TP_TESTS_TYPE_SIMPLE_ACCOUNT, NULL);
+  tp_dbus_daemon_register_object (test->dbus,
+      TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/lospolloshermanos",
+      test->account_service);
+
   test->account = NULL;
 }
 
@@ -44,14 +66,20 @@ teardown (Test *test,
 {
   g_clear_object (&test->account);
 
-  /* make sure any pending calls on the account have happened, so it can die */
-  tp_tests_proxy_run_until_dbus_queue_processed (test->dbus);
+  tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME,
+      &test->error);
+  g_assert_no_error (test->error);
+  tp_dbus_daemon_unregister_object (test->dbus, test->am);
+  g_clear_object (&test->am);
+
+  tp_dbus_daemon_unregister_object (test->dbus, test->account_service);
+  g_clear_object (&test->account_service);
 
   g_clear_object (&test->dbus);
   tp_clear_pointer (&test->mainloop, g_main_loop_unref);
 
   g_clear_error (&test->error);
-  tp_clear_object (&test->result);
+  g_clear_object (&test->result);
 }
 
 static void



More information about the telepathy-commits mailing list