diff options
author | Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> | 2011-03-22 17:24:48 -0400 |
---|---|---|
committer | Nicolas Dufresne <nicolas.dufresne@collabora.co.uk> | 2011-03-25 14:03:04 -0400 |
commit | 8fb76e8733f2719c3f64e9baa0801ee9ef257798 (patch) | |
tree | 327fcb7d6070a98c0e11b94b05358277bf89a51d | |
parent | 18171c60c9fe947de17f9594ae925dfd7bb73eab (diff) | |
download | telepathy-logger-8fb76e8733f2719c3f64e9baa0801ee9ef257798.tar.gz |
Add test coverage for tpl_log_manager_search_async()
-rw-r--r-- | tests/dbus/test-log-manager.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/dbus/test-log-manager.c b/tests/dbus/test-log-manager.c index 67a7768..b2c0748 100644 --- a/tests/dbus/test-log-manager.c +++ b/tests/dbus/test-log-manager.c @@ -453,6 +453,41 @@ test_get_entities (TestCaseFixture *fixture, } +static void +search_cb (GObject *object, + GAsyncResult *result, + gpointer user_data) +{ + TestCaseFixture *fixture = user_data; + GError *error = NULL; + + tpl_log_manager_search_finish (TPL_LOG_MANAGER (object), + result, &fixture->ret, &error); + + g_assert_no_error (error); + g_main_loop_quit (fixture->main_loop); +} + + +static void +test_search (TestCaseFixture *fixture, + gconstpointer user_data) +{ + tpl_log_manager_search_async (fixture->manager, + "user2@collabora.co.uk", + TPL_EVENT_MASK_TEXT, + search_cb, + fixture); + g_main_loop_run (fixture->main_loop); + + /* We got 6 events in old Empathy and 6 in new TpLogger storage */ + g_assert_cmpint (g_list_length (fixture->ret), ==, 10); + + tpl_log_manager_search_free (fixture->ret); + fixture->ret = NULL; +} + + int main (int argc, char **argv) { @@ -500,6 +535,10 @@ main (int argc, char **argv) TestCaseFixture, params, setup, test_get_entities, teardown); + g_test_add ("/log-manager/search", + TestCaseFixture, params, + setup, test_search, teardown); + retval = g_test_run (); g_list_foreach (l, (GFunc) g_hash_table_unref, NULL); |