[next] telepathy-glib: Test requesting audio and audio/video calls, and arbitrary properties

Simon McVittie smcv at kemper.freedesktop.org
Mon Apr 30 11:57:31 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 0c4e961c10b5afbc322d6a36529b63c6f5f71496
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=0c4e961c10b5afbc322d6a36529b63c6f5f71496

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Mon Apr 16 18:44:26 2012 +0100

Test requesting audio and audio/video calls, and arbitrary properties

Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Jonny Lamb <jonny.lamb at collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=48780

---

 tests/dbus/account-channel-request.c |   59 ++++++++++++++++++++++++---------
 1 files changed, 43 insertions(+), 16 deletions(-)

diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c
index a3a5c38..d5ef0d3 100644
--- a/tests/dbus/account-channel-request.c
+++ b/tests/dbus/account-channel-request.c
@@ -234,25 +234,45 @@ static void
 test_handle_create_fail (Test *test,
     gconstpointer data G_GNUC_UNUSED)
 {
-  GHashTable *request;
   TpAccountChannelRequest *req;
 
-  request = create_request ();
-
-  /* Ask to the CD to fail */
-  tp_asv_set_boolean (request, "CreateChannelFail", TRUE);
-
-  req = tp_account_channel_request_new (test->account, request, 0);
+  req = tp_account_channel_request_new_audio_call (test->account, 666);
+  tp_account_channel_request_set_target_id (req, TP_HANDLE_TYPE_CONTACT,
+      "alice");
+  tp_account_channel_request_set_request_property (req, "com.example.Int",
+      g_variant_new_int32 (17));
+  tp_account_channel_request_set_request_property (req, "com.example.String",
+      g_variant_new_string ("ferret"));
+  /* Ask the CD to fail */
+  tp_account_channel_request_set_request_property (req, "CreateChannelFail",
+      g_variant_new_boolean (TRUE));
 
   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);
   g_assert_error (test->error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT);
   g_assert (test->channel == NULL);
+
+  /* The request had the properties we wanted */
+  g_assert_cmpstr (tp_asv_get_string (test->cd_service->last_request,
+        TP_PROP_CHANNEL_CHANNEL_TYPE), ==, TP_IFACE_CHANNEL_TYPE_CALL);
+  g_assert_cmpstr (tp_asv_get_string (test->cd_service->last_request,
+        TP_PROP_CHANNEL_TARGET_ID), ==, "alice");
+  g_assert_cmpuint (tp_asv_get_uint32 (test->cd_service->last_request,
+        TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, NULL), ==, TP_HANDLE_TYPE_CONTACT);
+  g_assert_cmpuint (tp_asv_get_boolean (test->cd_service->last_request,
+        TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, NULL), ==, TRUE);
+  g_assert_cmpstr (tp_asv_get_string (test->cd_service->last_request,
+        "com.example.String"), ==, "ferret");
+  g_assert_cmpuint (tp_asv_get_int32 (test->cd_service->last_request,
+        "com.example.Int", NULL), ==, 17);
+  g_assert_cmpuint (tp_asv_get_boolean (test->cd_service->last_request,
+        "CreateChannelFail", NULL), ==, TRUE);
+  g_assert_cmpuint (tp_asv_size (test->cd_service->last_request), ==, 7);
+  g_assert_cmpuint (test->cd_service->last_user_action_time, ==, 666);
 }
 
 /* ChannelRequest.Proceed() call fails */
@@ -260,25 +280,32 @@ static void
 test_handle_proceed_fail (Test *test,
     gconstpointer data G_GNUC_UNUSED)
 {
-  GHashTable *request;
   TpAccountChannelRequest *req;
 
-  request = create_request ();
-
-  /* Ask to the CD to fail */
-  tp_asv_set_boolean (request, "ProceedFail", TRUE);
-
-  req = tp_account_channel_request_new (test->account, request, 0);
+  req = tp_account_channel_request_new_audio_video_call (test->account, 0);
+  /* Ask the CD to fail */
+  tp_account_channel_request_set_request_property (req, "ProceedFail",
+      g_variant_new_boolean (TRUE));
 
   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);
   g_assert_error (test->error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT);
   g_assert (test->channel == NULL);
+
+  /* The request had the properties we wanted */
+  g_assert_cmpstr (tp_asv_get_string (test->cd_service->last_request,
+        TP_PROP_CHANNEL_CHANNEL_TYPE), ==, TP_IFACE_CHANNEL_TYPE_CALL);
+  g_assert_cmpuint (tp_asv_get_boolean (test->cd_service->last_request,
+        TP_PROP_CHANNEL_TYPE_CALL_INITIAL_AUDIO, NULL), ==, TRUE);
+  g_assert_cmpuint (tp_asv_get_boolean (test->cd_service->last_request,
+        TP_PROP_CHANNEL_TYPE_CALL_INITIAL_VIDEO, NULL), ==, TRUE);
+  g_assert_cmpuint (tp_asv_get_boolean (test->cd_service->last_request,
+        "ProceedFail", NULL), ==, TRUE);
+  g_assert_cmpuint (tp_asv_size (test->cd_service->last_request), ==, 4);
 }
 
 /* ChannelRequest fire the 'Failed' signal */



More information about the telepathy-commits mailing list