|
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 var PLUGINS = [{ |
|
11 // blocklisted - default severity |
|
12 name: "test_bug514327_1", |
|
13 version: "5", |
|
14 disabled: false, |
|
15 blocklisted: false |
|
16 }, |
|
17 { |
|
18 // outdated - severity of "0" |
|
19 name: "test_bug514327_2", |
|
20 version: "5", |
|
21 disabled: false, |
|
22 blocklisted: false |
|
23 }, |
|
24 { |
|
25 // outdated - severity of "0" |
|
26 name: "test_bug514327_3", |
|
27 version: "5", |
|
28 disabled: false, |
|
29 blocklisted: false |
|
30 }, |
|
31 { |
|
32 // not blocklisted, not outdated |
|
33 name: "test_bug514327_4", |
|
34 version: "5", |
|
35 disabled: false, |
|
36 blocklisted: false, |
|
37 outdated: false |
|
38 }]; |
|
39 |
|
40 |
|
41 function run_test() { |
|
42 createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); |
|
43 |
|
44 copyBlocklistToProfile(do_get_file("data/test_bug514327_1.xml")); |
|
45 |
|
46 var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS); |
|
47 |
|
48 // blocked (sanity check) |
|
49 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_BLOCKED); |
|
50 |
|
51 // outdated |
|
52 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[1], "1", "1.9") == nsIBLS.STATE_OUTDATED); |
|
53 |
|
54 // outdated |
|
55 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[2], "1", "1.9") == nsIBLS.STATE_OUTDATED); |
|
56 |
|
57 // not blocked |
|
58 do_check_true(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED); |
|
59 } |