[libgdata/wip/rishi/drive: 11/11] tests: Make the cancellation tests work with GTask
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgdata/wip/rishi/drive: 11/11] tests: Make the cancellation tests work with GTask
- Date: Tue, 19 Sep 2017 16:57:17 +0000 (UTC)
commit f1007691cfae1481aedc256d1778d242ebb3131e
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Sep 19 18:55:27 2017 +0200
tests: Make the cancellation tests work with GTask
https://bugzilla.gnome.org/show_bug.cgi?id=684920
gdata/tests/documents.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gdata/tests/documents.c b/gdata/tests/documents.c
index 044851c..d566b4c 100644
--- a/gdata/tests/documents.c
+++ b/gdata/tests/documents.c
@@ -1416,6 +1416,24 @@ G_STMT_START {
g_object_unref (entry);
} else {
g_assert (entry == NULL);
+
+ /* Libgdata's cancellation sematics [1] don't match
+ * the default expectations of GTask. See:
+ * https://bugzilla.gnome.org/show_bug.cgi?id=786282
+ *
+ * The GDATA_ASYNC_* macros will continue running the
+ * cancellation test until the timeout is long enough
+ * to avoid a G_IO_ERROR_CANCELLED. However, GTask
+ * will always return an error regardless of whether
+ * the operation succeeded on the server or not.
+ *
+ * As a short-term workaround, we assume that a
+ * non-zero timeout is equivalent to late
+ * cancellation. Clearing the error tricks
+ * GDATA_ASYNC_* into terminating the test.
+ * [1] https://developer.gnome.org/gdata/unstable/gdata-overview.html#cancellable-support */
+ if (async_data->cancellation_timeout > 0)
+ g_clear_error (&error);
}
/* Since this code is called for the cancellation tests, we don't know exactly how many requests will
be made
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]