telepathy-glib: account-channel-request test: do not use soon to be deprecated API

Xavier Claessens xclaesse at kemper.freedesktop.org
Wed May 9 05:59:55 PDT 2012


Module: telepathy-glib
Branch: master
Commit: 305495dc6c871c92e6432d95811762ecaa8a19cf
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=305495dc6c871c92e6432d95811762ecaa8a19cf

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Tue May  8 18:45:47 2012 +0200

account-channel-request test: do not use soon to be deprecated API

_by_id_async() needs CONTACTS iface on the connection, so the unit test
must be using TpTestsContactsConnection.

---

 tests/dbus/account-channel-request.c |    4 ++--
 tests/lib/util.c                     |   27 +++++++++++----------------
 2 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c
index 9c90936..6621f1e 100644
--- a/tests/dbus/account-channel-request.c
+++ b/tests/dbus/account-channel-request.c
@@ -17,7 +17,7 @@
 
 #include "tests/lib/util.h"
 #include "tests/lib/simple-account.h"
-#include "tests/lib/simple-conn.h"
+#include "tests/lib/contacts-conn.h"
 #include "tests/lib/textchan-null.h"
 #include "tests/lib/simple-channel-dispatcher.h"
 #include "tests/lib/simple-channel-request.h"
@@ -78,7 +78,7 @@ setup (Test *test,
   g_assert (test->account != NULL);
 
   /* Create (service and client sides) connection objects */
-  tp_tests_create_and_connect_conn (TP_TESTS_TYPE_SIMPLE_CONNECTION,
+  tp_tests_create_and_connect_conn (TP_TESTS_TYPE_CONTACTS_CONNECTION,
       "me at test.com", &test->base_connection, &test->connection);
 
   /* Create and register CD */
diff --git a/tests/lib/util.c b/tests/lib/util.c
index 5cb6d23..16ece06 100644
--- a/tests/lib/util.c
+++ b/tests/lib/util.c
@@ -473,24 +473,19 @@ tp_tests_connection_assert_disconnect_succeeds (TpConnection *connection)
 }
 
 static void
-one_contact_cb (TpConnection *connection,
-    guint n_contacts,
-    TpContact * const *contacts,
-    const gchar * const *good_ids,
-    GHashTable *bad_ids,
-    const GError *error,
-    gpointer user_data,
-    GObject *weak_object)
+one_contact_cb (GObject *object,
+    GAsyncResult *result,
+    gpointer user_data)
 {
+  TpConnection *connection = (TpConnection *) object;
   TpContact **contact_loc = user_data;
+  GError *error = NULL;
 
-  g_assert_no_error (error);
-  g_assert_cmpuint (g_hash_table_size (bad_ids), ==, 0);
-  g_assert_cmpuint (n_contacts, ==, 1);
-  g_assert_cmpstr (good_ids[0], !=, NULL);
-  g_assert (contacts[0] != NULL);
+  *contact_loc = tp_connection_dup_contact_by_id_finish (connection, result,
+      &error);
 
-  *contact_loc = g_object_ref (contacts[0]);
+  g_assert_no_error (error);
+  g_assert (TP_IS_CONTACT (*contact_loc));
 }
 
 TpContact *
@@ -501,8 +496,8 @@ tp_tests_connection_run_until_contact_by_id (TpConnection *connection,
 {
   TpContact *contact = NULL;
 
-  tp_connection_get_contacts_by_id (connection, 1, &id, n_features, features,
-      one_contact_cb, &contact, NULL, NULL);
+  tp_connection_dup_contact_by_id_async (connection, id, n_features, features,
+      one_contact_cb, &contact);
 
   while (contact == NULL)
     g_main_context_iteration (NULL, TRUE);



More information about the telepathy-commits mailing list