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
This commit is contained in:
Marco Bonardo 2011-12-13 17:27:09 +01:00
parent 38cab04af0
commit 87dfc08a7a
2 changed files with 14 additions and 5 deletions

View File

@ -144,11 +144,7 @@ function endTest() {
.getMostRecentWindow("Download:Manager")
.close();
Cc["@mozilla.org/browser/nav-history-service;1"]
.getService(Ci.nsINavHistoryService)
.removeAllPages();
SimpleTest.finish();
waitForClearHistory(SimpleTest.finish);
}
]]>

View File

@ -168,3 +168,16 @@ function setCleanState()
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();
}