diff options
author | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:49:12 -0500 |
---|---|---|
committer | Matt A. Tobin <email@mattatobin.com> | 2018-02-10 02:49:12 -0500 |
commit | 4fb11cd5966461bccc3ed1599b808237be6b0de9 (patch) | |
tree | d7f0ccd49cebb3544d52635ff1bd6ed4d763823f /toolkit/mozapps/extensions/test/xpcshell/test_schema_change.js | |
parent | f164d9124708b50789dbb6959e1de96cc5697c48 (diff) | |
download | UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.gz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.lz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.tar.xz UXP-4fb11cd5966461bccc3ed1599b808237be6b0de9.zip |
Move WebExtensions enabled Add-ons Manager
Diffstat (limited to 'toolkit/mozapps/extensions/test/xpcshell/test_schema_change.js')
-rw-r--r-- | toolkit/mozapps/extensions/test/xpcshell/test_schema_change.js | 317 |
1 files changed, 0 insertions, 317 deletions
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_schema_change.js b/toolkit/mozapps/extensions/test/xpcshell/test_schema_change.js deleted file mode 100644 index 3d386f663..000000000 --- a/toolkit/mozapps/extensions/test/xpcshell/test_schema_change.js +++ /dev/null @@ -1,317 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ - */ - -BootstrapMonitor.init(); - -const PREF_DB_SCHEMA = "extensions.databaseSchema"; - -const profileDir = gProfD.clone(); -profileDir.append("extensions"); - -createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "49"); -startupManager(); - -/** - * Schema change with no application update reloads metadata. - */ -add_task(function* schema_change() { - const ID = "schema-change@tests.mozilla.org"; - - let xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on", - version: "1.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1.9.2" - }] - }); - - yield promiseInstallAllFiles([xpiFile]); - - let addon = yield promiseAddonByID(ID); - - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "1.0", "Got the expected version"); - - yield shutdownManager(); - - xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on 2", - version: "2.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1.9.2" - }] - }); - - Services.prefs.setIntPref(PREF_DB_SCHEMA, 0); - - let file = profileDir.clone(); - file.append(`${ID}.xpi`); - - // Make sure the timestamp is unchanged, so it is not re-scanned for that reason. - let timestamp = file.lastModifiedTime; - xpiFile.moveTo(profileDir, `${ID}.xpi`); - - file.lastModifiedTime = timestamp; - - yield startupManager(); - - addon = yield promiseAddonByID(ID); - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "2.0", "Got the expected version"); - - let waitUninstall = promiseAddonEvent("onUninstalled"); - addon.uninstall(); - yield waitUninstall; -}); - -/** - * Application update with no schema change does not reload metadata. - */ -add_task(function* schema_change() { - const ID = "schema-change@tests.mozilla.org"; - - let xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on", - version: "1.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "2" - }] - }); - - yield promiseInstallAllFiles([xpiFile]); - - let addon = yield promiseAddonByID(ID); - - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "1.0", "Got the expected version"); - - yield shutdownManager(); - - xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on 2", - version: "2.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "2" - }] - }); - - gAppInfo.version = "2"; - let file = profileDir.clone(); - file.append(`${ID}.xpi`); - - // Make sure the timestamp is unchanged, so it is not re-scanned for that reason. - let timestamp = file.lastModifiedTime; - xpiFile.moveTo(profileDir, `${ID}.xpi`); - - file.lastModifiedTime = timestamp; - - yield startupManager(); - - addon = yield promiseAddonByID(ID); - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "1.0", "Got the expected version"); - - let waitUninstall = promiseAddonEvent("onUninstalled"); - addon.uninstall(); - yield waitUninstall; -}); - -/** - * App update and a schema change causes a reload of the manifest. - */ -add_task(function* schema_change_app_update() { - const ID = "schema-change@tests.mozilla.org"; - - let xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on", - version: "1.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }); - - yield promiseInstallAllFiles([xpiFile]); - - let addon = yield promiseAddonByID(ID); - - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "1.0", "Got the expected version"); - - yield shutdownManager(); - - xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on 2", - version: "2.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "3" - }] - }); - - gAppInfo.version = "3"; - Services.prefs.setIntPref(PREF_DB_SCHEMA, 0); - - let file = profileDir.clone(); - file.append(`${ID}.xpi`); - - // Make sure the timestamp is unchanged, so it is not re-scanned for that reason. - let timestamp = file.lastModifiedTime; - xpiFile.moveTo(profileDir, `${ID}.xpi`); - - file.lastModifiedTime = timestamp; - - yield startupManager(); - - addon = yield promiseAddonByID(ID); - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.appDisabled, false); - equal(addon.version, "2.0", "Got the expected version"); - - let waitUninstall = promiseAddonEvent("onUninstalled"); - addon.uninstall(); - yield waitUninstall; -}); - -/** - * No schema change, no manifest reload. - */ -add_task(function* schema_change() { - const ID = "schema-change@tests.mozilla.org"; - - let xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on", - version: "1.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1.9.2" - }] - }); - - yield promiseInstallAllFiles([xpiFile]); - - let addon = yield promiseAddonByID(ID); - - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "1.0", "Got the expected version"); - - yield shutdownManager(); - - xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on 2", - version: "2.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1.9.2" - }] - }); - - let file = profileDir.clone(); - file.append(`${ID}.xpi`); - - // Make sure the timestamp is unchanged, so it is not re-scanned for that reason. - let timestamp = file.lastModifiedTime; - xpiFile.moveTo(profileDir, `${ID}.xpi`); - - file.lastModifiedTime = timestamp; - - yield startupManager(); - - addon = yield promiseAddonByID(ID); - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "1.0", "Got the expected version"); - - let waitUninstall = promiseAddonEvent("onUninstalled"); - addon.uninstall(); - yield waitUninstall; -}); - -/** - * Modified timestamp on the XPI causes a reload of the manifest. - */ -add_task(function* schema_change() { - const ID = "schema-change@tests.mozilla.org"; - - let xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on", - version: "1.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1.9.2" - }] - }); - - yield promiseInstallAllFiles([xpiFile]); - - let addon = yield promiseAddonByID(ID); - - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "1.0", "Got the expected version"); - - yield shutdownManager(); - - xpiFile = createTempXPIFile({ - id: ID, - name: "Test Add-on 2", - version: "2.0", - bootstrap: true, - targetApplications: [{ - id: "xpcshell@tests.mozilla.org", - minVersion: "1", - maxVersion: "1.9.2" - }] - }); - - xpiFile.moveTo(profileDir, `${ID}.xpi`); - - let file = profileDir.clone(); - file.append(`${ID}.xpi`); - - // Set timestamp in the future so manifest is re-scanned. - let timestamp = new Date(Date.now() + 60000); - xpiFile.moveTo(profileDir, `${ID}.xpi`); - - file.lastModifiedTime = timestamp; - - yield startupManager(); - - addon = yield promiseAddonByID(ID); - notEqual(addon, null, "Got an addon object as expected"); - equal(addon.version, "2.0", "Got the expected version"); - - let waitUninstall = promiseAddonEvent("onUninstalled"); - addon.uninstall(); - yield waitUninstall; -}); |