From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- .../uiUnsupportedAlreadyNotified.js | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js (limited to 'toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js') diff --git a/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js b/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js new file mode 100644 index 000000000..5b694ed30 --- /dev/null +++ b/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js @@ -0,0 +1,74 @@ +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ + */ + +Cu.import("resource://testing-common/MockRegistrar.jsm"); + +const WindowWatcher = { + openWindow: function(aParent, aUrl, aName, aFeatures, aArgs) { + check_showUpdateAvailable(); + }, + + QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowWatcher]) +}; + +const WindowMediator = { + getMostRecentWindow: function(aWindowType) { + return null; + }, + + QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowMediator]) +}; + +function run_test() { + setupTestCommon(); + + debugDump("testing nsIUpdatePrompt notifications should not be displayed " + + "when showUpdateAvailable is called for an unsupported system " + + "update when the unsupported notification has already been " + + "shown (bug 843497)"); + + start_httpserver(); + setUpdateURL(gURLData + gHTTPHandlerPath); + standardInit(); + + let windowWatcherCID = + MockRegistrar.register("@mozilla.org/embedcomp/window-watcher;1", + WindowWatcher); + let windowMediatorCID = + MockRegistrar.register("@mozilla.org/appshell/window-mediator;1", + WindowMediator); + do_register_cleanup(() => { + MockRegistrar.unregister(windowWatcherCID); + MockRegistrar.unregister(windowMediatorCID); + }); + + Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false); + Services.prefs.setBoolPref(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, true); + // This preference is used to determine when the background update check has + // completed since a successful check will clear the preference. + Services.prefs.setIntPref(PREF_APP_UPDATE_BACKGROUNDERRORS, 1); + + gResponseBody = getRemoteUpdatesXMLString(" \n"); + gAUS.notify(null); + do_execute_soon(check_test); +} + +function check_test() { + if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_BACKGROUNDERRORS)) { + do_execute_soon(check_test); + return; + } + Assert.ok(true, + PREF_APP_UPDATE_BACKGROUNDERRORS + " preference should not exist"); + + stop_httpserver(doTestFinish); +} + +function check_showUpdateAvailable() { + do_throw("showUpdateAvailable should not have called openWindow!"); +} -- cgit v1.2.3