fune/browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js
Gijs Kruitbosch ad8a8ac5d9 Bug 1012223 - make opening about:preferences faster, r=jaws
--HG--
extra : rebase_source : 23ef8bb84ae55f81bef21b822febf3482f827a92
2015-01-19 17:40:12 +00:00

52 lines
1.3 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
function test() {
waitForExplicitFinish();
let prefs = [
"browser.cache.offline.enable",
"browser.cache.disk.enable",
"browser.cache.memory.enable",
];
registerCleanupFunction(function() {
for (let pref of prefs) {
Services.prefs.clearUserPref(pref);
}
});
for (let pref of prefs) {
Services.prefs.setBoolPref(pref, false);
}
open_preferences(runTest);
}
function runTest(win) {
is(gBrowser.currentURI.spec, "about:preferences", "about:preferences loaded");
let tab = win.document;
let elements = tab.getElementById("mainPrefPane").children;
// Test if advanced pane is opened correctly
win.gotoPref("paneAdvanced");
for (let element of elements) {
if (element.nodeName == "preferences") {
continue;
}
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "paneAdvanced") {
is_element_visible(element, "Advanced elements should be visible");
} else {
is_element_hidden(element, "Non-Advanced elements should be hidden");
}
}
gBrowser.removeCurrentTab();
win.close();
finish();
}