Bug 1254148 - Fix browser_privacypane_8.js to run in e10s. r=gijs

MozReview-Commit-ID: 9Xwmlk8jp9B

--HG--
extra : transplant_source : %AD%9Ck%EF%C7%C78%CD%28%8B%D7%8E%2B%E3%13%7D%A1%08-%9F
This commit is contained in:
Jared Wein 2016-03-07 12:34:21 -05:00
Родитель 64075b6fc0
Коммит 63c24c282a
7 изменённых файлов: 112 добавлений и 176 удалений

Просмотреть файл

@ -29,7 +29,6 @@ skip-if = true || !healthreport # Bug 1185403 for the "true"
[browser_privacypane_4.js]
[browser_privacypane_5.js]
[browser_privacypane_8.js]
skip-if = e10s # Bug ?????? - "leaked until shutdown [nsGlobalWindow #99 about:preferences]"
[browser_sanitizeOnShutdown_prefLocked.js]
[browser_searchsuggestions.js]
[browser_subdialogs.js]

Просмотреть файл

@ -1,25 +1,18 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
function test() {
requestLongerTimeout(2);
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_pane_visibility,
test_dependent_elements,
test_dependent_cookie_elements,
test_dependent_clearonclose_elements,
test_dependent_prefs,
]);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_pane_visibility,
test_dependent_elements,
test_dependent_cookie_elements,
test_dependent_clearonclose_elements,
test_dependent_prefs,
]);

Просмотреть файл

@ -1,22 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_custom_retention("rememberHistory", "remember"),
test_custom_retention("rememberHistory", "custom"),
test_custom_retention("rememberForms", "remember"),
test_custom_retention("rememberForms", "custom"),
test_historymode_retention("remember", "remember"),
]);
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_custom_retention("rememberHistory", "remember"),
test_custom_retention("rememberHistory", "custom"),
test_custom_retention("rememberForms", "remember"),
test_custom_retention("rememberForms", "custom"),
test_historymode_retention("remember", "remember"),
]);

Просмотреть файл

@ -1,33 +1,23 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
requestLongerTimeout(2);
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
run_test_subset(Array.concat([
test_custom_retention("acceptCookies", "remember"),
test_custom_retention("acceptCookies", "custom")
],
[
test_custom_retention("acceptThirdPartyMenu", "remember", "visited"),
test_custom_retention("acceptThirdPartyMenu", "custom", "always")
], [
test_custom_retention("keepCookiesUntil", "remember", 1),
test_custom_retention("keepCookiesUntil", "custom", 2),
test_custom_retention("keepCookiesUntil", "custom", 0),
test_custom_retention("alwaysClear", "remember"),
test_custom_retention("alwaysClear", "custom"),
test_historymode_retention("remember", "remember"),
]));
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
let runtime = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime);
run_test_subset([
test_custom_retention("acceptCookies", "remember"),
test_custom_retention("acceptCookies", "custom"),
test_custom_retention("acceptThirdPartyMenu", "remember", "visited"),
test_custom_retention("acceptThirdPartyMenu", "custom", "always"),
test_custom_retention("keepCookiesUntil", "remember", 1),
test_custom_retention("keepCookiesUntil", "custom", 2),
test_custom_retention("keepCookiesUntil", "custom", 0),
test_custom_retention("alwaysClear", "remember"),
test_custom_retention("alwaysClear", "custom"),
test_historymode_retention("remember", "remember"),
]);

Просмотреть файл

@ -1,24 +1,17 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
let tests = [
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("bookmark", true),
test_locbar_suggestion_retention("openpage", false),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("history", false),
];
run_test_subset(tests);
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("bookmark", true),
test_locbar_suggestion_retention("openpage", false),
test_locbar_suggestion_retention("history", true),
test_locbar_suggestion_retention("history", false),
]);

Просмотреть файл

