toolkit/mozapps/extensions/test/xpcshell/test_bug514327_2.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:80aaad04f670
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 const Cc = Components.classes;
6 const Ci = Components.interfaces;
7
8 const nsIBLS = Ci.nsIBlocklistService;
9
10 // Finds the test nsIPluginTag
11 function get_test_plugintag() {
12 var host = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
13 var tags = host.getPluginTags();
14 for (let tag of tags) {
15 if (tag.name == "Test Plug-in")
16 return tag;
17 }
18 return null;
19 }
20
21 function run_test() {
22 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
23
24 copyBlocklistToProfile(do_get_file("data/test_bug514327_2.xml"));
25
26 var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS);
27 var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
28
29 var plugin = get_test_plugintag();
30 if (!plugin)
31 do_throw("Plugin tag not found");
32
33 //run the code after the blocklist is closed
34 Services.obs.notifyObservers(null, "addon-blocklist-closed", null);
35 do_execute_soon(function() {
36 // should be marked as outdated by the blocklist
37 do_check_true(blocklist.getPluginBlocklistState(plugin, "1", "1.9") == nsIBLS.STATE_OUTDATED);
38
39 // should indicate that a warning should be shown
40 do_check_true(prefs.getBoolPref("plugins.update.notifyUser"));
41 });
42 }

mercurial