[evolution-data-server/openismus-work-master: 10/10] test-client-view-operations.c: Use sync open call



commit 4259cc7a2add9d7b29b169ae6a81ce706615dc77
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Fri Feb 1 22:22:29 2013 +0900

    test-client-view-operations.c: Use sync open call
    
    This is to help tiptoe around issues with async calls in master, trying
    to limit the possibilities for direct access to fail.

 .../libebook/client/test-client-view-operations.c  |   23 ++++---------------
 1 files changed, 5 insertions(+), 18 deletions(-)
---
diff --git a/tests/libebook/client/test-client-view-operations.c b/tests/libebook/client/test-client-view-operations.c
index cd3b1dd..0b8fc7a 100644
--- a/tests/libebook/client/test-client-view-operations.c
+++ b/tests/libebook/client/test-client-view-operations.c
@@ -10,7 +10,7 @@
 
 static ETestServerClosure book_closure = { E_TEST_SERVER_ADDRESS_BOOK, NULL, 0 };
 
-#define N_THREADS  20
+#define N_THREADS  5
 #define N_CONTACTS 5
 
 typedef struct {
@@ -85,6 +85,9 @@ start_view (ThreadData *data)
 	gchar        *sexp;
 	GError *error = NULL;
 
+	if (!e_client_open_sync (E_CLIENT (data->client), TRUE, NULL, &error))
+		g_error ("Error opening the client: %s", error->message);
+
 	query = e_book_query_any_field_contains ("");
 	sexp = e_book_query_to_string (query);
 
@@ -105,8 +108,6 @@ start_view (ThreadData *data)
 	if (error)
 		g_error ("start view: %s", error->message);
 
-	g_message ("Book View Started !\n");
-
 	e_book_query_unref (query);
 	g_free (sexp);
 
@@ -138,20 +139,6 @@ finish_thread_test (ThreadData *data)
 	g_slice_free (ThreadData, data);
 }
 
-static void
-client_ready (GObject *source_object,
-	      GAsyncResult *res,
-	      ThreadData *data)
-{
-	GError *error = NULL;
-
-	if (!e_client_open_finish (E_CLIENT (source_object), res, &error))
-		g_error ("Error opening client: %s",
-			 error->message);
-
-	start_thread_test (data);
-}
-
 static gpointer
 test_view_thread (ThreadData *data)
 {
@@ -181,7 +168,7 @@ test_view_thread (ThreadData *data)
 	if (!data->client)
 		g_error ("Unable to create EBookClient for uid '%s': %s", data->book_uid, error->message);
 
-	e_client_open (E_CLIENT (data->client), TRUE, NULL, (GAsyncReadyCallback)client_ready, data);
+	start_thread_test (data);
 
 	g_main_loop_run (data->loop);
 



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