@ -1,31 +1,26 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
// history mode should be initialized to remember
test_historymode_retention("remember", undefined),
// history mode should remain remember; toggle acceptCookies checkbox
test_custom_retention("acceptCookies", "remember"),
// history mode should now be custom; set history mode to dontremember
test_historymode_retention("dontremember", "custom"),
// history mode should remain custom; set history mode to remember
test_historymode_retention("remember", "custom"),
// history mode should now be remember
test_historymode_retention("remember", "remember"),
]);
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let rootDir = getRootDirectory(gTestPath);
let jar = getJar(rootDir);
if (jar) {
let tmpdir = extractJarToTmp(jar);
rootDir = "file://" + tmpdir.path + '/';
}
loader.loadSubScript(rootDir + "privacypane_tests_perwindow.js", this);
run_test_subset([
// history mode should be initialized to remember
test_historymode_retention("remember", undefined),
// history mode should remain remember; toggle acceptCookies checkbox
test_custom_retention("acceptCookies", "remember"),
// history mode should now be custom; set history mode to dontremember
test_historymode_retention("dontremember", "custom"),
// history mode should remain custom; set history mode to remember
test_historymode_retention("remember", "custom"),
// history mode should now be remember
test_historymode_retention("remember", "remember"),
]);

Просмотреть файл

@ -1,22 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function runTestOnPrivacyPrefPane(testFunc) {
gBrowser.tabContainer.addEventListener("TabOpen", function(aEvent) {
gBrowser.tabContainer.removeEventListener("TabOpen", arguments.callee, true);
let browser = aEvent.originalTarget.linkedBrowser;
browser.addEventListener("Initialized", function(aEvent) {
browser.removeEventListener("Initialized", arguments.callee, true);
is(browser.contentWindow.location.href, "about:preferences", "Checking if the preferences tab was opened");
browser.contentWindow.gotoPref("panePrivacy");
testFunc(browser.contentWindow);
gBrowser.removeCurrentTab();
testRunner.runNext();
}, true);
}, true);
gBrowser.selectedTab = gBrowser.addTab("about:preferences");
function* runTestOnPrivacyPrefPane(testFunc) {
info("runTestOnPrivacyPrefPane entered");
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:preferences", true, true);
let browser = tab.linkedBrowser;
info("loaded about:preferences");
browser.contentWindow.gotoPref("panePrivacy");
info("viewing privacy pane, executing testFunc");
testFunc(browser.contentWindow);
yield BrowserTestUtils.removeTab(tab);
}
function controlChanged(element) {
@ -254,7 +244,7 @@ function test_dependent_prefs(win) {
}
function test_historymode_retention(mode, expect) {
return function(win) {
return function test_historymode_retention_fn(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
@ -275,7 +265,7 @@ function test_historymode_retention(mode, expect) {
}
function test_custom_retention(controlToChange, expect, valueIncrement) {
return function(win) {
return function test_custom_retention_fn(win) {
let historymode = win.document.getElementById("historyMode");
ok(historymode, "history mode menulist should exist");
@ -329,31 +319,12 @@ function reset_preferences(win) {
pref.value = gPrefCache.get(pref.name);
}
var testRunner;
function run_test_subset(subset) {
Services.prefs.setBoolPref("browser.preferences.instantApply", true);
dump("subset: " + Array.from(subset, x => x.name).join(",") + "\n");
info("subset: " + Array.from(subset, x => x.name).join(",") + "\n");
SpecialPowers.pushPrefEnv({"set": [["browser.preferences.instantApply", true]]});
waitForExplicitFinish();
registerCleanupFunction(function() {
// Reset pref to its default
Services.prefs.clearUserPref("browser.preferences.instantApply");
});
testRunner = {
tests: [cache_preferences, ...subset, reset_preferences],
counter: 0,
runNext: function() {
if (this.counter == this.tests.length) {
finish();
} else {
let self = this;
setTimeout(function() {
runTestOnPrivacyPrefPane(self.tests[self.counter++]);
}, 0);
}
}
};
testRunner.runNext();
let tests = [cache_preferences, ...subset, reset_preferences];
for (let test of tests) {
add_task(runTestOnPrivacyPrefPane.bind(undefined, test));
}
}