summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-12-26 10:43:22 +0100
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-12-26 11:25:24 +0100
commit7cde2ad7efcec9e80e12bf207a4ebddc77eb1c73 (patch)
treeb19c7953174c9382ab9795ea05faf5f3416ffaf2
parentad3fde37bf833a75104cafcc75da935fd7e38dd0 (diff)
Tests: Use _dup_ instead of _get_
-rw-r--r--tests/contact-search-result.c6
-rw-r--r--tests/dbus/base-client.c54
-rw-r--r--tests/dbus/channel-dispatch-operation.c24
-rw-r--r--tests/dbus/channel-introspect.c16
-rw-r--r--tests/dbus/contacts.c14
-rw-r--r--tests/dbus/text-channel.c26
6 files changed, 70 insertions, 70 deletions
diff --git a/tests/contact-search-result.c b/tests/contact-search-result.c
index 63f914be5..10728ed27 100644
--- a/tests/contact-search-result.c
+++ b/tests/contact-search-result.c
@@ -37,7 +37,7 @@ test_contact_search_result (void)
identifier = tp_contact_search_result_get_identifier (result);
g_assert_cmpstr (identifier, ==, "id");
- fields = tp_contact_search_result_get_fields (result);
+ fields = tp_contact_search_result_dup_fields (result);
g_assert (fields == NULL);
field = tp_contact_search_result_get_field (result, "fn");
@@ -47,9 +47,9 @@ test_contact_search_result (void)
g_assert (field != NULL);
_tp_contact_search_result_insert_field (result, field);
- fields = tp_contact_search_result_get_fields (result);
+ fields = tp_contact_search_result_dup_fields (result);
g_assert (fields != NULL);
- g_list_free (fields);
+ tp_contact_info_list_free (fields);
field = tp_contact_search_result_get_field (result, "fn");
g_assert (field != NULL);
diff --git a/tests/dbus/base-client.c b/tests/dbus/base-client.c
index 674b36548..b568b009a 100644
--- a/tests/dbus/base-client.c
+++ b/tests/dbus/base-client.c
@@ -701,17 +701,17 @@ test_approver (Test *test,
g_assert_no_error (test->error);
g_assert (test->simple_client->add_dispatch_ctx != NULL);
- chans = tp_channel_dispatch_operation_borrow_channels (
+ chans = tp_channel_dispatch_operation_get_channels (
test->simple_client->add_dispatch_ctx->dispatch_operation);
g_assert_cmpuint (chans->len, ==, 2);
/* Check that we reuse existing proxies rather than creating new ones */
g_assert (test->simple_client->add_dispatch_ctx->account == test->account);
- g_assert (tp_channel_dispatch_operation_borrow_account (
+ g_assert (tp_channel_dispatch_operation_get_account (
test->simple_client->add_dispatch_ctx->dispatch_operation) ==
test->account);
- g_assert (tp_channel_dispatch_operation_borrow_connection (
+ g_assert (tp_channel_dispatch_operation_get_connection (
test->simple_client->add_dispatch_ctx->dispatch_operation) ==
test->simple_client->add_dispatch_ctx->connection);
@@ -743,7 +743,7 @@ test_approver (Test *test,
g_assert (test->simple_client->add_dispatch_ctx != NULL);
/* The CDO only contain valid channels */
- chans = tp_channel_dispatch_operation_borrow_channels (
+ chans = tp_channel_dispatch_operation_get_channels (
test->simple_client->add_dispatch_ctx->dispatch_operation);
g_assert_cmpuint (chans->len, ==, 1);
/* But the context contains both */
@@ -911,9 +911,9 @@ test_handler (Test *test,
g_assert (test->simple_client->handle_channels_ctx != NULL);
g_assert (test->simple_client->handle_channels_ctx->account == test->account);
- chans = tp_base_client_get_handled_channels (test->base_client);
+ chans = tp_base_client_dup_handled_channels (test->base_client);
g_assert_cmpuint (g_list_length (chans), ==, 2);
- g_list_free (chans);
+ g_list_free_full (chans, g_object_unref);
g_assert (tp_base_client_is_handling_channel (test->base_client,
test->text_chan));
@@ -926,9 +926,9 @@ test_handler (Test *test,
tp_base_channel_close ((TpBaseChannel *) test->text_chan_service);
g_main_loop_run (test->mainloop);
- chans = tp_base_client_get_handled_channels (test->base_client);
+ chans = tp_base_client_dup_handled_channels (test->base_client);
g_assert_cmpuint (g_list_length (chans), ==, 1);
- g_list_free (chans);
+ g_list_free_full (chans, g_object_unref);
g_assert (!tp_base_client_is_handling_channel (test->base_client,
test->text_chan));
@@ -941,9 +941,9 @@ test_handler (Test *test,
tp_base_client_register (TP_BASE_CLIENT (client_2), &test->error);
g_assert_no_error (test->error);
- chans = tp_base_client_get_handled_channels (TP_BASE_CLIENT (client_2));
+ chans = tp_base_client_dup_handled_channels (TP_BASE_CLIENT (client_2));
g_assert_cmpuint (g_list_length (chans), ==, 1);
- g_list_free (chans);
+ g_list_free_full (chans, g_object_unref);
g_assert (!tp_base_client_is_handling_channel (TP_BASE_CLIENT (client_2),
test->text_chan));
@@ -992,10 +992,10 @@ request_added_cb (TpBaseClient *client,
g_assert (TP_IS_ACCOUNT (account));
g_assert (tp_proxy_is_prepared (account, TP_ACCOUNT_FEATURE_CORE));
- requests = tp_base_client_get_pending_requests (test->base_client);
+ requests = tp_base_client_dup_pending_requests (test->base_client);
g_assert_cmpuint (g_list_length ((GList *) requests), ==, 1);
g_assert (requests->data == request);
- g_list_free (requests);
+ g_list_free_full (requests, g_object_unref);
test->wait--;
if (test->wait == 0)
@@ -1059,7 +1059,7 @@ test_handler_requests (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- g_assert (tp_base_client_get_pending_requests (test->base_client) == NULL);
+ g_assert (tp_base_client_dup_pending_requests (test->base_client) == NULL);
/* Call AddRequest */
properties = tp_asv_new (
@@ -1080,9 +1080,9 @@ test_handler_requests (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- requests = tp_base_client_get_pending_requests (test->base_client);
+ requests = tp_base_client_dup_pending_requests (test->base_client);
g_assert (requests != NULL);
- g_list_free (requests);
+ g_list_free_full (requests, g_object_unref);
/* Call HandleChannels */
channels = g_ptr_array_sized_new (2);
@@ -1116,9 +1116,9 @@ test_handler_requests (Test *test,
test->simple_client->handle_channels_ctx->requests_satisfied->len, ==, 1);
request = g_ptr_array_index (
test->simple_client->handle_channels_ctx->requests_satisfied, 0);
- requests = tp_base_client_get_pending_requests (test->base_client);
+ requests = tp_base_client_dup_pending_requests (test->base_client);
g_assert (requests->data == request);
- g_list_free (requests);
+ g_list_free_full (requests, g_object_unref);
/* Call RemoveRequest */
g_signal_connect (test->base_client, "request-removed",
@@ -1132,7 +1132,7 @@ test_handler_requests (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- g_assert (tp_base_client_get_pending_requests (test->base_client) == NULL);
+ g_assert (tp_base_client_dup_pending_requests (test->base_client) == NULL);
g_hash_table_unref (properties);
g_ptr_array_foreach (channels, free_channel_details, NULL);
@@ -1220,7 +1220,7 @@ test_channel_dispatch_operation_claim_with_async (Test *test,
cdo = test->simple_client->add_dispatch_ctx->dispatch_operation;
g_assert (TP_IS_CHANNEL_DISPATCH_OPERATION (cdo));
- handled = tp_base_client_get_handled_channels (test->base_client);
+ handled = tp_base_client_dup_handled_channels (test->base_client);
g_assert (handled == NULL);
/* Connect to CDO's Finished signal so we can remove it from the bus when
@@ -1237,9 +1237,9 @@ test_channel_dispatch_operation_claim_with_async (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- handled = tp_base_client_get_handled_channels (test->base_client);
+ handled = tp_base_client_dup_handled_channels (test->base_client);
g_assert_cmpuint (g_list_length (handled), ==, 2);
- g_list_free (handled);
+ g_list_free_full (handled, g_object_unref);
g_assert (tp_base_client_is_handling_channel (test->base_client,
test->text_chan));
@@ -1304,9 +1304,9 @@ test_delegate_channels (Test *test,
g_assert_no_error (test->error);
/* The client is handling the 2 channels */
- chans = tp_base_client_get_handled_channels (test->base_client);
+ chans = tp_base_client_dup_handled_channels (test->base_client);
g_assert_cmpuint (g_list_length (chans), ==, 2);
- g_list_free (chans);
+ g_list_free_full (chans, g_object_unref);
g_assert (tp_base_client_is_handling_channel (test->base_client,
test->text_chan));
@@ -1331,9 +1331,9 @@ test_delegate_channels (Test *test,
g_assert_cmpuint (g_hash_table_size (test->not_delegated), ==, 0);
/* Client is not handling the channel any more */
- chans = tp_base_client_get_handled_channels (test->base_client);
+ chans = tp_base_client_dup_handled_channels (test->base_client);
g_assert_cmpuint (g_list_length (chans), ==, 1);
- g_list_free (chans);
+ g_list_free_full (chans, g_object_unref);
g_assert (!tp_base_client_is_handling_channel (test->base_client,
test->text_chan));
@@ -1361,9 +1361,9 @@ test_delegate_channels (Test *test,
g_assert_error (error, TP_ERROR, TP_ERROR_BUSY);
/* Client is still handling the channel */
- chans = tp_base_client_get_handled_channels (test->base_client);
+ chans = tp_base_client_dup_handled_channels (test->base_client);
g_assert_cmpuint (g_list_length (chans), ==, 1);
- g_list_free (chans);
+ g_list_free_full (chans, g_object_unref);
g_assert (!tp_base_client_is_handling_channel (test->base_client,
test->text_chan));
diff --git a/tests/dbus/channel-dispatch-operation.c b/tests/dbus/channel-dispatch-operation.c
index 56ba747db..bd320037c 100644
--- a/tests/dbus/channel-dispatch-operation.c
+++ b/tests/dbus/channel-dispatch-operation.c
@@ -343,7 +343,7 @@ check_immutable_properties (Test *test)
/* connection */
g_assert (conn != NULL);
g_assert (TP_IS_CONNECTION (conn));
- g_assert (tp_channel_dispatch_operation_borrow_connection (test->cdo)
+ g_assert (tp_channel_dispatch_operation_get_connection (test->cdo)
== conn);
g_assert_cmpstr (tp_proxy_get_object_path (conn), ==,
tp_proxy_get_object_path (test->connection));
@@ -352,7 +352,7 @@ check_immutable_properties (Test *test)
/* account */
g_assert (account != NULL);
g_assert (TP_IS_ACCOUNT (account));
- g_assert (tp_channel_dispatch_operation_borrow_account (test->cdo)
+ g_assert (tp_channel_dispatch_operation_get_account (test->cdo)
== account);
g_assert_cmpstr (tp_proxy_get_object_path (account), ==,
ACCOUNT_PATH);
@@ -365,7 +365,7 @@ check_immutable_properties (Test *test)
POSSIBLE_HANDLERS[0]));
g_strfreev (possible_handlers);
- possible_handlers = tp_channel_dispatch_operation_borrow_possible_handlers (
+ possible_handlers = tp_channel_dispatch_operation_get_possible_handlers (
test->cdo);
g_assert_cmpuint (g_strv_length (possible_handlers), ==, 1);
g_assert (tp_strv_contains ((const gchar * const *) possible_handlers,
@@ -393,7 +393,7 @@ check_channels (Test *test)
GPtrArray *channels;
TpChannel *channel;
- channels = tp_channel_dispatch_operation_borrow_channels (test->cdo);
+ channels = tp_channel_dispatch_operation_get_channels (test->cdo);
g_assert (channels != NULL);
g_assert_cmpuint (channels->len, ==, 2);
@@ -439,7 +439,7 @@ test_properties_passed (Test *test,
/* Channels is not an immutable property so have to be fetched when
* preparing the TpChannelDispatchOperation */
g_assert (channels == NULL);
- g_assert (tp_channel_dispatch_operation_borrow_channels (test->cdo) == NULL);
+ g_assert (tp_channel_dispatch_operation_get_channels (test->cdo) == NULL);
g_hash_table_unref (props);
@@ -469,13 +469,13 @@ test_properties_fetched (Test *test,
g_assert_no_error (test->error);
/* Properties are not defined yet */
- g_assert (tp_channel_dispatch_operation_borrow_connection (test->cdo)
+ g_assert (tp_channel_dispatch_operation_get_connection (test->cdo)
== NULL);
- g_assert (tp_channel_dispatch_operation_borrow_account (test->cdo)
+ g_assert (tp_channel_dispatch_operation_get_account (test->cdo)
== NULL);
- g_assert (tp_channel_dispatch_operation_borrow_channels (test->cdo)
+ g_assert (tp_channel_dispatch_operation_get_channels (test->cdo)
== NULL);
- g_assert (tp_channel_dispatch_operation_borrow_possible_handlers (test->cdo)
+ g_assert (tp_channel_dispatch_operation_get_possible_handlers (test->cdo)
== NULL);
props = tp_channel_dispatch_operation_borrow_immutable_properties (
test->cdo);
@@ -569,7 +569,7 @@ test_channel_lost (Test *test,
test->text_chan);
g_main_loop_run (test->mainloop);
- channels = tp_channel_dispatch_operation_borrow_channels (test->cdo);
+ channels = tp_channel_dispatch_operation_get_channels (test->cdo);
g_assert (channels != NULL);
/* Channel has been removed */
g_assert_cmpuint (channels->len, ==, 1);
@@ -658,7 +658,7 @@ test_channel_lost_preparing (Test *test,
g_assert (tp_proxy_is_prepared (test->cdo,
TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE));
- channels = tp_channel_dispatch_operation_borrow_channels (test->cdo);
+ channels = tp_channel_dispatch_operation_get_channels (test->cdo);
g_assert (channels != NULL);
/* Channel has been removed */
g_assert_cmpuint (channels->len, ==, 1);
@@ -717,7 +717,7 @@ test_finished_preparing (Test *test,
g_assert (!tp_proxy_is_prepared (test->cdo,
TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE));
- channels = tp_channel_dispatch_operation_borrow_channels (test->cdo);
+ channels = tp_channel_dispatch_operation_get_channels (test->cdo);
g_assert (channels == NULL);
}
diff --git a/tests/dbus/channel-introspect.c b/tests/dbus/channel-introspect.c
index 06eba5305..6e240893f 100644
--- a/tests/dbus/channel-introspect.c
+++ b/tests/dbus/channel-introspect.c
@@ -48,7 +48,7 @@ assert_chan_sane (TpChannel *chan,
TpHandle initiator_handle,
const gchar *initiator_id)
{
- GHashTable *asv;
+ GVariant *variant;
TpHandleType type;
TpContact *contact;
@@ -62,7 +62,7 @@ assert_chan_sane (TpChannel *chan,
TP_IFACE_CHANNEL_TYPE_TEXT);
g_assert_cmpuint (tp_channel_get_channel_type_id (chan), ==,
TP_IFACE_QUARK_CHANNEL_TYPE_TEXT);
- g_assert (TP_IS_CONNECTION (tp_channel_borrow_connection (chan)));
+ g_assert (TP_IS_CONNECTION (tp_channel_get_connection (chan)));
g_assert_cmpstr (tp_channel_get_identifier (chan), ==, IDENTIFIER);
g_assert (tp_channel_get_requested (chan) == requested);
@@ -82,19 +82,19 @@ assert_chan_sane (TpChannel *chan,
g_assert (contact == NULL);
}
- asv = tp_channel_borrow_immutable_properties (chan);
- g_assert (asv != NULL);
+ variant = tp_channel_dup_immutable_properties (chan);
+ g_assert (variant != NULL);
g_assert_cmpstr (
- tp_asv_get_string (asv, TP_PROP_CHANNEL_CHANNEL_TYPE), ==,
+ tp_vardict_get_string (variant, TP_PROP_CHANNEL_CHANNEL_TYPE), ==,
TP_IFACE_CHANNEL_TYPE_TEXT);
g_assert_cmpuint (
- tp_asv_get_uint32 (asv, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL), ==,
+ tp_vardict_get_uint32 (variant, TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL), ==,
handle == 0 ? TP_HANDLE_TYPE_NONE : TP_HANDLE_TYPE_CONTACT);
g_assert_cmpuint (
- tp_asv_get_uint32 (asv, TP_PROP_CHANNEL_TARGET_HANDLE, NULL), ==,
+ tp_vardict_get_uint32 (variant, TP_PROP_CHANNEL_TARGET_HANDLE, NULL), ==,
handle);
g_assert_cmpstr (
- tp_asv_get_string (asv, TP_PROP_CHANNEL_TARGET_ID), ==,
+ tp_vardict_get_string (variant, TP_PROP_CHANNEL_TARGET_ID), ==,
IDENTIFIER);
}
diff --git a/tests/dbus/contacts.c b/tests/dbus/contacts.c
index c2fd65c7d..41eddb9ab 100644
--- a/tests/dbus/contacts.c
+++ b/tests/dbus/contacts.c
@@ -103,7 +103,7 @@ contact_info_verify (TpContact *contact)
g_assert (tp_contact_has_feature (contact, TP_CONTACT_FEATURE_CONTACT_INFO));
- info = tp_contact_get_contact_info (contact);
+ info = tp_contact_dup_contact_info (contact);
g_assert (info != NULL);
g_assert (info->data != NULL);
g_assert (info->next == NULL);
@@ -116,7 +116,7 @@ contact_info_verify (TpContact *contact)
g_assert_cmpstr (field->field_value[0], ==, "Foo");
g_assert (field->field_value[1] == NULL);
- g_list_free (info);
+ tp_contact_info_list_free (info);
}
static void
@@ -145,7 +145,7 @@ contact_info_prepare_cb (GObject *object,
g_assert_cmpint (flags, ==, TP_CONTACT_INFO_FLAG_PUSH |
TP_CONTACT_INFO_FLAG_CAN_SET);
- specs = tp_connection_get_contact_info_supported_fields (connection);
+ specs = tp_connection_dup_contact_info_supported_fields (connection);
g_assert_cmpuint (g_list_length (specs), ==, 5);
for (l = specs; l != NULL; l = l->next)
@@ -175,7 +175,7 @@ contact_info_prepare_cb (GObject *object,
}
}
- g_list_free (specs);
+ tp_contact_info_spec_list_free (specs);
}
finish (result);
@@ -331,7 +331,7 @@ test_contact_info (Fixture *f,
g_main_loop_run (result.loop);
g_assert_no_error (result.error);
- g_assert (tp_contact_get_contact_info (contact) == NULL);
+ g_assert (tp_contact_dup_contact_info (contact) == NULL);
g_signal_connect (contact, "notify::contact-info",
G_CALLBACK (contact_info_notify_cb), &result);
@@ -351,7 +351,7 @@ test_contact_info (Fixture *f,
g_main_loop_run (result.loop);
g_assert_no_error (result.error);
- g_assert (tp_contact_get_contact_info (contact) == NULL);
+ g_assert (tp_contact_dup_contact_info (contact) == NULL);
tp_contact_request_contact_info_async (contact, NULL, contact_info_request_cb,
&result);
@@ -370,7 +370,7 @@ test_contact_info (Fixture *f,
g_main_loop_run (result.loop);
g_assert_no_error (result.error);
- g_assert (tp_contact_get_contact_info (contact) == NULL);
+ g_assert (tp_contact_dup_contact_info (contact) == NULL);
cancellable = g_cancellable_new ();
tp_contact_request_contact_info_async (contact, cancellable,
diff --git a/tests/dbus/text-channel.c b/tests/dbus/text-channel.c
index 0ff20c521..80660b12d 100644
--- a/tests/dbus/text-channel.c
+++ b/tests/dbus/text-channel.c
@@ -329,9 +329,9 @@ test_pending_messages (Test *test,
g_assert_no_error (test->error);
/* We didn't prepare the feature yet so there is no pending msg */
- messages = tp_text_channel_get_pending_messages (test->channel);
+ messages = tp_text_channel_dup_pending_messages (test->channel);
g_assert_cmpuint (g_list_length (messages), ==, 0);
- g_list_free (messages);
+ g_list_free_full (messages, g_object_unref);
tp_proxy_prepare_async (test->channel, features,
proxy_prepare_cb, test);
@@ -343,7 +343,7 @@ test_pending_messages (Test *test,
TP_TEXT_CHANNEL_FEATURE_INCOMING_MESSAGES));
/* We have the pending messages now */
- messages = tp_text_channel_get_pending_messages (test->channel);
+ messages = tp_text_channel_dup_pending_messages (test->channel);
g_assert_cmpuint (g_list_length (messages), ==, 2);
/* Check first message */
@@ -368,7 +368,7 @@ test_pending_messages (Test *test,
g_assert (sender != NULL);
g_assert_cmpstr (tp_contact_get_identifier (sender), ==, "bob");
- g_list_free (messages);
+ g_list_free_full (messages, g_object_unref);
}
static void
@@ -477,7 +477,7 @@ test_ack_messages (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- messages = tp_text_channel_get_pending_messages (test->channel);
+ messages = tp_text_channel_dup_pending_messages (test->channel);
g_assert_cmpuint (g_list_length (messages), ==, 2);
tp_text_channel_ack_messages_async (test->channel, messages,
@@ -486,10 +486,10 @@ test_ack_messages (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- g_list_free (messages);
+ g_list_free_full (messages, g_object_unref);
/* Messages have been acked so there is no pending messages */
- messages = tp_text_channel_get_pending_messages (test->channel);
+ messages = tp_text_channel_dup_pending_messages (test->channel);
g_assert_cmpuint (g_list_length (messages), ==, 0);
}
@@ -567,7 +567,7 @@ test_ack_message (Test *test,
g_assert (test->received_msg == test->removed_msg);
/* Messages has been acked so there is no pending messages */
- messages = tp_text_channel_get_pending_messages (test->channel);
+ messages = tp_text_channel_dup_pending_messages (test->channel);
g_assert_cmpuint (g_list_length (messages), ==, 0);
}
@@ -775,7 +775,7 @@ test_ack_all_pending_messages (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- messages = tp_text_channel_get_pending_messages (test->channel);
+ messages = tp_text_channel_dup_pending_messages (test->channel);
g_assert_cmpuint (g_list_length (messages), ==, 2);
tp_text_channel_ack_all_pending_messages_async (test->channel,
@@ -784,10 +784,10 @@ test_ack_all_pending_messages (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- g_list_free (messages);
+ g_list_free_full (messages, g_object_unref);
/* Messages have been acked so there is no pending messages */
- messages = tp_text_channel_get_pending_messages (test->channel);
+ messages = tp_text_channel_dup_pending_messages (test->channel);
g_assert_cmpuint (g_list_length (messages), ==, 0);
}
@@ -824,7 +824,7 @@ test_pending_messages_with_no_sender_id (Test *test,
g_main_loop_run (test->mainloop);
g_assert_no_error (test->error);
- messages = tp_text_channel_get_pending_messages (test->channel);
+ messages = tp_text_channel_dup_pending_messages (test->channel);
g_assert (messages != NULL);
g_assert_cmpuint (g_list_length (messages), ==, 1);
@@ -836,7 +836,7 @@ test_pending_messages_with_no_sender_id (Test *test,
g_assert_cmpstr (text, ==, "hi mum");
g_free (text);
- g_list_free (messages);
+ g_list_free_full (messages, g_object_unref);
}
static void