toolkit/mozapps/extensions/test/browser/browser_globalwarnings.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* Any copyright is dedicated to the Public Domain.
     2  * http://creativecommons.org/publicdomain/zero/1.0/
     3  */
     5 // Bug 566194 - safe mode / security & compatibility check status are not exposed in new addon manager UI
     7 function test() {
     8   waitForExplicitFinish();
     9   run_next_test();
    10 }
    12 function end_test() {
    13   finish();
    14 }
    16 add_test(function() {
    17   info("Testing compatibility checking warning");
    19   info("Setting checkCompatibility to false");
    20   AddonManager.checkCompatibility = false;
    22   open_manager("addons://list/extension", function(aWindow) {
    23     var hbox = aWindow.document.querySelector("#list-view hbox.global-warning-checkcompatibility");
    24     is_element_visible(hbox, "Check Compatibility warning hbox should be visible");
    25     var button = aWindow.document.querySelector("#list-view button.global-warning-checkcompatibility");
    26     is_element_visible(button, "Check Compatibility warning button should be visible");
    28     info("Clicking 'Enable' button");
    29     EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
    30     is(AddonManager.checkCompatibility, true, "Check Compatibility pref should be cleared");
    31     is_element_hidden(hbox, "Check Compatibility warning hbox should be hidden");
    32     is_element_hidden(button, "Check Compatibility warning button should be hidden");
    34     close_manager(aWindow, function() {
    35       run_next_test();
    36     });
    37   });
    38 });
    40 add_test(function() {
    41   info("Testing update security checking warning");
    43   var pref = "extensions.checkUpdateSecurity";
    44   info("Setting " + pref + " pref to false")
    45   Services.prefs.setBoolPref(pref, false);
    47   open_manager(null, function(aWindow) {
    48     var hbox = aWindow.document.querySelector("#list-view hbox.global-warning-updatesecurity");
    49     is_element_visible(hbox, "Check Update Security warning hbox should be visible");
    50     var button = aWindow.document.querySelector("#list-view button.global-warning-updatesecurity");
    51     is_element_visible(button, "Check Update Security warning button should be visible");
    53     info("Clicking 'Enable' button");
    54     EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
    55     is(Services.prefs.prefHasUserValue(pref), false, "Check Update Security pref should be cleared");
    56     is_element_hidden(hbox, "Check Update Security warning hbox should be hidden");
    57     is_element_hidden(button, "Check Update Security warning button should be hidden");
    59     close_manager(aWindow, function() {
    60       run_next_test();
    61     });
    62   });
    63 });

mercurial