[spice-gtk v2 12/16] tests: file-transfer cancel on task start

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 tests/file-transfer.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/tests/file-transfer.c b/tests/file-transfer.c
index 5ef11a7..1421f1e 100644
--- a/tests/file-transfer.c
+++ b/tests/file-transfer.c
@@ -144,6 +144,32 @@ test_simple_transfer(Fixture *f, gconstpointer user_data)
     g_main_loop_run (f->loop);
 }
 
+/*******************************************************************************
+ * TEST CANCEL ON START TASK
+ ******************************************************************************/
+
+static void
+test_cancel_on_start_task(Fixture *f, gconstpointer user_data)
+{
+    GList *it;
+
+    f->tasks = spice_file_transfer_task_create_tasks(NULL,
+                                                     f->files,
+                                                     G_FILE_COPY_NONE,
+                                                     f->cancellable,
+                                                     transfer_flush_callback,
+                                                     NULL,
+                                                     transfer_done,
+                                                     f);
+    for (it = f->tasks; it != NULL; it = it->next) {
+        SpiceFileTransferTask *xfer_task = SPICE_FILE_TRANSFER_TASK(it->data);
+        g_signal_connect(xfer_task, "file-info", G_CALLBACK(transfer_task_on_file_info), f);
+        g_cancellable_cancel(f->cancellable);
+        spice_file_transfer_task_start_task(xfer_task);
+    }
+    g_main_loop_run (f->loop);
+}
+
 /* Tests summary:
  *
  * This tests are specific to SpiceFileTransferTask and how it handles the
@@ -182,9 +208,17 @@ int main(int argc, char* argv[])
                Fixture, GUINT_TO_POINTER(SINGLE_FILE),
                f_setup, test_simple_transfer, f_teardown);
 
+    g_test_add("/spice-file-transfer-task/single/cancel/on-start-task",
+               Fixture, GUINT_TO_POINTER(SINGLE_FILE),
+               f_setup, test_cancel_on_start_task, f_teardown);
+
     g_test_add("/spice-file-transfer-task/multiple/simple-transfer",
                Fixture, GUINT_TO_POINTER(MULTIPLE_FILES),
                f_setup, test_simple_transfer, f_teardown);
 
+    g_test_add("/spice-file-transfer-task/multiple/cancel/on-start-task",
+               Fixture, GUINT_TO_POINTER(MULTIPLE_FILES),
+               f_setup, test_cancel_on_start_task, f_teardown);
+
     return g_test_run();
 }
-- 
2.5.5

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]