summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2012-09-19 12:26:09 +0100
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-09-26 14:50:14 +0200
commit51487e6aa62e43661f32ec8055a8185d661cff49 (patch)
treee8b1b8e2e43257da1f82f9542cd620964e896de4 /tests
parent08fa36559db4ee3909c4f62e15fc2b64c0c181ab (diff)
downloadtelepathy-glib-51487e6aa62e43661f32ec8055a8185d661cff49.tar.gz
tp_account_channel_request_new_vardict: add
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=55099
Diffstat (limited to 'tests')
-rw-r--r--tests/dbus/account-channel-request.c97
1 files changed, 40 insertions, 57 deletions
diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c
index 6621f1e5a..895f1b8da 100644
--- a/tests/dbus/account-channel-request.c
+++ b/tests/dbus/account-channel-request.c
@@ -189,6 +189,16 @@ create_request (void)
NULL);
}
+static GVariant *
+floating_request (void)
+{
+ return g_variant_new_parsed (
+ "{ %s: <%s>, %s: <%u>, %s: <%s> }",
+ TP_PROP_CHANNEL_CHANNEL_TYPE, TP_IFACE_CHANNEL_TYPE_TEXT,
+ TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, (guint32) TP_HANDLE_TYPE_CONTACT,
+ TP_PROP_CHANNEL_TARGET_ID, "alice");
+}
+
static void
test_handle_create_success (Test *test,
gconstpointer data G_GNUC_UNUSED)
@@ -481,18 +491,16 @@ static void
test_handle_cancel_before (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
g_cancellable_cancel (test->cancellable);
tp_account_channel_request_ensure_and_handle_channel_async (req,
test->cancellable, create_and_handle_cb, test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -512,11 +520,10 @@ static void
test_handle_cancel_after_create (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_ensure_and_handle_channel_async (req,
test->cancellable, create_and_handle_cb, test);
@@ -524,7 +531,6 @@ test_handle_cancel_after_create (Test *test,
g_signal_connect (test->cd_service, "channel-request-created",
G_CALLBACK (channel_request_created_cb), test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -553,11 +559,10 @@ static void
test_handle_re_handle (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req, *req2;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_ensure_and_handle_channel_async (req,
NULL, ensure_and_handle_cb, test);
@@ -569,7 +574,8 @@ test_handle_re_handle (Test *test,
G_CALLBACK (re_handled_cb), test);
/* Ensure the same channel to re-handle it */
- req2 = tp_account_channel_request_new (test->account, request, 666);
+ req2 = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 666);
tp_account_channel_request_ensure_and_handle_channel_async (req2,
NULL, ensure_and_handle_cb, test);
@@ -578,7 +584,6 @@ test_handle_re_handle (Test *test,
test->count = 2;
g_main_loop_run (test->mainloop);
- g_hash_table_unref (request);
g_object_unref (req);
g_object_unref (req2);
}
@@ -636,12 +641,11 @@ static void
test_handle_create_success_hints (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
GHashTable *hints;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
hints = create_hints ();
tp_account_channel_request_set_hints (req, hints);
@@ -650,7 +654,6 @@ test_handle_create_success_hints (Test *test,
tp_account_channel_request_create_and_handle_channel_async (req,
NULL, create_and_handle_hints_cb, test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -721,7 +724,6 @@ static void
test_handle_delegated (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
GPtrArray *requests, *requests_satisified, *channels;
GHashTable *hints, *request_props, *info;
@@ -729,8 +731,8 @@ test_handle_delegated (Test *test,
TpBaseClient *base_client;
TpClient *client;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
/* Allow other clients to preempt the channel */
tp_account_channel_request_set_delegated_channel_callback (req,
@@ -739,7 +741,6 @@ test_handle_delegated (Test *test,
tp_account_channel_request_create_and_handle_channel_async (req,
NULL, create_and_handle_cb, test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -827,16 +828,14 @@ static void
test_forget_create_success (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_create_channel_async (req, "Fake", NULL, create_cb,
test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -861,16 +860,14 @@ static void
test_forget_ensure_success (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_ensure_channel_async (req, "Fake", NULL, ensure_cb,
test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -960,18 +957,16 @@ static void
test_forget_cancel_before (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
g_cancellable_cancel (test->cancellable);
tp_account_channel_request_create_channel_async (req, "Fake",
test->cancellable, create_cb, test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -982,11 +977,10 @@ static void
test_forget_cancel_after_create (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_create_channel_async (req, "Fake",
test->cancellable, create_cb, test);
@@ -994,7 +988,6 @@ test_forget_cancel_after_create (Test *test,
g_signal_connect (test->cd_service, "channel-request-created",
G_CALLBACK (channel_request_created_cb), test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -1026,16 +1019,14 @@ static void
test_observe_create_success (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_create_and_observe_channel_async (req, "Fake",
NULL, create_and_observe_cb, test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -1144,16 +1135,14 @@ static void
test_observe_ensure_success (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_ensure_and_observe_channel_async (req, "Fake",
NULL, ensure_and_observe_cb, test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -1165,18 +1154,16 @@ static void
test_observe_cancel_before (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
g_cancellable_cancel (test->cancellable);
tp_account_channel_request_create_and_observe_channel_async (req, "Fake",
test->cancellable, create_and_observe_cb, test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -1187,11 +1174,10 @@ static void
test_observe_cancel_after_create (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_create_and_observe_channel_async (req, "Fake",
test->cancellable, create_and_observe_cb, test);
@@ -1199,7 +1185,6 @@ test_observe_cancel_after_create (Test *test,
g_signal_connect (test->cd_service, "channel-request-created",
G_CALLBACK (channel_request_created_cb), test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);
@@ -1211,16 +1196,14 @@ static void
test_observe_no_channel (Test *test,
gconstpointer data G_GNUC_UNUSED)
{
- GHashTable *request;
TpAccountChannelRequest *req;
- request = create_request ();
- req = tp_account_channel_request_new (test->account, request, 0);
+ req = tp_account_channel_request_new_vardict (test->account,
+ floating_request (), 0);
tp_account_channel_request_create_and_observe_channel_async (req,
"FakeNoChannel", NULL, create_and_observe_cb, test);
- g_hash_table_unref (request);
g_object_unref (req);
g_main_loop_run (test->mainloop);