[libgdata/offline-testing] fixup! tests: General support for mock server traces in async tests



commit 125f3f1054ef9562e28bc5d74bd565058e1baacc
Author: Philip Withnall <philip tecnocode co uk>
Date:   Wed Jul 31 09:07:51 2013 +0200

    fixup! tests: General support for mock server traces in async tests

 gdata/tests/common.h |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/gdata/tests/common.h b/gdata/tests/common.h
index fd2b267..122608b 100644
--- a/gdata/tests/common.h
+++ b/gdata/tests/common.h
@@ -241,8 +241,6 @@ test_##TEST_NAME##_async_cancellation (GDataAsyncTestData *async_data, gconstpoi
 { \
        async_data->cancellation_timeout = 0; \
  \
-       gdata_test_mock_server_start_trace (mock_server, G_STRINGIFY (TEST_NAME) "-async-cancellation"); \
- \
        /* Starting with a short timeout, repeatedly run the async. operation, cancelling it after the 
timeout and increasing the timeout until
         * the operation succeeds for the first time. We then finish the test. This guarantees that if, for 
example, the test creates an entry on
         * the server, it only ever creates one; because the test only ever succeeds once. (Of course, this 
assumes that the server does not change
@@ -252,6 +250,8 @@ test_##TEST_NAME##_async_cancellation (GDataAsyncTestData *async_data, gconstpoi
                GAsyncReadyCallback async_ready_callback = (GAsyncReadyCallback) test_##TEST_NAME##_async_cb; 
\
                TestStructType *data = (TestStructType*) async_data->test_data; \
  \
+               gdata_test_mock_server_start_trace (mock_server, G_STRINGIFY (TEST_NAME) 
"-async-cancellation"); \
+ \
                (void) data; /* hide potential unused variable warning */ \
  \
                /* Ensure the timeout remains sane. */ \
@@ -285,14 +285,14 @@ test_##TEST_NAME##_async_cancellation (GDataAsyncTestData *async_data, gconstpoi
                } else { \
                        async_data->cancellation_timeout *= GDATA_ASYNC_TIMEOUT_MULTIPLIER; \
                } \
+ \
+               gdata_mock_server_end_trace (mock_server); \
        } while (async_data->cancellation_successful == TRUE); \
  \
        /* Clean up the last timeout callback */ \
        if (async_data->cancellation_timeout_id != 0) { \
                g_source_remove (async_data->cancellation_timeout_id); \
        } \
- \
-       gdata_mock_server_end_trace (mock_server); \
 }
 
 gboolean gdata_async_test_cancellation_cb (GDataAsyncTestData *async_data);


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