diff options
author | Debarshi Ray <debarshir@gnome.org> | 2017-09-19 18:55:27 +0200 |
---|---|---|
committer | Debarshi Ray <debarshir@gnome.org> | 2018-08-13 17:47:29 +0200 |
commit | cdd63d3a2f69f972348490018103fe62c880a590 (patch) | |
tree | 2d3b9df75942a7ad5b27c0b1fb82b02341f53f8a | |
parent | 346fe9aeddcdac6bb344c00ba56ea6295c453ba2 (diff) | |
download | libgdata-cdd63d3a2f69f972348490018103fe62c880a590.tar.gz |
tests: Make the cancellation tests work with GTask
https://bugzilla.gnome.org/show_bug.cgi?id=684920
-rw-r--r-- | 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 044851c3..d566b4c9 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 |