michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: michael@0: const nsIBLS = Ci.nsIBlocklistService; michael@0: michael@0: // Finds the test nsIPluginTag michael@0: function get_test_plugintag() { michael@0: var host = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost); michael@0: var tags = host.getPluginTags(); michael@0: for (let tag of tags) { michael@0: if (tag.name == "Test Plug-in") michael@0: return tag; michael@0: } michael@0: return null; michael@0: } michael@0: michael@0: function run_test() { michael@0: createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9"); michael@0: michael@0: copyBlocklistToProfile(do_get_file("data/test_bug514327_2.xml")); michael@0: michael@0: var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].getService(nsIBLS); michael@0: var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch); michael@0: michael@0: var plugin = get_test_plugintag(); michael@0: if (!plugin) michael@0: do_throw("Plugin tag not found"); michael@0: michael@0: //run the code after the blocklist is closed michael@0: Services.obs.notifyObservers(null, "addon-blocklist-closed", null); michael@0: do_execute_soon(function() { michael@0: // should be marked as outdated by the blocklist michael@0: do_check_true(blocklist.getPluginBlocklistState(plugin, "1", "1.9") == nsIBLS.STATE_OUTDATED); michael@0: michael@0: // should indicate that a warning should be shown michael@0: do_check_true(prefs.getBoolPref("plugins.update.notifyUser")); michael@0: }); michael@0: }