diff options
Diffstat (limited to 'toolkit/components/places/tests/favicons/test_svg_favicon.js')
-rw-r--r-- | toolkit/components/places/tests/favicons/test_svg_favicon.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/toolkit/components/places/tests/favicons/test_svg_favicon.js b/toolkit/components/places/tests/favicons/test_svg_favicon.js new file mode 100644 index 0000000000..8d9f2edf11 --- /dev/null +++ b/toolkit/components/places/tests/favicons/test_svg_favicon.js @@ -0,0 +1,34 @@ +const PAGEURI = NetUtil.newURI("http://deliciousbacon.com/"); + +add_task(async function () { + // First, add a history entry or else Places can't save a favicon. + await PlacesTestUtils.addVisits({ + uri: PAGEURI, + transition: TRANSITION_LINK, + visitDate: Date.now() * 1000, + }); + + await new Promise(resolve => { + function onSetComplete(aURI, aDataLen, aData, aMimeType, aWidth) { + equal(aURI.spec, SMALLSVG_DATA_URI.spec, "setFavicon aURI check"); + equal(aDataLen, 263, "setFavicon aDataLen check"); + equal(aMimeType, "image/svg+xml", "setFavicon aMimeType check"); + dump(aWidth); + resolve(); + } + + PlacesUtils.favicons.setAndFetchFaviconForPage( + PAGEURI, + SMALLSVG_DATA_URI, + false, + PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE, + onSetComplete, + Services.scriptSecurityManager.getSystemPrincipal() + ); + }); + + let data = await PlacesUtils.promiseFaviconData(PAGEURI.spec); + equal(data.uri.spec, SMALLSVG_DATA_URI.spec, "getFavicon aURI check"); + equal(data.dataLen, 263, "getFavicon aDataLen check"); + equal(data.mimeType, "image/svg+xml", "getFavicon aMimeType check"); +}); |