Bug 614224 (followup) - further subtests in test_removeVisitsByTimeframe.js should wait for visits addition.
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 29 Nov 2010 15:41:08 +0100
changeset 59360 c3fb803da905fc510cfa709d90141f6621d81a77
parent 59359 1818e5fee66a69b94a6874e058db868407732957
child 59361 9d659e8d218d72158a46f2efce04a2cbcdb91f78
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
bugs614224
milestone2.0b8pre
Bug 614224 (followup) - further subtests in test_removeVisitsByTimeframe.js should wait for visits addition. a=tests-only
toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js
--- a/toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js
+++ b/toolkit/components/places/tests/unit/test_removeVisitsByTimeframe.js
@@ -260,17 +260,19 @@ var gTests = [
       for (let i = 0; i < 10; i++) {
         histsvc.addVisit(TEST_URI,
                          NOW - i,
                          null,
                          histsvc.TRANSITION_TYPED,
                          false,
                          0);
       }
-
+      waitForAsyncUpdates(this.continue_run, this);
+    },
+    continue_run: function () {
       print("Remove all visits.");
       histsvc.QueryInterface(Ci.nsIBrowserHistory).
         removeVisitsByTimeframe(NOW - 10, NOW);
 
       print("URI should no longer exist in moz_places.");
       do_check_false(page_in_database(TEST_URL));
 
       print("Run a history query and check that no visits exist.");
@@ -297,17 +299,19 @@ var gTests = [
       for (let i = 0; i < 10; i++) {
         histsvc.addVisit(PLACE_URI,
                          NOW - i,
                          null,
                          histsvc.TRANSITION_TYPED,
                          false,
                          0);
       }
-
+      waitForAsyncUpdates(this.continue_run, this);
+    },
+    continue_run: function () {
       print("Remove all visits.");
       histsvc.QueryInterface(Ci.nsIBrowserHistory).
         removeVisitsByTimeframe(NOW - 10, NOW);
 
       print("URI should still exist in moz_places.");
       do_check_true(page_in_database(PLACE_URL));
 
       print("Run a history query and check that no visits exist.");
@@ -345,17 +349,19 @@ var gTests = [
                          0);
       }
 
       print("Bookmark the URI.");
       bmsvc.insertBookmark(bmsvc.unfiledBookmarksFolder,
                            TEST_URI,
                            bmsvc.DEFAULT_INDEX,
                            "bookmark title");
-
+      waitForAsyncUpdates(this.continue_run, this);
+    },
+    continue_run: function () {
       print("Remove all visits.");
       histsvc.QueryInterface(Ci.nsIBrowserHistory).
         removeVisitsByTimeframe(NOW - 10, NOW);
 
       print("URI should still exist in moz_places.");
       do_check_true(page_in_database(TEST_URL));
 
       print("Run a history query and check that no visits exist.");