summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2011-02-24 10:56:22 -0500
committerNicolas Dufresne <nicolas.dufresne@collabora.co.uk>2011-02-24 10:56:22 -0500
commitb8e6be9ef8577bdf56962ce3ba0e76338cec2191 (patch)
treecffc727e53f4d8ef0d8d16a7e5bee02ed0f307b6
parent506dc7853644450f090040ad25c3d4078310efa4 (diff)
downloadtelepathy-logger-b8e6be9ef8577bdf56962ce3ba0e76338cec2191.tar.gz
Convert test_get_entities() to use _async() method
-rw-r--r--tests/dbus/test-log-manager.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/tests/dbus/test-log-manager.c b/tests/dbus/test-log-manager.c
index 6c4a27b..b001019 100644
--- a/tests/dbus/test-log-manager.c
+++ b/tests/dbus/test-log-manager.c
@@ -277,24 +277,43 @@ test_get_dates (TestCaseFixture *fixture,
g_list_free (fixture->ret);
}
+
+static void
+get_entities_cb (GObject *object,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ TestCaseFixture *fixture = user_data;
+ GError *error = NULL;
+
+ tpl_log_manager_get_entities_finish (TPL_LOG_MANAGER (object), result,
+ &fixture->ret, &error);
+
+ g_assert_no_error (error);
+ g_main_loop_quit (fixture->main_loop);
+}
+
+
static void
test_get_entities (TestCaseFixture *fixture,
gconstpointer user_data)
{
- GList *ret, *loc;
+ GList *loc;
- ret = _tpl_log_manager_get_entities (fixture->manager, fixture->account);
+ tpl_log_manager_get_entities_async (fixture->manager, fixture->account,
+ get_entities_cb, fixture);
+ g_main_loop_run (fixture->main_loop);
- g_assert_cmpint (g_list_length (ret), ==, 2);
+ g_assert_cmpint (g_list_length (fixture->ret), ==, 2);
/* we do not want duplicates */
- ret = g_list_sort (ret, (GCompareFunc) _tpl_entity_compare);
- for (loc = ret; loc != NULL; loc = g_list_next (loc))
+ fixture->ret = g_list_sort (fixture->ret, (GCompareFunc) _tpl_entity_compare);
+ for (loc = fixture->ret; loc != NULL; loc = g_list_next (loc))
if (loc->next)
g_assert (_tpl_entity_compare (loc->data, loc->next->data) != 0);
- g_list_foreach (ret, (GFunc) g_object_unref, NULL);
- g_list_free (ret);
+ g_list_foreach (fixture->ret, (GFunc) g_object_unref, NULL);
+ g_list_free (fixture->ret);
}