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

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

mercurial