[next] telepathy-glib: test TP_DEBUG_CLIENT_FEATURE_CORE

Simon McVittie smcv at kemper.freedesktop.org
Wed Apr 25 07:26:07 PDT 2012


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

Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date:   Fri Apr 13 10:31:04 2012 +0200

test TP_DEBUG_CLIENT_FEATURE_CORE

---

 tests/dbus/debug-client.c |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/tests/dbus/debug-client.c b/tests/dbus/debug-client.c
index cf5727a..0068c45 100644
--- a/tests/dbus/debug-client.c
+++ b/tests/dbus/debug-client.c
@@ -94,6 +94,40 @@ test_invalidated (Test *test,
   g_assert_no_error (test->error);
 }
 
+static void
+proxy_prepare_cb (GObject *source,
+    GAsyncResult *result,
+    gpointer user_data)
+{
+  Test *test = user_data;
+
+  tp_proxy_prepare_finish (source, result, &test->error);
+
+  test->wait--;
+  if (test->wait <= 0)
+    g_main_loop_quit (test->mainloop);
+}
+
+static void
+test_core_feature (Test *test,
+    gconstpointer data G_GNUC_UNUSED)
+{
+  GQuark features[] = { TP_DEBUG_CLIENT_FEATURE_CORE, 0 };
+
+  g_object_set (test->sender, "enabled", TRUE, NULL);
+
+  /* feature is not prepared yet */
+  g_assert (!tp_debug_client_is_enabled (test->client));
+
+  tp_proxy_prepare_async (test->client, features, proxy_prepare_cb, test);
+
+  test->wait = 1;
+  g_main_loop_run (test->mainloop);
+  g_assert_no_error (test->error);
+
+  g_assert (tp_debug_client_is_enabled (test->client));
+}
+
 int
 main (int argc,
       char **argv)
@@ -105,6 +139,8 @@ main (int argc,
       test_creation, teardown);
   g_test_add ("/debug-client/invalidated", Test, NULL, setup,
       test_invalidated, teardown);
+  g_test_add ("/debug-client/core-feature", Test, NULL, setup,
+      test_core_feature, teardown);
 
   return g_test_run ();
 }



More information about the telepathy-commits mailing list