[next] telepathy-glib: account-request test: prepare account manager

Simon McVittie smcv at kemper.freedesktop.org
Tue Mar 18 05:45:05 PDT 2014


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

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Mar 14 13:24:30 2014 +0000

account-request test: prepare account manager

We're using a TpAccountManager that came from tp_account_manager_dup(),
which means consecutive test-cases can use the same object.
The TpAM calls GetAll in _tp_account_manager_constructed().
If we don't wait for it to be prepared, then that GetAll call might
fail, during the window in which our account manager service is
unregistered.

Under dbus-glib, I don't think that can happen, because we don't
iterate the main loop between dropping the old service in teardown
and starting the new one in setup; but under GDBus it can, because
the GDBus worker thread keeps going.

---

 tests/dbus/account-request.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tests/dbus/account-request.c b/tests/dbus/account-request.c
index 23aee75..6d2298c 100644
--- a/tests/dbus/account-request.c
+++ b/tests/dbus/account-request.c
@@ -69,6 +69,12 @@ teardown (Test *test,
     gconstpointer data G_GNUC_UNUSED)
 {
   g_clear_object (&test->account);
+
+  /* If we don't let it prepare before we tear down the AccountManager
+   * service, then it might be invalidated between teardown and the next
+   * setup by its GetAll call failing. That would be bad, because we're
+   * using the global shared instance, so it could break the next test. */
+  tp_tests_proxy_run_until_prepared (test->account_manager, NULL);
   g_clear_object (&test->account_manager);
 
   tp_dbus_daemon_release_name (test->dbus, TP_ACCOUNT_MANAGER_BUS_NAME,



More information about the telepathy-commits mailing list