1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/preferences/tests/browser_advanced_update.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +function test() { 1.8 + waitForExplicitFinish(); 1.9 + resetPreferences(); 1.10 + 1.11 + registerCleanupFunction(resetPreferences); 1.12 + 1.13 + function observer(win, topic, data) { 1.14 + Services.obs.removeObserver(observer, "advanced-pane-loaded"); 1.15 + runTest(win); 1.16 + } 1.17 + Services.obs.addObserver(observer, "advanced-pane-loaded", false); 1.18 + 1.19 + Services.prefs.setBoolPref("browser.search.update", false); 1.20 + openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences", 1.21 + "chrome,titlebar,toolbar,centerscreen,dialog=no", "paneAdvanced"); 1.22 +} 1.23 + 1.24 +function runTest(win) { 1.25 + let doc = win.document; 1.26 + let enableSearchUpdate = doc.getElementById("enableSearchUpdate"); 1.27 + 1.28 + // Ensure that the update pref dialog reflects the actual pref value. 1.29 + ok(!enableSearchUpdate.checked, "Ensure search updates are disabled"); 1.30 + Services.prefs.setBoolPref("browser.search.update", true); 1.31 + ok(enableSearchUpdate.checked, "Ensure search updates are enabled"); 1.32 + 1.33 + win.close(); 1.34 + finish(); 1.35 +} 1.36 + 1.37 +function resetPreferences() { 1.38 + Services.prefs.clearUserPref("browser.search.update"); 1.39 +}