1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug514327_1.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,59 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +const Cc = Components.classes; 1.9 +const Ci = Components.interfaces; 1.10 + 1.11 +const nsIBLS = Ci.nsIBlocklistService; 1.12 + 1.13 +var PLUGINS = [{ 1.14 + // blocklisted - default severity 1.15 + name: "test_bug514327_1", 1.16 + version: "5", 1.17 + disabled: false, 1.18 + blocklisted: false 1.19 +}, 1.20 +{ 1.21 + // outdated - severity of "0" 1.22 + name: "test_bug514327_2", 1.23 + version: "5", 1.24 + disabled: false, 1.25 + blocklisted: false 1.26 +}, 1.27 +{ 1.28 + // outdated - severity of "0" 1.29 + name: "test_bug514327_3", 1.30 + version: "5", 1.31 + disabled: false, 1.32 + blocklisted: false 1.33 +}, 1.34 +{ 1.35 + // not blocklisted, not outdated 1.36 + name: "test_bug514327_4", 1.37 + version: "5", 1.38 + disabled: false, 1.39 + blocklisted: false, 1.40 + outdated: false 1.41 +}]; 1.42 + 1.43 + 1.44 +function run_test() { 1.45 + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); 1.46 + 1.47 + copyBlocklistToProfile(do_get_file("data/test_bug514327_1.xml")); 1.48 + 1.49 + var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS); 1.50 + 1.51 + // blocked (sanity check) 1.52 + do_check_true(blocklist.getPluginBlocklistState(PLUGINS[0], "1", "1.9") == nsIBLS.STATE_BLOCKED); 1.53 + 1.54 + // outdated 1.55 + do_check_true(blocklist.getPluginBlocklistState(PLUGINS[1], "1", "1.9") == nsIBLS.STATE_OUTDATED); 1.56 + 1.57 + // outdated 1.58 + do_check_true(blocklist.getPluginBlocklistState(PLUGINS[2], "1", "1.9") == nsIBLS.STATE_OUTDATED); 1.59 + 1.60 + // not blocked 1.61 + do_check_true(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED); 1.62 +}