[tracker/rss-enclosures] functional-tests: Do not use nested mainloop in libtracker-sparql tests



commit 2244378443d4713e6ff0bfd403b950c7973c7fa6
Author: Jürg Billeter <j bitron ch>
Date:   Fri Oct 22 14:18:56 2010 +0200

    functional-tests: Do not use nested mainloop in libtracker-sparql tests

 .../functional-tests/ipc/test-default-update.vala  |   19 +++++++++----------
 tests/functional-tests/ipc/test-direct-query.vala  |   18 +++++++++---------
 2 files changed, 18 insertions(+), 19 deletions(-)
---
diff --git a/tests/functional-tests/ipc/test-default-update.vala b/tests/functional-tests/ipc/test-default-update.vala
index 3f7424d..c7fd137 100644
--- a/tests/functional-tests/ipc/test-default-update.vala
+++ b/tests/functional-tests/ipc/test-default-update.vala
@@ -3,16 +3,18 @@ using Tracker.Sparql;
 private static int res;
 private static MainLoop loop;
 
-private async void test_async () {
-	// Quite this loo because we start another one in app.run ()
-	loop.quit ();
-
+private void test_async () {
 	try {
-		Connection c;
+		Connection c = null;
 
 		// Test async
 		print ("Getting connection async\n");
-		c = yield Connection.get_async ();
+		loop = new MainLoop (null, false);
+		Connection.get_async.begin (null, (o, res) => {
+			c = Connection.get_async.end (res);
+			loop.quit ();
+		});
+		loop.run ();
 
 		print ("Got it %p\n", c);
 
@@ -58,7 +60,6 @@ int
 main( string[] args )
 {
 	print ("Starting...\n");
-	loop = new MainLoop (null, false);
 
 	test_sync ();
 
@@ -67,9 +68,7 @@ main( string[] args )
 	}
 
 	// Do async second
-	test_async.begin ();
-
-	loop.run ();
+	test_async ();
 
 	return res;
 }
diff --git a/tests/functional-tests/ipc/test-direct-query.vala b/tests/functional-tests/ipc/test-direct-query.vala
index a322a4a..4c87cf7 100644
--- a/tests/functional-tests/ipc/test-direct-query.vala
+++ b/tests/functional-tests/ipc/test-direct-query.vala
@@ -4,16 +4,18 @@ using Tracker.Sparql;
 private static int res;
 private static MainLoop loop;
 
-private async void test_async () {
-	// Quite this loo because we start another one in app.run ()
-	loop.quit ();
-
+private void test_async () {
 	try {
-		Connection c;
+		Connection c = null;
 
 		// Test async
 		print ("Getting connection asynchronously\n");
-		c = yield Connection.get_async ();
+		loop = new MainLoop (null, false);
+		Connection.get_async.begin (null, (o, res) => {
+			c = Connection.get_async.end (res);
+			loop.quit ();
+		});
+		loop.run ();
 
 		print ("Got it %p\n", c);
 
@@ -59,7 +61,6 @@ int
 main( string[] args )
 {
 	print ("Starting...\n");
-	loop = new MainLoop (null, false);
 
 	test_sync ();
 
@@ -67,8 +68,7 @@ main( string[] args )
 		return res;
 	}
 
-	test_async.begin ();
-	loop.run ();
+	test_async ();
 
 	return res;
 }



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