From eb9bd7ff359877d76d4d7dd732dec5725cf95ee8 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 16 Apr 2012 19:06:06 +0100 Subject: [PATCH 11/14] Test tp_account_channel_request_new_file_transfer --- tests/dbus/account-channel-request.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/dbus/account-channel-request.c b/tests/dbus/account-channel-request.c index d5ef0d3..a194f44 100644 --- a/tests/dbus/account-channel-request.c +++ b/tests/dbus/account-channel-request.c @@ -318,10 +318,12 @@ test_handle_cr_failed (Test *test, request = create_request (); - /* Ask to the CR to fire the signal */ - tp_asv_set_boolean (request, "FireFailed", TRUE); + req = tp_account_channel_request_new_file_transfer (test->account, + "warez.rar", "application/x-rar", G_GUINT64_CONSTANT (1234567890123), 0); - req = tp_account_channel_request_new (test->account, request, 0); + /* Ask to the CR to fire the signal */ + tp_account_channel_request_set_request_property (req, "FireFailed", + g_variant_new_boolean (TRUE)); tp_account_channel_request_create_and_handle_channel_async (req, NULL, create_and_handle_cb, test); @@ -332,6 +334,22 @@ test_handle_cr_failed (Test *test, 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_FILE_TRANSFER); + g_assert_cmpstr (tp_asv_get_string (test->cd_service->last_request, + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_FILENAME), ==, "warez.rar"); + g_assert_cmpuint (tp_asv_get_uint64 (test->cd_service->last_request, + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_SIZE, NULL), ==, + G_GUINT64_CONSTANT (1234567890123)); + g_assert_cmpstr (tp_asv_get_string (test->cd_service->last_request, + TP_PROP_CHANNEL_TYPE_FILE_TRANSFER_CONTENT_TYPE), ==, + "application/x-rar"); + g_assert_cmpuint (tp_asv_get_boolean (test->cd_service->last_request, + "FireFailed", NULL), ==, TRUE); + g_assert_cmpuint (tp_asv_size (test->cd_service->last_request), ==, 5); + g_assert_cmpuint (test->cd_service->last_user_action_time, ==, 0); } static void -- 1.7.10