[folks] Update telepathy test lib copy
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [folks] Update telepathy test lib copy
- Date: Tue, 22 May 2012 14:48:45 +0000 (UTC)
commit 8adc76353f6c7234ab38cafeb3689c806e186708
Author: Xavier Claessens <xavier claessens collabora co uk>
Date: Tue May 22 16:15:43 2012 +0200
Update telepathy test lib copy
.../telepathy/contactlist/contact-list-manager.c | 2 -
.../telepathy/contactlist/simple-account-manager.c | 30 +++++++-
.../telepathy/contactlist/simple-account-manager.h | 6 ++
tests/lib/telepathy/contactlist/simple-account.c | 1 +
tests/lib/telepathy/contactlist/simple-conn.c | 3 -
tests/lib/telepathy/contactlist/util.c | 71 +++-----------------
tests/lib/telepathy/contactlist/util.h | 4 -
7 files changed, 44 insertions(+), 73 deletions(-)
---
diff --git a/tests/lib/telepathy/contactlist/contact-list-manager.c b/tests/lib/telepathy/contactlist/contact-list-manager.c
index 638c92b..6d01282 100644
--- a/tests/lib/telepathy/contactlist/contact-list-manager.c
+++ b/tests/lib/telepathy/contactlist/contact-list-manager.c
@@ -62,7 +62,6 @@ contact_detail_destroy (gpointer p)
g_free (d->publish_request);
tp_handle_set_destroy (d->groups);
- tp_handle_unref (d->contact_repo, d->handle);
g_slice_free (ContactDetails, d);
}
@@ -90,7 +89,6 @@ ensure_contact (TpTestsContactListManager *self,
d->groups = tp_handle_set_new (self->priv->group_repo);
d->handle = handle;
d->contact_repo = self->priv->contact_repo;
- tp_handle_ref (d->contact_repo, d->handle);
g_hash_table_insert (self->priv->contact_details,
GUINT_TO_POINTER (handle), d);
diff --git a/tests/lib/telepathy/contactlist/simple-account-manager.c b/tests/lib/telepathy/contactlist/simple-account-manager.c
index 8df364a..e1fec67 100644
--- a/tests/lib/telepathy/contactlist/simple-account-manager.c
+++ b/tests/lib/telepathy/contactlist/simple-account-manager.c
@@ -13,6 +13,7 @@
#include "simple-account-manager.h"
+#include <telepathy-glib/account.h>
#include <telepathy-glib/gtypes.h>
#include <telepathy-glib/interfaces.h>
#include <telepathy-glib/svc-generic.h>
@@ -49,7 +50,7 @@ struct _TpTestsSimpleAccountManagerPrivate
};
static void
-tp_tests_simple_account_manager_create_account (TpSvcAccountManager *self,
+tp_tests_simple_account_manager_create_account (TpSvcAccountManager *svc,
const gchar *in_Connection_Manager,
const gchar *in_Protocol,
const gchar *in_Display_Name,
@@ -57,9 +58,24 @@ tp_tests_simple_account_manager_create_account (TpSvcAccountManager *self,
GHashTable *in_Properties,
DBusGMethodInvocation *context)
{
- const gchar *out_Account = "/some/fake/account/i/think";
-
- tp_svc_account_manager_return_from_create_account (context, out_Account);
+ TpTestsSimpleAccountManager *self = (TpTestsSimpleAccountManager *) svc;
+ const gchar *out = TP_ACCOUNT_OBJECT_PATH_BASE "gabble/jabber/lospolloshermanos";
+
+ /* if we have fail=yes as a parameter, make the call fail */
+ if (!tp_strdiff (tp_asv_get_string (in_Parameters, "fail"), "yes"))
+ {
+ GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "loldongs" };
+ dbus_g_method_return_error (context, &e);
+ return;
+ }
+
+ self->create_cm = g_strdup (in_Connection_Manager);
+ self->create_protocol = g_strdup (in_Protocol);
+ self->create_display_name = g_strdup (in_Display_Name);
+ self->create_parameters = g_hash_table_ref (in_Parameters);
+ self->create_properties = g_hash_table_ref (in_Properties);
+
+ tp_svc_account_manager_return_from_create_account (context, out);
}
static void
@@ -118,6 +134,12 @@ tp_tests_simple_account_manager_finalize (GObject *object)
g_ptr_array_unref (self->priv->valid_accounts);
g_ptr_array_unref (self->priv->invalid_accounts);
+ tp_clear_pointer (&self->create_cm, g_free);
+ tp_clear_pointer (&self->create_protocol, g_free);
+ tp_clear_pointer (&self->create_display_name, g_free);
+ tp_clear_pointer (&self->create_parameters, g_hash_table_unref);
+ tp_clear_pointer (&self->create_properties, g_hash_table_unref);
+
G_OBJECT_CLASS (tp_tests_simple_account_manager_parent_class)->finalize (
object);
}
diff --git a/tests/lib/telepathy/contactlist/simple-account-manager.h b/tests/lib/telepathy/contactlist/simple-account-manager.h
index c34a6bf..d1608d5 100644
--- a/tests/lib/telepathy/contactlist/simple-account-manager.h
+++ b/tests/lib/telepathy/contactlist/simple-account-manager.h
@@ -30,6 +30,12 @@ struct _TpTestsSimpleAccountManagerClass {
struct _TpTestsSimpleAccountManager {
GObject parent;
+ gchar *create_cm;
+ gchar *create_protocol;
+ gchar *create_display_name;
+ GHashTable *create_parameters;
+ GHashTable *create_properties;
+
TpTestsSimpleAccountManagerPrivate *priv;
};
diff --git a/tests/lib/telepathy/contactlist/simple-account.c b/tests/lib/telepathy/contactlist/simple-account.c
index f424309..6279d75 100644
--- a/tests/lib/telepathy/contactlist/simple-account.c
+++ b/tests/lib/telepathy/contactlist/simple-account.c
@@ -272,6 +272,7 @@ tp_tests_simple_account_finalize (GObject *object)
g_free (self->priv->presence_status);
g_free (self->priv->presence_msg);
+ g_free (self->priv->connection_path);
G_OBJECT_CLASS (tp_tests_simple_account_parent_class)->finalize (object);
}
diff --git a/tests/lib/telepathy/contactlist/simple-conn.c b/tests/lib/telepathy/contactlist/simple-conn.c
index 8874654..51bf9e2 100644
--- a/tests/lib/telepathy/contactlist/simple-conn.c
+++ b/tests/lib/telepathy/contactlist/simple-conn.c
@@ -350,7 +350,6 @@ tp_tests_simple_connection_set_identifier (TpTestsSimpleConnection *self,
g_return_if_fail (handle != 0);
tp_base_connection_set_self_handle (conn, handle);
- tp_handle_unref (contact_repo, handle);
}
TpTestsSimpleConnection *
@@ -407,8 +406,6 @@ tp_tests_simple_connection_ensure_text_chan (TpTestsSimpleConnection *self,
chan);
}
- tp_handle_unref (contact_repo, handle);
-
if (props != NULL)
*props = tp_tests_text_channel_get_props (chan);
diff --git a/tests/lib/telepathy/contactlist/util.c b/tests/lib/telepathy/contactlist/util.c
index a3b7bab..009d964 100644
--- a/tests/lib/telepathy/contactlist/util.c
+++ b/tests/lib/telepathy/contactlist/util.c
@@ -114,50 +114,6 @@ tp_tests_proxy_run_until_dbus_queue_processed (gpointer proxy)
g_main_loop_unref (loop);
}
-typedef struct {
- GMainLoop *loop;
- TpHandle handle;
-} HandleRequestResult;
-
-static void
-handles_requested_cb (TpConnection *connection G_GNUC_UNUSED,
- TpHandleType handle_type G_GNUC_UNUSED,
- guint n_handles,
- const TpHandle *handles,
- const gchar * const *ids G_GNUC_UNUSED,
- const GError *error,
- gpointer user_data,
- GObject *weak_object G_GNUC_UNUSED)
-{
- HandleRequestResult *result = user_data;
-
- g_assert_no_error ((GError *) error);
- g_assert_cmpuint (n_handles, ==, 1);
- result->handle = handles[0];
-}
-
-static void
-handle_request_result_finish (gpointer r)
-{
- HandleRequestResult *result = r;
-
- g_main_loop_quit (result->loop);
-}
-
-TpHandle
-tp_tests_connection_run_request_contact_handle (TpConnection *connection,
- const gchar *id)
-{
- HandleRequestResult result = { g_main_loop_new (NULL, FALSE), 0 };
- const gchar * const ids[] = { id, NULL };
-
- tp_connection_request_handles (connection, -1, TP_HANDLE_TYPE_CONTACT, ids,
- handles_requested_cb, &result, handle_request_result_finish, NULL);
- g_main_loop_run (result.loop);
- g_main_loop_unref (result.loop);
- return result.handle;
-}
-
void
_test_assert_empty_strv (const char *file,
int line,
@@ -473,24 +429,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 +452,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);
diff --git a/tests/lib/telepathy/contactlist/util.h b/tests/lib/telepathy/contactlist/util.h
index 3fccc4c..d58138e 100644
--- a/tests/lib/telepathy/contactlist/util.h
+++ b/tests/lib/telepathy/contactlist/util.h
@@ -18,10 +18,6 @@ TpDBusDaemon *tp_tests_dbus_daemon_dup_or_die (void);
void tp_tests_proxy_run_until_dbus_queue_processed (gpointer proxy);
-TpHandle tp_tests_connection_run_request_contact_handle (
- TpConnection *connection,
- const gchar *id);
-
void tp_tests_proxy_run_until_prepared (gpointer proxy,
const GQuark *features);
gboolean tp_tests_proxy_run_until_prepared_or_failed (gpointer proxy,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]