mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 897954: Add a test for purging caches. r=mak
Differential Revision: https://phabricator.services.mozilla.com/D105589
This commit is contained in:
parent
9f8f7cf96f
commit
d13e84ccdd
@ -0,0 +1,31 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
// Test whether purge-caches event works collectry when maintenance the places.
|
||||
|
||||
add_task(async function test_history() {
|
||||
await PlacesTestUtils.addVisits({ uri: "http://example.com/" });
|
||||
await assertPurgingCaches();
|
||||
});
|
||||
|
||||
add_task(async function test_bookmark() {
|
||||
await PlacesTestUtils.addBookmarkWithDetails({ uri: "http://example.com/" });
|
||||
await assertPurgingCaches();
|
||||
});
|
||||
|
||||
async function assertPurgingCaches() {
|
||||
const query = PlacesUtils.history.getNewQuery();
|
||||
const options = PlacesUtils.history.getNewQueryOptions();
|
||||
const result = PlacesUtils.history.executeQuery(query, options);
|
||||
result.root.containerOpen = true;
|
||||
|
||||
const onInvalidateContainer = new Promise(resolve => {
|
||||
const resultObserver = new NavHistoryResultObserver();
|
||||
resultObserver.invalidateContainer = resolve;
|
||||
result.addObserver(resultObserver, false);
|
||||
});
|
||||
|
||||
await PlacesDBUtils.maintenanceOnIdle();
|
||||
await onInvalidateContainer;
|
||||
ok(true, "InvalidateContainer is called");
|
||||
}
|
@ -12,6 +12,7 @@ support-files =
|
||||
[test_favicons_replaceOnStartup.js]
|
||||
[test_favicons_replaceOnStartup_clone.js]
|
||||
[test_integrity_replacement.js]
|
||||
[test_places_purge_caches.js]
|
||||
[test_places_replaceOnStartup.js]
|
||||
[test_places_replaceOnStartup_clone.js]
|
||||
[test_preventive_maintenance.js]
|
||||
|
Loading…
Reference in New Issue
Block a user