diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /toolkit/components/thumbnails/test/browser_thumbnails_redirect.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/thumbnails/test/browser_thumbnails_redirect.js')
-rw-r--r-- | toolkit/components/thumbnails/test/browser_thumbnails_redirect.js | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/toolkit/components/thumbnails/test/browser_thumbnails_redirect.js b/toolkit/components/thumbnails/test/browser_thumbnails_redirect.js new file mode 100644 index 0000000000..b77b4011c3 --- /dev/null +++ b/toolkit/components/thumbnails/test/browser_thumbnails_redirect.js @@ -0,0 +1,42 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +const URL = + "http://mochi.test:8888/browser/toolkit/components/thumbnails/" + + "test/background_red_redirect.sjs"; +// loading URL will redirect us to... +const FINAL_URL = + "http://mochi.test:8888/browser/toolkit/components/" + + "thumbnails/test/background_red.html"; + +/** + * These tests ensure that we save and provide thumbnails for redirecting sites. + */ +add_task(async function thumbnails_redirect() { + dontExpireThumbnailURLs([URL, FINAL_URL]); + + // Kick off history by loading a tab first or the test fails in single mode. + await BrowserTestUtils.withNewTab( + { + gBrowser, + url: URL, + }, + browser => {} + ); + + // Create a tab, redirecting to a page with a red background. + await BrowserTestUtils.withNewTab( + { + gBrowser, + url: URL, + }, + async browser => { + await captureAndCheckColor(255, 0, 0, "we have a red thumbnail"); + + // Wait until the referrer's thumbnail's file has been written. + await whenFileExists(URL); + let [r, g, b] = await retrieveImageDataForURL(URL); + is("" + [r, g, b], "255,0,0", "referrer has a red thumbnail"); + } + ); +}); |