[next] telepathy-logger: entity test: use new TpContact-fetching functions

Jonny Lamb jonny at kemper.freedesktop.org
Wed Aug 8 03:41:19 PDT 2012


Module: telepathy-logger
Branch: next
Commit: 81bd54d5c58cc5e8a7a10c0a4ebfeba66f09d15d
URL:    http://cgit.freedesktop.org/telepathy/telepathy-logger/commit/?id=81bd54d5c58cc5e8a7a10c0a4ebfeba66f09d15d

Author: Jonny Lamb <jonny.lamb at collabora.co.uk>
Date:   Wed Aug  8 11:36:36 2012 +0100

entity test: use new TpContact-fetching functions

Signed-off-by: Jonny Lamb <jonny.lamb at collabora.co.uk>

---

 tests/dbus/test-entity.c |   33 ++++++++++++++++-----------------
 1 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/tests/dbus/test-entity.c b/tests/dbus/test-entity.c
index 7bf2eca..f02aa0f 100644
--- a/tests/dbus/test-entity.c
+++ b/tests/dbus/test-entity.c
@@ -56,23 +56,21 @@ typedef struct {
 
 
 static void
-get_contacts_cb (TpConnection *connection,
-    guint n_contacts,
-    TpContact * const *contacts,
-    guint n_failed,
-    const TpHandle *failed,
-    const GError *error,
-    gpointer user_data,
-    GObject *weak_object)
+get_contact_cb (GObject *source_object,
+    GAsyncResult *async_result,
+    gpointer user_data)
 {
+  TpConnection *conn = TP_CONNECTION (source_object);
   Result *result = user_data;
+  static guint id = 0;
+  TpContact *contact;
+  GError *error = NULL;
 
+  contact = tp_connection_dup_contact_by_id_finish (conn, async_result, &error);
   g_assert_no_error (error);
-  g_assert (n_contacts == 2);
-  g_assert (n_failed == 0);
+  g_assert (contact != NULL);
 
-  result->contacts[0] = g_object_ref (contacts[0]);
-  result->contacts[1] = g_object_ref (contacts[1]);
+  result->contacts[id++] = contact;
 
   g_main_loop_quit (result->loop);
 }
@@ -115,11 +113,12 @@ test_entity_instantiation_from_tp_contact (void)
   result.contacts[0] = result.contacts[1] = 0;
   result.loop = g_main_loop_new (NULL, FALSE);
 
-  tp_connection_get_contacts_by_handle (client_connection,
-      2, handles,
-      2, features,
-      get_contacts_cb, &result,
-      NULL, NULL);
+  tp_connection_dup_contact_by_id_async (client_connection,
+      "alice", features, get_contact_cb, &result);
+  g_main_loop_run (result.loop);
+
+  tp_connection_dup_contact_by_id_async (client_connection,
+      "bob", features, get_contact_cb, &result);
   g_main_loop_run (result.loop);
 
   entity = tpl_entity_new_from_tp_contact (result.contacts[0],



More information about the telepathy-commits mailing list