mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
3ee0f44360
--HG-- rename : toolkit/components/places/tests/unit/expected-favicon-big16.ico.png => toolkit/components/places/tests/favicons/expected-favicon-big16.ico.png rename : toolkit/components/places/tests/unit/expected-favicon-big32.jpg.png => toolkit/components/places/tests/favicons/expected-favicon-big32.jpg.png rename : toolkit/components/places/tests/unit/expected-favicon-big4.jpg.png => toolkit/components/places/tests/favicons/expected-favicon-big4.jpg.png rename : toolkit/components/places/tests/unit/expected-favicon-big48.ico.png => toolkit/components/places/tests/favicons/expected-favicon-big48.ico.png rename : toolkit/components/places/tests/unit/expected-favicon-big64.png.png => toolkit/components/places/tests/favicons/expected-favicon-big64.png.png rename : toolkit/components/places/tests/unit/expected-favicon-scale160x3.jpg.png => toolkit/components/places/tests/favicons/expected-favicon-scale160x3.jpg.png rename : toolkit/components/places/tests/unit/expected-favicon-scale3x160.jpg.png => toolkit/components/places/tests/favicons/expected-favicon-scale3x160.jpg.png rename : toolkit/components/places/tests/unit/favicon-big16.ico => toolkit/components/places/tests/favicons/favicon-big16.ico rename : toolkit/components/places/tests/unit/favicon-big32.jpg => toolkit/components/places/tests/favicons/favicon-big32.jpg rename : toolkit/components/places/tests/unit/favicon-big4.jpg => toolkit/components/places/tests/favicons/favicon-big4.jpg rename : toolkit/components/places/tests/unit/favicon-big48.ico => toolkit/components/places/tests/favicons/favicon-big48.ico rename : toolkit/components/places/tests/unit/favicon-big64.png => toolkit/components/places/tests/favicons/favicon-big64.png rename : toolkit/components/places/tests/unit/favicon-normal16.png => toolkit/components/places/tests/favicons/favicon-normal16.png rename : toolkit/components/places/tests/unit/favicon-normal32.png => toolkit/components/places/tests/favicons/favicon-normal32.png rename : toolkit/components/places/tests/unit/favicon-scale160x3.jpg => toolkit/components/places/tests/favicons/favicon-scale160x3.jpg rename : toolkit/components/places/tests/unit/favicon-scale3x160.jpg => toolkit/components/places/tests/favicons/favicon-scale3x160.jpg rename : toolkit/components/places/tests/unit/head_bookmarks.js => toolkit/components/places/tests/favicons/head_favicons.js rename : toolkit/components/places/tests/unit/test_favicons.js => toolkit/components/places/tests/favicons/test_favicons.js rename : toolkit/components/places/tests/unit/test_moz-anno_favicon_mime_type.js => toolkit/components/places/tests/favicons/test_moz-anno_favicon_mime_type.js rename : toolkit/components/places/tests/unit/test_doReplaceFaviconData.js => toolkit/components/places/tests/favicons/test_replaceFaviconData.js rename : toolkit/components/places/tests/unit/test_doReplaceFaviconDataFromDataURL.js => toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
67 lines
2.3 KiB
JavaScript
67 lines
2.3 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
/**
|
|
* This file tests that favicons are correctly expired by expireAllFavicons.
|
|
*/
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// Globals
|
|
|
|
XPCOMUtils.defineLazyServiceGetter(this, "gHistory",
|
|
"@mozilla.org/browser/history;1",
|
|
"mozIAsyncHistory");
|
|
|
|
const TEST_PAGE_URI = NetUtil.newURI("http://example.com/");
|
|
const BOOKMARKED_PAGE_URI = NetUtil.newURI("http://example.com/bookmarked");
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
/// Tests
|
|
|
|
function run_test() {
|
|
run_next_test();
|
|
}
|
|
|
|
add_test(function test_expireAllFavicons() {
|
|
// Set up an observer to wait for favicons expiration to finish.
|
|
Services.obs.addObserver(function EAF_observer(aSubject, aTopic, aData) {
|
|
Services.obs.removeObserver(EAF_observer, aTopic);
|
|
|
|
// Check that the favicons for the pages we added were removed.
|
|
checkFaviconMissingForPage(TEST_PAGE_URI, function () {
|
|
checkFaviconMissingForPage(BOOKMARKED_PAGE_URI, function () {
|
|
run_next_test();
|
|
});
|
|
});
|
|
}, PlacesUtils.TOPIC_FAVICONS_EXPIRED, false);
|
|
|
|
// Add a visited page.
|
|
gHistory.updatePlaces({
|
|
uri: TEST_PAGE_URI,
|
|
visits: [{
|
|
transitionType: Ci.nsINavHistoryService.TRANSITION_TYPED,
|
|
visitDate: Date.now() * 1000
|
|
}]
|
|
}, {
|
|
handleError: function EAF_handleError(aResultCode, aPlaceInfo) {
|
|
do_throw("Unexpected error: " + aResultCode);
|
|
},
|
|
handleResult: function EAF_handleResult(aPlaceInfo) {
|
|
PlacesUtils.favicons.setAndFetchFaviconForPage(TEST_PAGE_URI,
|
|
SMALLPNG_DATA_URI, true);
|
|
|
|
// Add a page with a bookmark.
|
|
PlacesUtils.bookmarks.insertBookmark(
|
|
PlacesUtils.toolbarFolderId, BOOKMARKED_PAGE_URI,
|
|
PlacesUtils.bookmarks.DEFAULT_INDEX,
|
|
"Test bookmark");
|
|
PlacesUtils.favicons.setAndFetchFaviconForPage(
|
|
BOOKMARKED_PAGE_URI, SMALLPNG_DATA_URI, true,
|
|
function EAF_onFaviconDataAvailable() {
|
|
// Start expiration only after data has been saved in the database.
|
|
PlacesUtils.favicons.expireAllFavicons();
|
|
});
|
|
}
|
|
});
|
|
});
|