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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial