summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-18 08:24:24 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-18 08:24:24 +0200
commitfc61780b35af913801d72086456f493f63197da6 (patch)
treef85891288a7bd988da9f0f15ae64e5c63f00d493 /toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
parent69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff)
parent50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff)
downloadUXP-2018.07.18.tar
UXP-2018.07.18.tar.gz
UXP-2018.07.18.tar.lz
UXP-2018.07.18.tar.xz
UXP-2018.07.18.zip
Merge commit '50d3e596bbe89c95615f96eb71f6bc5be737a1db' into Basilisk-releasev2018.07.18
# Conflicts: # browser/app/profile/firefox.js # browser/components/preferences/jar.mn
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js')
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js184
1 files changed, 0 insertions, 184 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js b/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
deleted file mode 100644
index 6043b1792..000000000
--- a/toolkit/mozapps/extensions/test/xpcshell/test_update_compatmode.js
+++ /dev/null
@@ -1,184 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// This verifies that add-on update check correctly fills in the
-// %COMPATIBILITY_MODE% token in the update URL.
-
-
-// The test extension uses an insecure update url.
-Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
-
-Components.utils.import("resource://testing-common/httpd.js");
-var testserver = new HttpServer();
-testserver.start(-1);
-gPort = testserver.identity.primaryPort;
-mapFile("/data/test_updatecompatmode_ignore.rdf", testserver);
-mapFile("/data/test_updatecompatmode_normal.rdf", testserver);
-mapFile("/data/test_updatecompatmode_strict.rdf", testserver);
-testserver.registerDirectory("/addons/", do_get_file("addons"));
-
-const profileDir = gProfD.clone();
-profileDir.append("extensions");
-
-function run_test() {
- do_test_pending();
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
-
- writeInstallRDFForExtension({
- id: "compatmode-normal@tests.mozilla.org",
- version: "1.0",
- updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.rdf",
- targetApplications: [{
- id: "xpcshell@tests.mozilla.org",
- minVersion: "1",
- maxVersion: "1"
- }],
- name: "Test Addon - normal"
- }, profileDir);
-
- writeInstallRDFForExtension({
- id: "compatmode-strict@tests.mozilla.org",
- version: "1.0",
- updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.rdf",
- targetApplications: [{
- id: "xpcshell@tests.mozilla.org",
- minVersion: "1",
- maxVersion: "1"
- }],
- name: "Test Addon - strict"
- }, profileDir);
-
- writeInstallRDFForExtension({
- id: "compatmode-strict-optin@tests.mozilla.org",
- version: "1.0",
- updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.rdf",
- targetApplications: [{
- id: "xpcshell@tests.mozilla.org",
- minVersion: "1",
- maxVersion: "1"
- }],
- name: "Test Addon - strict opt-in",
- strictCompatibility: true
- }, profileDir);
-
- writeInstallRDFForExtension({
- id: "compatmode-ignore@tests.mozilla.org",
- version: "1.0",
- updateURL: "http://localhost:" + gPort + "/data/test_updatecompatmode_%COMPATIBILITY_MODE%.rdf",
- targetApplications: [{
- id: "xpcshell@tests.mozilla.org",
- minVersion: "1",
- maxVersion: "1"
- }],
- name: "Test Addon - ignore",
- }, profileDir);
-
- startupManager();
- run_test_1();
-}
-
-function end_test() {
- testserver.stop(do_test_finished);
-}
-
-
-// Strict compatibility checking disabled.
-function run_test_1() {
- do_print("Testing with strict compatibility checking disabled");
- Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
- AddonManager.getAddonByID("compatmode-normal@tests.mozilla.org", function(addon) {
- do_check_neq(addon, null);
- addon.findUpdates({
- onCompatibilityUpdateAvailable: function() {
- do_throw("Should have not have seen compatibility information");
- },
-
- onNoUpdateAvailable: function() {
- do_throw("Should have seen an available update");
- },
-
- onUpdateAvailable: function(addon, install) {
- do_check_eq(install.version, "2.0")
- },
-
- onUpdateFinished: function() {
- run_test_2();
- }
- }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
- });
-}
-
-// Strict compatibility checking enabled.
-function run_test_2() {
- do_print("Testing with strict compatibility checking enabled");
- Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, true);
- AddonManager.getAddonByID("compatmode-strict@tests.mozilla.org", function(addon) {
- do_check_neq(addon, null);
- addon.findUpdates({
- onCompatibilityUpdateAvailable: function() {
- do_throw("Should have not have seen compatibility information");
- },
-
- onNoUpdateAvailable: function() {
- do_throw("Should have seen an available update");
- },
-
- onUpdateAvailable: function(addon, install) {
- do_check_eq(install.version, "2.0")
- },
-
- onUpdateFinished: function() {
- run_test_3();
- }
- }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
- });
-}
-
-// Strict compatibility checking opt-in.
-function run_test_3() {
- do_print("Testing with strict compatibility disabled, but addon opt-in");
- Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
- AddonManager.getAddonByID("compatmode-strict-optin@tests.mozilla.org", function(addon) {
- do_check_neq(addon, null);
- addon.findUpdates({
- onCompatibilityUpdateAvailable: function() {
- do_throw("Should have not have seen compatibility information");
- },
-
- onUpdateAvailable: function(addon, install) {
- do_throw("Should not have seen an available update");
- },
-
- onUpdateFinished: function() {
- run_test_4();
- }
- }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
- });
-}
-
-// Compatibility checking disabled.
-function run_test_4() {
- do_print("Testing with all compatibility checking disabled");
- AddonManager.checkCompatibility = false;
- AddonManager.getAddonByID("compatmode-ignore@tests.mozilla.org", function(addon) {
- do_check_neq(addon, null);
- addon.findUpdates({
- onCompatibilityUpdateAvailable: function() {
- do_throw("Should have not have seen compatibility information");
- },
-
- onNoUpdateAvailable: function() {
- do_throw("Should have seen an available update");
- },
-
- onUpdateAvailable: function(addon, install) {
- do_check_eq(install.version, "2.0")
- },
-
- onUpdateFinished: function() {
- end_test();
- }
- }, AddonManager.UPDATE_WHEN_USER_REQUESTED);
- });
-}