Bug 706280 - Intermittent failure in browser/components/places/tests/chrome/test_bug549192.xul | Exited with code 1 during test run.
authorMarco Bonardo <mbonardo@mozilla.com>
Tue, 13 Dec 2011 17:27:09 +0100
changeset 82501 355b40db0f9ac00b226b14a09706a13aa74f28a5
parent 82500 5ae946cbde555791ff3a2887d41290116a3f825b
child 82502 aa0bb5bb8931209b2ec25463364e9e5df8a4eccf
push id21632
push usermak77@bonardo.net
push dateTue, 13 Dec 2011 16:27:31 +0000
treeherdermozilla-central@355b40db0f9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs706280, 549192
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 706280 - Intermittent failure in browser/components/places/tests/chrome/test_bug549192.xul | Exited with code 1 during test run. r=felipe a=tests-only
toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul
toolkit/mozapps/downloads/tests/chrome/utils.js
--- a/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul
+++ b/toolkit/mozapps/downloads/tests/chrome/test_destinationURI_annotation.xul
@@ -139,21 +139,17 @@ function endTest() {
   PlacesUtils = null;
   dm = null;
 
   Cc["@mozilla.org/appshell/window-mediator;1"]
     .getService(Ci.nsIWindowMediator)
     .getMostRecentWindow("Download:Manager")
     .close();
 
-  Cc["@mozilla.org/browser/nav-history-service;1"]
-    .getService(Ci.nsINavHistoryService)
-    .removeAllPages();
-
-  SimpleTest.finish();
+  waitForClearHistory(SimpleTest.finish);
 }
 
   ]]>
   </script>
 
   <body xmlns="http://www.w3.org/1999/xhtml">
     <p id="display"></p>
     <div id="content" style="display:none;"></div>
--- a/toolkit/mozapps/downloads/tests/chrome/utils.js
+++ b/toolkit/mozapps/downloads/tests/chrome/utils.js
@@ -163,8 +163,21 @@ function setCleanState()
            getService(Ci.nsIDownloadManager);
 
   // Clean the dm
   dm.DBConnection.executeSimpleSQL("DELETE FROM moz_downloads");
 
   let win = getDMWindow();
   if (win) win.close();
 }
+
+/**
+ * Clears history invoking callback when done.
+ */
+function waitForClearHistory(aCallback) {
+  Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
+  Components.utils.import("resource://gre/modules/Services.jsm");
+  Services.obs.addObserver(function observeClearHistory(aSubject, aTopic) {
+    Services.obs.removeObserver(observeClearHistory, aTopic);
+    aCallback();
+  }, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
+  PlacesUtils.bhistory.removeAllPages();
+}