browser/components/preferences/in-content/tests/browser_advanced_update.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/preferences/in-content/tests/browser_advanced_update.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +"use strict";
     1.8 +
     1.9 +function test() {
    1.10 +  waitForExplicitFinish();
    1.11 +  resetPreferences();
    1.12 +
    1.13 +  registerCleanupFunction(resetPreferences);
    1.14 +  Services.prefs.setBoolPref("browser.search.update", false);
    1.15 +
    1.16 +  open_preferences(runTest);
    1.17 +}
    1.18 +
    1.19 +function runTest(win) {
    1.20 +  let doc = win.document;
    1.21 +  let enableSearchUpdate = doc.getElementById("enableSearchUpdate");
    1.22 +
    1.23 +  win.gotoPref("paneAdvanced");
    1.24 +
    1.25 +  let advancedPrefs = doc.getElementById("advancedPrefs");
    1.26 +  let updateTab = doc.getElementById("updateTab");
    1.27 +  advancedPrefs.selectedTab = updateTab;
    1.28 +
    1.29 +  is_element_visible(enableSearchUpdate, "Check search update preference is visible");
    1.30 +
    1.31 +  // Ensure that the update pref dialog reflects the actual pref value.
    1.32 +  ok(!enableSearchUpdate.checked, "Ensure search updates are disabled");
    1.33 +  Services.prefs.setBoolPref("browser.search.update", true);
    1.34 +  ok(enableSearchUpdate.checked, "Ensure search updates are enabled");
    1.35 +
    1.36 +  gBrowser.removeCurrentTab();
    1.37 +  win.close();
    1.38 +  finish();
    1.39 +}
    1.40 +
    1.41 +function resetPreferences() {
    1.42 +  Services.prefs.clearUserPref("browser.search.update");
    1.43 +}

mercurial