diff options
Diffstat (limited to 'toolkit/components/thumbnails/test/browser_thumbnails_bg_redirect.js')
-rw-r--r-- | toolkit/components/thumbnails/test/browser_thumbnails_bg_redirect.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/toolkit/components/thumbnails/test/browser_thumbnails_bg_redirect.js b/toolkit/components/thumbnails/test/browser_thumbnails_bg_redirect.js new file mode 100644 index 0000000000..ae0096ff18 --- /dev/null +++ b/toolkit/components/thumbnails/test/browser_thumbnails_bg_redirect.js @@ -0,0 +1,32 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +add_task(async function thumbnails_bg_redirect() { + let finalURL = "https://example.com/redirected"; + let originalURL = bgTestPageURL({ redirect: finalURL }); + + ok( + !thumbnailExists(originalURL), + "Thumbnail file for original URL should not exist yet." + ); + ok( + !thumbnailExists(finalURL), + "Thumbnail file for final URL should not exist yet." + ); + + let captureOriginalPromise = bgAddPageThumbObserver(originalURL); + let captureFinalPromise = bgAddPageThumbObserver(finalURL); + + let [capturedURL] = await bgCapture(originalURL); + is(capturedURL, originalURL, "Captured URL should be URL passed to capture"); + await captureOriginalPromise; + await captureFinalPromise; + ok( + thumbnailExists(originalURL), + "Thumbnail for original URL should be cached" + ); + ok(thumbnailExists(finalURL), "Thumbnail for final URL should be cached"); + + removeThumbnail(originalURL); + removeThumbnail(finalURL); +}); |