Bug 1113178 - Replace removeAllPages() in toolkit/components/places/ r=mak

--HG--
rename : toolkit/components/places/tests/expiration/test_removeAllPages.js => toolkit/components/places/tests/expiration/test_clearHistory.js
rename : toolkit/components/places/tests/unit/test_history_removeAllPages.js => toolkit/components/places/tests/unit/test_history_clear.js
This commit is contained in:
Tim Taubert 2015-01-17 19:31:32 +01:00
parent f70ecd3b40
commit 345359ed79
44 changed files with 112 additions and 165 deletions

View File

@ -27,7 +27,7 @@ add_task(function () {
});
});
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
// Ensure we wait for the default bookmarks import.
let bookmarksDeferred = Promise.defer();

View File

@ -47,7 +47,7 @@ function test() {
is(historyObserver.visitCount[aURI], 1,
"onVisit has been received right number of times for " + aURI);
}
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
}
var loadCount = 0;

View File

@ -98,7 +98,7 @@ function reloadListener() {
function reloadAsyncListener(aURI, aIsVisited) {
ok(kUniqueURI.equals(aURI) && aIsVisited, "We have visited the URI.");
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
}
registerCleanupFunction(function() {

View File

@ -26,7 +26,7 @@ function test() {
is(aHidden, 0, "Page should not be hidden");
fieldForUrl(aURI, "typed", function (aTyped) {
is(aTyped, 0, "page should not be marked as typed");
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
});
});
});

View File

@ -43,7 +43,7 @@ function test() {
fieldForUrl(TARGET_URI, "hidden", function (aHidden) {
is(aHidden, 0, "The target page should not be hidden");
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
});
});
});

View File

