summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/webextensions/test/xpcshell/test_bug324121.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-06-26 16:09:08 -0400
committerMatt A. Tobin <email@mattatobin.com>2018-06-26 16:09:08 -0400
commiteda567b364a06e9e63efb865a6b1c73f1cb5232e (patch)
tree912ab15d877f733318e2c0394713bca33b830547 /toolkit/mozapps/webextensions/test/xpcshell/test_bug324121.js
parent80eb356d57fc310cdf812cae63de30d6e56c1788 (diff)
downloadUXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.gz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.lz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.tar.xz
UXP-eda567b364a06e9e63efb865a6b1c73f1cb5232e.zip
[AllAM] Remove Mozilla Tests
Diffstat (limited to 'toolkit/mozapps/webextensions/test/xpcshell/test_bug324121.js')
-rw-r--r--toolkit/mozapps/webextensions/test/xpcshell/test_bug324121.js178
1 files changed, 0 insertions, 178 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_bug324121.js b/toolkit/mozapps/webextensions/test/xpcshell/test_bug324121.js
deleted file mode 100644
index 84b6c6189..000000000
--- a/toolkit/mozapps/webextensions/test/xpcshell/test_bug324121.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-// Disables security checking our updates which haven't been signed
-Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
-
-// Get the HTTP server.
-Components.utils.import("resource://testing-common/httpd.js");
-var testserver;
-
-var next_test = null;
-var gItemsNotChecked =[];
-
-var ADDONS = [ {id: "bug324121_1@tests.mozilla.org",
- addon: "test_bug324121_1",
- shouldCheck: false },
- {id: "bug324121_2@tests.mozilla.org",
- addon: "test_bug324121_2",
- shouldCheck: true },
- {id: "bug324121_3@tests.mozilla.org",
- addon: "test_bug324121_3",
- shouldCheck: true },
- {id: "bug324121_4@tests.mozilla.org",
- addon: "test_bug324121_4",
- shouldCheck: true },
- {id: "bug324121_5@tests.mozilla.org",
- addon: "test_bug324121_5",
- shouldCheck: false },
- {id: "bug324121_6@tests.mozilla.org",
- addon: "test_bug324121_6",
- shouldCheck: true },
- {id: "bug324121_7@tests.mozilla.org",
- addon: "test_bug324121_7",
- shouldCheck: true },
- {id: "bug324121_8@tests.mozilla.org",
- addon: "test_bug324121_8",
- shouldCheck: true },
- {id: "bug324121_9@tests.mozilla.org",
- addon: "test_bug324121_9",
- shouldCheck: false } ];
-
-// nsIAddonUpdateCheckListener
-var updateListener = {
- pendingCount: 0,
-
- onUpdateAvailable: function onAddonUpdateEnded(aAddon) {
- switch (aAddon.id) {
- // add-on disabled - should not happen
- case "bug324121_1@tests.mozilla.org":
- // app id already compatible - should not happen
- case "bug324121_5@tests.mozilla.org":
- // toolkit id already compatible - should not happen
- case "bug324121_9@tests.mozilla.org":
- do_throw("Should not have seen an update check for " + aAddon.id);
- break;
-
- // app id incompatible update available
- case "bug324121_3@tests.mozilla.org":
- // update rdf not found
- case "bug324121_4@tests.mozilla.org":
- // toolkit id incompatible update available
- case "bug324121_7@tests.mozilla.org":
- // update rdf not found
- case "bug324121_8@tests.mozilla.org":
- do_throw("Should be no update available for " + aAddon.id);
- break;
-
- // Updates available
- case "bug324121_2@tests.mozilla.org":
- case "bug324121_6@tests.mozilla.org":
- break;
-
- default:
- do_throw("Update check for unknown " + aAddon.id);
- }
-
- // pos should always be >= 0 so just let this throw if this fails
- var pos = gItemsNotChecked.indexOf(aAddon.id);
- gItemsNotChecked.splice(pos, 1);
- },
-
- onNoUpdateAvailable: function onNoUpdateAvailable(aAddon) {
- switch (aAddon.id) {
- // add-on disabled - should not happen
- case "bug324121_1@tests.mozilla.org":
- // app id already compatible - should not happen
- case "bug324121_5@tests.mozilla.org":
- // toolkit id already compatible - should not happen
- case "bug324121_9@tests.mozilla.org":
- do_throw("Should not have seen an update check for " + aAddon.id);
- break;
-
- // app id incompatible update available
- case "bug324121_3@tests.mozilla.org":
- // update rdf not found
- case "bug324121_4@tests.mozilla.org":
- // toolkit id incompatible update available
- case "bug324121_7@tests.mozilla.org":
- // update rdf not found
- case "bug324121_8@tests.mozilla.org":
- break;
-
- // Updates available
- case "bug324121_2@tests.mozilla.org":
- case "bug324121_6@tests.mozilla.org":
- do_throw("Should be an update available for " + aAddon.id);
- break;
-
- default:
- do_throw("Update check for unknown " + aAddon.id);
- }
-
- // pos should always be >= 0 so just let this throw if this fails
- var pos = gItemsNotChecked.indexOf(aAddon.id);
- gItemsNotChecked.splice(pos, 1);
- },
-
- onUpdateFinished: function onUpdateFinished(aAddon) {
- if (--this.pendingCount == 0)
- test_complete();
- }
-};
-
-function run_test() {
- do_test_pending();
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
-
- const dataDir = do_get_file("data");
-
- // Create and configure the HTTP server.
- testserver = new HttpServer();
- testserver.registerDirectory("/data/", dataDir);
- testserver.start(4444);
-
- startupManager();
-
- installAllFiles(ADDONS.map(a => do_get_addon(a.addon)), function() {
- restartManager();
- AddonManager.getAddonByID(ADDONS[0].id, callback_soon(function(firstAddon) {
- do_check_true(firstAddon);
- firstAddon.userDisabled = true;
- restartManager();
-
- AddonManager.getAddonsByTypes(["extension"], function(installedItems) {
- var items = [];
-
- for (let addon of ADDONS) {
- for (let installedItem of installedItems) {
- if (addon.id != installedItem.id)
- continue;
- if (installedItem.userDisabled)
- continue;
-
- if (addon.shouldCheck == installedItem.isCompatibleWith("3", "3")) {
- do_throw(installedItem.id + " had the wrong compatibility: " +
- installedItem.isCompatibleWith("3", "3"));
- }
-
- if (addon.shouldCheck) {
- gItemsNotChecked.push(addon.id);
- updateListener.pendingCount++;
- installedItem.findUpdates(updateListener,
- AddonManager.UPDATE_WHEN_USER_REQUESTED,
- "3", "3");
- }
- }
- }
- });
- }));
- });
-}
-
-function test_complete() {
- do_check_eq(gItemsNotChecked.length, 0);
- testserver.stop(do_test_finished);
-}