Bug 1365139 - Reduce the amount of iterations for test_removeMany.js so that it takes less time overall to avoid timeouts. r?mak
MozReview-Commit-ID: DSjPWtjicCQ
--- a/toolkit/components/places/tests/history/test_removeMany.js
+++ b/toolkit/components/places/tests/history/test_removeMany.js
@@ -3,18 +3,18 @@
// Tests for `History.remove` with removing many urls, as implemented in
// History.jsm.
"use strict";
// Test removing a list of pages
add_task(async function test_remove_many() {
- // This is set so that we are guarenteed to trigger REMOVE_PAGES_CHUNKLEN.
- const SIZE = 1000;
+ // This is set so that we are guaranteed to trigger REMOVE_PAGES_CHUNKLEN.
+ const SIZE = 310;
await PlacesTestUtils.clearHistory();
await PlacesUtils.bookmarks.eraseEverything();
do_print("Adding a witness page");
let WITNESS_URI = NetUtil.newURI("http://mozilla.com/test_browserhistory/test_remove/" + Math.random());
await PlacesTestUtils.addVisits(WITNESS_URI);
Assert.ok(page_in_database(WITNESS_URI), "Witness page added");
@@ -126,18 +126,17 @@ add_task(async function test_remove_many
Assert.ok(removed, "Something was removed");
PlacesUtils.history.removeObserver(observer);
do_print("Checking out results");
// By now the observers should have been called.
for (let i = 0; i < pages.length; ++i) {
let page = pages[i];
- do_print("Page: " + i);
- Assert.ok(page.onResultCalled, "We have reached the page from the callback");
+ Assert.ok(page.onResultCalled, `We have reached the page #${i} from the callback`);
Assert.ok(visits_in_database(page.uri) == 0, "History entry has disappeared");
Assert.equal(page_in_database(page.uri) != 0, page.hasBookmark, "Page is present only if it also has bookmarks");
Assert.equal(page.onFrecencyChangedCalled, page.onDeleteVisitsCalled, "onDeleteVisits was called iff onFrecencyChanged was called");
Assert.ok(page.onFrecencyChangedCalled ^ page.onDeleteURICalled, "Either onFrecencyChanged or onDeleteURI was called");
}
Assert.notEqual(visits_in_database(WITNESS_URI), 0, "Witness URI still has visits");
Assert.notEqual(page_in_database(WITNESS_URI), 0, "Witness URI is still here");