@ -8,7 +8,7 @@ gBrowser.selectedTab = gBrowser.addTab();
function finishAndCleanUp()
{
gBrowser.removeCurrentTab();
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
}
/**

View File

@ -41,7 +41,7 @@ function continueTest(aOldFrecency) {
is(aHidden, 0, "Page should not be hidden");
fieldForUrl(aURI, "typed", function (aTyped) {
is(aTyped, 0, "page should not be marked as typed");
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
});
});
});

View File

@ -8,7 +8,7 @@ gBrowser.selectedTab = gBrowser.addTab();
function finishAndCleanUp()
{
gBrowser.removeCurrentTab();
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
}
/**

View File

@ -50,7 +50,7 @@ function test()
if (uri.spec != FINAL_URL)
return;
gBrowser.removeCurrentTab();
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
});
Services.prefs.setBoolPref("places.history.enabled", false);

View File

@ -76,7 +76,7 @@ function test() {
// then test when not on private mode
testOnWindow({}, function(aWin) {
doTest(false, aWin, finalURL, function () {
promiseClearHistory().then(finish);
PlacesTestUtils.clearHistory().then(finish);
});
});
});

View File

@ -11,47 +11,13 @@ const TRANSITION_DOWNLOAD = Ci.nsINavHistoryService.TRANSITION_DOWNLOAD;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
/**
* Allows waiting for an observer notification once.
*
* @param aTopic
* Notification topic to observe.
*
* @return {Promise}
* @resolves The array [aSubject, aData] from the observed notification.
* @rejects Never.
*/
function promiseTopicObserved(aTopic)
{
let deferred = Promise.defer();
Services.obs.addObserver(
function PTO_observe(aSubject, aTopic, aData) {
Services.obs.removeObserver(PTO_observe, aTopic);
deferred.resolve([aSubject, aData]);
}, aTopic, false);
return deferred.promise;
}
/**
* Clears history asynchronously.
*
* @return {Promise}
* @resolves When history has been cleared.
* @rejects Never.
*/
function promiseClearHistory() {
let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
PlacesUtils.bhistory.removeAllPages();
return promise;
}
/**
* Waits for all pending async statements on the default connection.
*

View File

@ -7,7 +7,7 @@
/**
* What this is aimed to test:
*
* bh.removeAllPages should expire everything but bookmarked pages and valid
* History.clear() should expire everything but bookmarked pages and valid
* annos.
*/
@ -82,7 +82,7 @@ function run_test() {
run_next_test();
}
add_task(function test_removeAllPages() {
add_task(function test_historyClear() {
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
@ -125,13 +125,8 @@ add_task(function test_removeAllPages() {
add_old_anno(pageURI, "expire_months", "test", as.EXPIRE_MONTHS, 181);
}
// Expire all visits for the bookmarks. This does the same thing as the
// promiseClearHistory helper, but it is made explicit here because
// removeAllPages is the function we are testing.
let promise =
promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
yield promise;
// Expire all visits for the bookmarks
yield PlacesUtils.history.clear();
["expire_days", "expire_weeks", "expire_months", "expire_session",
"expire"].forEach(function(aAnno) {

View File

@ -32,7 +32,7 @@ add_task(function test_expire_orphans()
do_check_false(page_in_database("http://page3.mozilla.org/"));
// Clean up.
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_expire_orphans_optionalarg()
@ -57,7 +57,7 @@ add_task(function test_expire_orphans_optionalarg()
do_check_false(page_in_database("http://page3.mozilla.org/"));
// Clean up.
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_expire_limited()
@ -77,7 +77,7 @@ add_task(function test_expire_limited()
do_check_eq(visits_in_database("http://page2.mozilla.org/"), 1);
// Clean up.
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_expire_unlimited()
@ -97,7 +97,7 @@ add_task(function test_expire_unlimited()
do_check_false(page_in_database("http://page2.mozilla.org/"));
// Clean up.
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
function run_test()

View File

@ -12,8 +12,6 @@
let os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
let hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
let gObserver = {
notifications: 0,
@ -27,7 +25,7 @@ function run_test() {
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
hs.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
PlacesTestUtils.clearHistory();
do_timeout(2000, check_result);
do_test_pending();

View File

@ -104,10 +104,10 @@ add_task(function test_notifications_onDeleteURI() {
// Clean up.
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
}
clearMaxPages();
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});

View File

@ -126,10 +126,10 @@ add_task(function test_notifications_onDeleteVisits() {
// Clean up.
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
}
clearMaxPages();
bs.removeFolderChildren(bs.unfiledBookmarksFolder);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});

View File

@ -116,9 +116,9 @@ add_task(function test_pref_maxpages() {
currentTest.expectedNotifications);
// Clean up.
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
}
clearMaxPages();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});

View File

@ -10,6 +10,7 @@ skip-if = os == "android"
[test_annos_expire_never.js]
[test_annos_expire_policy.js]
[test_annos_expire_session.js]
[test_clearHistory.js]
[test_debug_expiration.js]
[test_idle_daily.js]
[test_notifications.js]
@ -20,4 +21,3 @@ skip-if = os == "android"
# Crashes when timer is used on non-main thread due to JS implemetation in this test
skip-if = "JS implementation of nsITimer"
[test_pref_maxpages.js]
[test_removeAllPages.js]

View File

@ -83,7 +83,7 @@ add_task(function test_replaceFaviconData_validHistoryURI() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_overrideDefaultFavicon() {
@ -115,7 +115,7 @@ add_task(function test_replaceFaviconData_overrideDefaultFavicon() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_replaceExisting() {
@ -152,7 +152,7 @@ add_task(function test_replaceFaviconData_replaceExisting() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_unrelatedReplace() {
@ -184,7 +184,7 @@ add_task(function test_replaceFaviconData_unrelatedReplace() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_badInputs() {
@ -224,7 +224,7 @@ add_task(function test_replaceFaviconData_badInputs() {
favicon.file.remove(false);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconData_twiceReplace() {
@ -259,5 +259,5 @@ add_task(function test_replaceFaviconData_twiceReplace() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});

View File

@ -85,7 +85,7 @@ add_task(function test_replaceFaviconDataFromDataURL_validHistoryURI() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
@ -115,7 +115,7 @@ add_task(function test_replaceFaviconDataFromDataURL_overrideDefaultFavicon() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() {
@ -148,7 +148,7 @@ add_task(function test_replaceFaviconDataFromDataURL_replaceExisting() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
@ -178,7 +178,7 @@ add_task(function test_replaceFaviconDataFromDataURL_unrelatedReplace() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_badInputs() {
@ -206,7 +206,7 @@ add_task(function test_replaceFaviconDataFromDataURL_badInputs() {
favicon.file.remove(false);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() {
@ -237,7 +237,7 @@ add_task(function test_replaceFaviconDataFromDataURL_twiceReplace() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
@ -270,7 +270,7 @@ add_task(function test_replaceFaviconDataFromDataURL_afterRegularAssign() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
@ -303,7 +303,7 @@ add_task(function test_replaceFaviconDataFromDataURL_beforeRegularAssign() {
});
yield deferSetAndFetchFavicon.promise;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
/* toBase64 copied from image/test/unit/test_encoder_png.js */

View File

@ -40,6 +40,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
"resource://gre/modules/BookmarkHTMLUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesBackups",
"resource://gre/modules/PlacesBackups.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTestUtils",
"resource://testing-common/PlacesTestUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesTransactions",
"resource://gre/modules/PlacesTransactions.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS",
@ -388,20 +390,6 @@ function promiseTopicObserved(aTopic)
return deferred.promise;
}
/**
* Clears history asynchronously.
*
* @return {Promise}
* @resolves When history has been cleared.
* @rejects Never.
*/
function promiseClearHistory() {
let promise = promiseTopicObserved(PlacesUtils.TOPIC_EXPIRATION_FINISHED);
do_execute_soon(function() PlacesUtils.bhistory.removeAllPages());
return promise;
}
/**
* Simulates a Places shutdown.
*/

View File

@ -130,7 +130,7 @@ add_task(function* test_remove_single() {
}
}
} finally {
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
}
return;
});
@ -268,7 +268,7 @@ add_task(function* test_remove_many() {
Assert.notEqual(page_in_database(WITNESS_URI), 0, "Witness URI is still here");
do_print("Cleaning up");
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});

View File

@ -181,7 +181,7 @@ function add_autocomplete_test(aTestData) {
function waitForCleanup(aCallback) {
remove_all_bookmarks();
promiseClearHistory().then(aCallback);
PlacesTestUtils.clearHistory().then(aCallback);
}
function addBookmark(aBookmarkObj) {

View File

@ -68,7 +68,7 @@ add_task(function pages_query()
}
root.containerOpen = false;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function visits_query()
@ -95,7 +95,7 @@ add_task(function visits_query()
}
root.containerOpen = false;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function pages_searchterm_query()
@ -119,7 +119,7 @@ add_task(function pages_searchterm_query()
}
root.containerOpen = false;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function visits_searchterm_query()
@ -146,7 +146,7 @@ add_task(function visits_searchterm_query()
}
root.containerOpen = false;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function pages_searchterm_is_title_query()
@ -170,7 +170,7 @@ add_task(function pages_searchterm_is_title_query()
});
root.containerOpen = false;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function visits_searchterm_is_title_query()
@ -195,5 +195,5 @@ add_task(function visits_searchterm_is_title_query()
});
root.containerOpen = false;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});

View File

@ -300,5 +300,5 @@ add_task(function test_redirects()
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});

View File

@ -1272,6 +1272,6 @@ add_task(function test_sorting()
test.check_reverse();
// Execute cleanup tasks
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
}
});

View File

@ -577,7 +577,7 @@ function addBookmark(aURI) {
*/
function task_cleanDatabase(aCallback) {
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
}
/**

View File

@ -32,7 +32,7 @@ function* cleanup() {
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
}
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
}
do_register_cleanup(cleanup);

View File

@ -45,7 +45,7 @@ add_task(function test_execute()
// get charset from bookmarked page
do_check_eq((yield PlacesUtils.getCharsetForURI(TEST_BOOKMARKED_URI)), charset);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
// ensure that charset has gone for not-bookmarked page
do_check_neq((yield PlacesUtils.getCharsetForURI(TEST_URI)), charset);

View File

@ -34,7 +34,7 @@ add_task(function changeuri_unvisited_bookmark()
do_check_eq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function changeuri_visited_bookmark()
@ -64,7 +64,7 @@ add_task(function changeuri_visited_bookmark()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function changeuri_bookmark_still_bookmarked()
@ -95,7 +95,7 @@ add_task(function changeuri_bookmark_still_bookmarked()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function changeuri_nonexistent_bookmark()
@ -127,7 +127,7 @@ add_task(function changeuri_nonexistent_bookmark()
tryChange(id);
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
///////////////////////////////////////////////////////////////////////////////

View File

@ -373,7 +373,7 @@ add_task(function test_adaptive()
Services.prefs.clearUserPref("browser.urlbar.suggest." + type);
}
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
deferEnsureResults = Promise.defer();
yield test();

View File

@ -89,7 +89,7 @@ function run_next_test() {
}
let test = tests.shift();
promiseClearHistory().then(function() {
PlacesTestUtils.clearHistory().then(function() {
remove_all_bookmarks();
do_execute_soon(test);
});

View File

@ -56,7 +56,7 @@ add_task(function* test_removePages() {
// Cleanup.
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function* test_removePagesByTimeframe() {
@ -97,8 +97,8 @@ add_task(function* test_removePagesFromHost_keepSubdomains() {
do_check_eq(1, PlacesUtils.history.hasHistoryEntries);
});
add_task(function* test_removeAllPages() {
PlacesUtils.bhistory.removeAllPages();
add_task(function* test_history_clear() {
yield PlacesTestUtils.clearHistory();
do_check_eq(0, PlacesUtils.history.hasHistoryEntries);
});

View File

@ -111,7 +111,7 @@ add_test(function test_dh_addMultiRemoveDownload()
do_check_true(aURI.equals(DOWNLOAD_URI));
do_check_true(!!page_in_database(DOWNLOAD_URI));
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
gDownloadHistory.removeAllDownloads();
});
@ -134,7 +134,7 @@ add_test(function test_dh_addBookmarkRemoveDownload()
do_check_true(aURI.equals(DOWNLOAD_URI));
do_check_true(!!page_in_database(DOWNLOAD_URI));
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
gDownloadHistory.removeAllDownloads();
});
@ -156,7 +156,7 @@ add_test(function test_dh_addDownload_referrer()
// Verify that the URI is already available in results at this time.
do_check_true(!!page_in_database(DOWNLOAD_URI));
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
gDownloadHistory.addDownload(DOWNLOAD_URI, REFERRER_URI, Date.now() * 1000);
@ -185,7 +185,7 @@ add_test(function test_dh_addDownload_disabledHistory()
do_check_true(!!page_in_database(DOWNLOAD_URI));
do_check_false(!!page_in_database(PRIVATE_URI));
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
Services.prefs.setBoolPref("places.history.enabled", false);
@ -221,7 +221,7 @@ add_test(function test_dh_details()
PlacesUtils.annotations.removeObserver(annoObserver);
PlacesUtils.history.removeObserver(historyObserver);
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
}
};

View File

@ -287,7 +287,7 @@ add_task(function test_frecency()
prefs.setBoolPref("browser.urlbar.suggest.openpage", false);
for (let [, test] in Iterator(tests)) {
remove_all_bookmarks();
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
deferEnsureResults = Promise.defer();
yield test();

View File

@ -44,8 +44,7 @@ add_task(function test_nsNavHistory_invalidateFrecencies_somePages() {
// nsNavHistory::invalidateFrecencies for all pages
add_task(function test_nsNavHistory_invalidateFrecencies_allPages() {
PlacesUtils.history.removeAllPages();
yield onManyFrecenciesChanged();
yield Promise.all([onManyFrecenciesChanged(), PlacesTestUtils.clearHistory()]);
});
// nsNavHistory::DecayFrecency and nsNavHistory::FixInvalidFrecencies

View File

@ -46,7 +46,7 @@ function run_test() {
run_next_test();
}
add_task(function test_history_removeAllPages()
add_task(function* test_history_clear()
{
yield promiseInit;
@ -95,7 +95,7 @@ add_task(function test_history_removeAllPages()
// Clear history and wait for the onClearHistory notification.
let promiseWaitClearHistory = promiseOnClearHistoryObserved();
PlacesUtils.bhistory.removeAllPages();
PlacesUtils.history.clear();
yield promiseWaitClearHistory;
// check browserHistory returns no entries

View File

@ -91,7 +91,7 @@ add_task(function test_remove_places()
PlacesUtils.history.removePage(urls[idx].uri);
}
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
for (let idx in urls) {
do_check_false(isHostInMozHosts(urls[idx].uri, urls[idx].typed, urls[idx].prefix));
@ -112,7 +112,7 @@ add_task(function test_bookmark_changes()
// Change the hostname
PlacesUtils.bookmarks.changeBookmarkURI(itemId, NetUtil.newURI(NEW_URL));
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
let newUri = NetUtil.newURI(NEW_URL);
do_check_true(isHostInMozPlaces(newUri));
@ -126,7 +126,7 @@ add_task(function test_bookmark_removal()
PlacesUtils.bookmarks.DEFAULT_INDEX);
let newUri = NetUtil.newURI(NEW_URL);
PlacesUtils.bookmarks.removeItem(itemId);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
do_check_false(isHostInMozHosts(newUri, false, null));
});
@ -145,7 +145,7 @@ add_task(function test_moz_hosts_typed_update()
yield promiseAddVisits(places);
do_check_true(isHostInMozHosts(TEST_URI, true, null));
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_moz_hosts_www_remove()
@ -175,7 +175,7 @@ add_task(function test_moz_hosts_www_remove()
const TEST_WWW_URI = NetUtil.newURI("http://www.rem.mozilla.com");
yield test_removal(TEST_URI, TEST_WWW_URI);
yield test_removal(TEST_WWW_URI, TEST_URI);
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_moz_hosts_ftp_matchall()

View File

@ -70,7 +70,7 @@ function step()
let checker = SCHEMES[scheme] ? do_check_true : do_check_false;
checker(aIsVisited);
promiseClearHistory().then(function () {
PlacesTestUtils.clearHistory().then(function () {
history.isURIVisited(uri, function(aURI, aIsVisited) {
do_check_true(uri.equals(aURI));
do_check_false(aIsVisited);

View File

@ -129,29 +129,30 @@ add_test(function check_history_query() {
do_check_eq(resultObserver.invalidatedContainer, result.root);
// nsINavHistoryResultObserver.invalidateContainer
bhist.removeAllPages();
do_check_eq(root.uri, resultObserver.invalidatedContainer.uri);
PlacesTestUtils.clearHistoryEnabled().then(() => {
do_check_eq(root.uri, resultObserver.invalidatedContainer.uri);
// nsINavHistoryResultObserver.batching
do_check_false(resultObserver.inBatchMode);
histsvc.runInBatchMode({
runBatched: function (aUserData) {
do_check_true(resultObserver.inBatchMode);
}
}, null);
do_check_false(resultObserver.inBatchMode);
bmsvc.runInBatchMode({
runBatched: function (aUserData) {
do_check_true(resultObserver.inBatchMode);
}
}, null);
do_check_false(resultObserver.inBatchMode);
// nsINavHistoryResultObserver.batching
do_check_false(resultObserver.inBatchMode);
histsvc.runInBatchMode({
runBatched: function (aUserData) {
do_check_true(resultObserver.inBatchMode);
}
}, null);
do_check_false(resultObserver.inBatchMode);
bmsvc.runInBatchMode({
runBatched: function (aUserData) {
do_check_true(resultObserver.inBatchMode);
}
}, null);
do_check_false(resultObserver.inBatchMode);
root.containerOpen = false;
do_check_eq(resultObserver.closedContainer, resultObserver.openedContainer);
result.removeObserver(resultObserver);
resultObserver.reset();
promiseAsyncUpdates().then(run_next_test);
root.containerOpen = false;
do_check_eq(resultObserver.closedContainer, resultObserver.openedContainer);
result.removeObserver(resultObserver);
resultObserver.reset();
promiseAsyncUpdates().then(run_next_test);
});
});
});
});

View File

@ -106,7 +106,7 @@ add_task(function test_addVisitAndCheckGuid() {
do_check_eq(root.getChild(0).bookmarkGuid, "");
root.containerOpen = false;
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
});
add_task(function test_addItemsWithInvalidGUIDsFails() {

View File

@ -9,7 +9,7 @@ const TEST_URI = uri("http://example.com/");
const PLACE_URI = uri("place:queryType=0&sort=8&maxResults=10");
function* cleanup() {
yield promiseClearHistory();
yield PlacesTestUtils.clearHistory();
remove_all_bookmarks();
// This is needed to remove place: entries.
DBConn().executeSimpleSQL("DELETE FROM moz_places");

View File

@ -34,7 +34,7 @@ add_test(function removed_bookmark()
do_check_eq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
@ -62,7 +62,7 @@ add_test(function removed_but_visited_bookmark()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
@ -94,7 +94,7 @@ add_test(function remove_bookmark_still_bookmarked()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
@ -122,7 +122,7 @@ add_test(function cleared_parent_of_visited_bookmark()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});
@ -156,7 +156,7 @@ add_test(function cleared_parent_of_bookmark_still_bookmarked()
do_check_neq(frecencyForUrl(TEST_URI), 0);
remove_all_bookmarks();
promiseClearHistory().then(run_next_test);
PlacesTestUtils.clearHistory().then(run_next_test);
});
});
});

View File

@ -95,9 +95,9 @@ skip-if = os == "android"
[test_history.js]
[test_history_autocomplete_tags.js]
[test_history_catobs.js]
[test_history_clear.js]
[test_history_notifications.js]
[test_history_observer.js]
[test_history_removeAllPages.js]
# Bug 676989: test hangs consistently on Android
skip-if = os == "android"
[test_history_sidebar.js]