summaryrefslogtreecommitdiffstats
path: root/toolkit/components/thumbnails/test/browser_thumbnails_privacy.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
commit0ddd00f1959c78ce37c14fef3c83401408fca3bf (patch)
treed408e02767c86cf8aac3acbb86722b03c77ede6f /toolkit/components/thumbnails/test/browser_thumbnails_privacy.js
parent20f0905b33cbb18d1caa80c55e2f552c2e18957b (diff)
downloadUXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar
UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.gz
UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.lz
UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.tar.xz
UXP-0ddd00f1959c78ce37c14fef3c83401408fca3bf.zip
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/thumbnails/test/browser_thumbnails_privacy.js')
-rw-r--r--toolkit/components/thumbnails/test/browser_thumbnails_privacy.js74
1 files changed, 0 insertions, 74 deletions
diff --git a/toolkit/components/thumbnails/test/browser_thumbnails_privacy.js b/toolkit/components/thumbnails/test/browser_thumbnails_privacy.js
deleted file mode 100644
index e7dc7b4d5..000000000
--- a/toolkit/components/thumbnails/test/browser_thumbnails_privacy.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const PREF_DISK_CACHE_SSL = "browser.cache.disk_cache_ssl";
-const URL = "://example.com/browser/toolkit/components/thumbnails/" +
- "test/privacy_cache_control.sjs";
-
-function* runTests() {
- registerCleanupFunction(function () {
- Services.prefs.clearUserPref(PREF_DISK_CACHE_SSL);
- });
-
- let positive = [
- // A normal HTTP page without any Cache-Control header.
- {scheme: "http", cacheControl: null, diskCacheSSL: false},
-
- // A normal HTTP page with 'Cache-Control: private'.
- {scheme: "http", cacheControl: "private", diskCacheSSL: false},
-
- // Capture HTTPS pages if browser.cache.disk_cache_ssl == true.
- {scheme: "https", cacheControl: null, diskCacheSSL: true},
- {scheme: "https", cacheControl: "public", diskCacheSSL: true},
- {scheme: "https", cacheControl: "private", diskCacheSSL: true}
- ];
-
- let negative = [
- // Never capture pages with 'Cache-Control: no-store'.
- {scheme: "http", cacheControl: "no-store", diskCacheSSL: false},
- {scheme: "http", cacheControl: "no-store", diskCacheSSL: true},
- {scheme: "https", cacheControl: "no-store", diskCacheSSL: false},
- {scheme: "https", cacheControl: "no-store", diskCacheSSL: true},
-
- // Don't capture HTTPS pages by default.
- {scheme: "https", cacheControl: null, diskCacheSSL: false},
- {scheme: "https", cacheControl: "public", diskCacheSSL: false},
- {scheme: "https", cacheControl: "private", diskCacheSSL: false}
- ];
-
- yield checkCombinations(positive, true);
- yield checkCombinations(negative, false);
-}
-
-function checkCombinations(aCombinations, aResult) {
- let combi = aCombinations.shift();
- if (!combi) {
- next();
- return;
- }
-
- let url = combi.scheme + URL;
- if (combi.cacheControl)
- url += "?" + combi.cacheControl;
- Services.prefs.setBoolPref(PREF_DISK_CACHE_SSL, combi.diskCacheSSL);
-
- // Add the test page as a top link so it has a chance to be thumbnailed
- addVisitsAndRepopulateNewTabLinks(url, _ => {
- testCombination(combi, url, aCombinations, aResult);
- });
-}
-
-function testCombination(combi, url, aCombinations, aResult) {
- let tab = gBrowser.selectedTab = gBrowser.addTab(url);
- let browser = gBrowser.selectedBrowser;
-
- whenLoaded(browser, () => {
- let msg = JSON.stringify(combi) + " == " + aResult;
- PageThumbs.shouldStoreThumbnail(browser, (aIsSafeSite) => {
- is(aIsSafeSite, aResult, msg);
- gBrowser.removeTab(tab);
- // Continue with the next combination.
- checkCombinations(aCombinations, aResult);
- });
- });
-}