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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:cde2697e521d
1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/publicdomain/zero/1.0/
3 */
4
5 // Bug 566194 - safe mode / security & compatibility check status are not exposed in new addon manager UI
6
7 function test() {
8 waitForExplicitFinish();
9 run_next_test();
10 }
11
12 function end_test() {
13 finish();
14 }
15
16 add_test(function() {
17 info("Testing compatibility checking warning");
18
19 info("Setting checkCompatibility to false");
20 AddonManager.checkCompatibility = false;
21
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");
27
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");
33
34 close_manager(aWindow, function() {
35 run_next_test();
36 });
37 });
38 });
39
40 add_test(function() {
41 info("Testing update security checking warning");
42
43 var pref = "extensions.checkUpdateSecurity";
44 info("Setting " + pref + " pref to false")
45 Services.prefs.setBoolPref(pref, false);
46
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");
52
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");
58
59 close_manager(aWindow, function() {
60 run_next_test();
61 });
62 });
63 });

mercurial