[next] telepathy-glib: test tp_debug_client_set_enabled_async()
Simon McVittie
smcv at kemper.freedesktop.org
Wed Apr 25 07:26:07 PDT 2012
Module: telepathy-glib
Branch: next
Commit: 312587f6be7f5a11a32dfdd0a03bc83db8c1173b
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=312587f6be7f5a11a32dfdd0a03bc83db8c1173b
Author: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>
Date: Fri Apr 13 10:35:28 2012 +0200
test tp_debug_client_set_enabled_async()
---
tests/dbus/debug-client.c | 47 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/tests/dbus/debug-client.c b/tests/dbus/debug-client.c
index 0068c45..c490c4a 100644
--- a/tests/dbus/debug-client.c
+++ b/tests/dbus/debug-client.c
@@ -128,6 +128,51 @@ test_core_feature (Test *test,
g_assert (tp_debug_client_is_enabled (test->client));
}
+static void
+set_enabled_cb (GObject *source,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ Test *test = user_data;
+
+ tp_debug_client_set_enabled_finish (TP_DEBUG_CLIENT (source),
+ result, &test->error);
+
+ test->wait--;
+ if (test->wait <= 0)
+ g_main_loop_quit (test->mainloop);
+}
+
+static void
+test_set_enabled (Test *test,
+ gconstpointer data G_GNUC_UNUSED)
+{
+ gboolean enabled;
+
+ g_object_get (test->sender, "enabled", &enabled, NULL);
+ g_assert (!enabled);
+
+ /* Enable */
+ tp_debug_client_set_enabled_async (test->client, TRUE, set_enabled_cb, test);
+
+ test->wait = 1;
+ g_main_loop_run (test->mainloop);
+ g_assert_no_error (test->error);
+
+ g_object_get (test->sender, "enabled", &enabled, NULL);
+ g_assert (enabled);
+
+ /* Disable */
+ tp_debug_client_set_enabled_async (test->client, FALSE, set_enabled_cb, test);
+
+ test->wait = 1;
+ g_main_loop_run (test->mainloop);
+ g_assert_no_error (test->error);
+
+ g_object_get (test->sender, "enabled", &enabled, NULL);
+ g_assert (!enabled);
+}
+
int
main (int argc,
char **argv)
@@ -141,6 +186,8 @@ main (int argc,
test_invalidated, teardown);
g_test_add ("/debug-client/core-feature", Test, NULL, setup,
test_core_feature, teardown);
+ g_test_add ("/debug-client/set-enabled", Test, NULL, setup,
+ test_set_enabled, teardown);
return g_test_run ();
}
More information about the telepathy-commits
mailing list