[evolution-data-server] Fixing test-ebook-get-supported-auth-methods.c



commit d4acf1569f05a395ca6a5a127065cb7fd2143835
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Tue Jan 22 17:36:28 2013 +0900

    Fixing test-ebook-get-supported-auth-methods.c
    
    This tests that unsupported code paths actually run as expected
    (the problem was that the async callback was called before entering
    the mainloop and waiting for a reply or timeout).

 .../test-ebook-get-supported-auth-methods.c        |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)
---
diff --git a/tests/libebook/test-ebook-get-supported-auth-methods.c b/tests/libebook/test-ebook-get-supported-auth-methods.c
index bfb8436..3f9c56c 100644
--- a/tests/libebook/test-ebook-get-supported-auth-methods.c
+++ b/tests/libebook/test-ebook-get-supported-auth-methods.c
@@ -6,6 +6,12 @@
 #include "ebook-test-utils.h"
 #include "e-test-server-utils.h"
 
+/* NOTE: This is an old test case testing unsupported old code paths.
+ *
+ * All this test case really does is ensure the callbacks are indeed
+ * called (with empty lists).
+ */
+
 static ETestServerClosure book_closure =
 	{ E_TEST_SERVER_DEPRECATED_ADDRESS_BOOK, NULL, 0 };
 
@@ -64,9 +70,8 @@ main_loop_fail_timeout (gpointer unused)
 	return FALSE;
 }
 
-static void
-test_get_supported_auth_methods_async (ETestServerFixture *fixture,
-                                       gconstpointer user_data)
+static gboolean
+get_supported_auth_methods_async_in_idle (ETestServerFixture *fixture)
 {
 	EBook *book;
 
@@ -75,6 +80,14 @@ test_get_supported_auth_methods_async (ETestServerFixture *fixture,
 	ebook_test_utils_book_async_get_supported_auth_methods (
 		book, (GSourceFunc) get_supported_auth_methods_cb, fixture->loop);
 
+	return FALSE;
+}
+
+static void
+test_get_supported_auth_methods_async (ETestServerFixture *fixture,
+                                       gconstpointer user_data)
+{
+	g_idle_add ((GSourceFunc)get_supported_auth_methods_async_in_idle, fixture);
 	g_timeout_add (5 * 1000, (GSourceFunc) main_loop_fail_timeout, NULL);
 	g_main_loop_run (fixture->loop);
 }



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