michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: * http://creativecommons.org/publicdomain/zero/1.0/ michael@0: */ michael@0: michael@0: // Bug 656269 - Add link to Mozilla plugin check from Add-ons Manager michael@0: michael@0: const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html"; michael@0: const PREF_PLUGINCHECKURL = "plugins.update.url"; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: Services.prefs.setCharPref(PREF_PLUGINCHECKURL, MAIN_URL); michael@0: registerCleanupFunction(function() { michael@0: Services.prefs.clearUserPref(PREF_PLUGINCHECKURL); michael@0: }); michael@0: michael@0: run_next_test(); michael@0: } michael@0: michael@0: function end_test() { michael@0: finish(); michael@0: } michael@0: michael@0: add_test(function() { michael@0: open_manager("addons://list/extension", function(aManager) { michael@0: info("Testing plugin check information"); michael@0: var button = aManager.document.querySelector("#list-view button.global-info-plugincheck"); michael@0: is_element_hidden(button, "Plugin Check message button should be hidden"); michael@0: michael@0: info("Changing view to plugins") michael@0: EventUtils.synthesizeMouseAtCenter(aManager.document.getElementById("category-plugin"), { }, aManager); michael@0: michael@0: wait_for_view_load(aManager, function(aManager) { michael@0: var button = aManager.document.querySelector("#list-view button.global-info-plugincheck"); michael@0: is_element_visible(button, "Plugin Check message button should be visible"); michael@0: michael@0: info("Clicking 'Plugin Check' button"); michael@0: EventUtils.synthesizeMouseAtCenter(button, { }, aManager); michael@0: gBrowser.addEventListener("load", function(event) { michael@0: if (!(event.target instanceof Document) || michael@0: event.target.location.href == "about:blank") michael@0: return; michael@0: gBrowser.removeEventListener("load", arguments.callee, true); michael@0: michael@0: is(gBrowser.currentURI.spec, Services.urlFormatter.formatURLPref("plugins.update.url"), "Plugin Check URL should match"); michael@0: michael@0: gBrowser.removeCurrentTab(); michael@0: close_manager(aManager, function() { michael@0: run_next_test(); michael@0: }); michael@0: }, true); michael@0: }); michael@0: }); michael@0: });