diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /toolkit/components/places/tests/favicons/test_multiple_frames.js | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/places/tests/favicons/test_multiple_frames.js')
-rw-r--r-- | toolkit/components/places/tests/favicons/test_multiple_frames.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/toolkit/components/places/tests/favicons/test_multiple_frames.js b/toolkit/components/places/tests/favicons/test_multiple_frames.js new file mode 100644 index 0000000000..79bbaf84a7 --- /dev/null +++ b/toolkit/components/places/tests/favicons/test_multiple_frames.js @@ -0,0 +1,46 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +/** + * This file tests support for icons with multiple frames (like .ico files). + */ + +add_task(async function() { + // in: 48x48 ico, 56646 bytes. + // (howstuffworks.com icon, contains 13 icons with sizes from 16x16 to + // 48x48 in varying depths) + let pageURI = NetUtil.newURI("http://places.test/page/"); + await PlacesTestUtils.addVisits(pageURI); + let faviconURI = NetUtil.newURI("http://places.test/icon/favicon-multi.ico"); + // Fake window. + let win = { devicePixelRatio: 1.0 }; + let icoData = readFileData(do_get_file("favicon-multi.ico")); + PlacesUtils.favicons.replaceFaviconData(faviconURI, icoData, "image/x-icon"); + await setFaviconForPage(pageURI, faviconURI); + + for (let size of [16, 32, 64]) { + let file = do_get_file(`favicon-multi-frame${size}.png`); + let data = readFileData(file); + + info("Check getFaviconDataForPage"); + let icon = await getFaviconDataForPage(pageURI, size); + Assert.equal(icon.mimeType, "image/png"); + Assert.deepEqual(icon.data, data); + + info("Check moz-anno:favicon protocol"); + await compareFavicons( + Services.io.newFileURI(file), + PlacesUtils.urlWithSizeRef( + win, + PlacesUtils.favicons.getFaviconLinkForIcon(faviconURI).spec, + size + ) + ); + + info("Check page-icon protocol"); + await compareFavicons( + Services.io.newFileURI(file), + PlacesUtils.urlWithSizeRef(win, "page-icon:" + pageURI.spec, size) + ); + } +}); |