[Spice-devel] [spice-gtk v3 12/16] tests: file-transfer cancel on task start
Victor Toso
victortoso at redhat.com
Mon May 30 09:55:08 UTC 2016
---
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
More information about the Spice-devel
mailing list