summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/webextensions/test/xpcshell/test_ext_management.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/webextensions/test/xpcshell/test_ext_management.js
parent69f7f9e5f1475891ce11cc4f431692f965b0cd30 (diff)
parent50d3e596bbe89c95615f96eb71f6bc5be737a1db (diff)
downloadUXP-fc61780b35af913801d72086456f493f63197da6.tar
UXP-fc61780b35af913801d72086456f493f63197da6.tar.gz
UXP-fc61780b35af913801d72086456f493f63197da6.tar.lz
UXP-fc61780b35af913801d72086456f493f63197da6.tar.xz
UXP-fc61780b35af913801d72086456f493f63197da6.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/webextensions/test/xpcshell/test_ext_management.js')
-rw-r--r--toolkit/mozapps/webextensions/test/xpcshell/test_ext_management.js137
1 files changed, 0 insertions, 137 deletions
diff --git a/toolkit/mozapps/webextensions/test/xpcshell/test_ext_management.js b/toolkit/mozapps/webextensions/test/xpcshell/test_ext_management.js
deleted file mode 100644
index a3b3f477c..000000000
--- a/toolkit/mozapps/webextensions/test/xpcshell/test_ext_management.js
+++ /dev/null
@@ -1,137 +0,0 @@
-"use strict";
-
-add_task(function* setup() {
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "48", "48");
- startupManager();
-});
-
-/* eslint-disable no-undef */
-// Shared background function for getSelf tests
-function backgroundGetSelf() {
- browser.management.getSelf().then(extInfo => {
- browser.test.sendMessage("management-getSelf", extInfo);
- }, error => {
- browser.test.notifyFail(`getSelf rejected with error: ${error}`);
- });
-}
-/* eslint-enable no-undef */
-
-add_task(function* test_management_get_self_complete() {
- const id = "get_self_test_complete@tests.mozilla.com";
- const permissions = ["management", "cookies"];
- const hostPermissions = ["*://example.org/", "https://foo.example.org/"];
-
- let manifest = {
- applications: {
- gecko: {
- id,
- update_url: "https://updates.mozilla.com/",
- },
- },
- name: "test extension name",
- short_name: "test extension short name",
- description: "test extension description",
- version: "1.0",
- homepage_url: "http://www.example.com/",
- options_ui: {
- "page": "get_self_options.html",
- },
- icons: {
- "16": "icons/icon-16.png",
- "48": "icons/icon-48.png",
- },
- permissions: [...permissions, ...hostPermissions],
- };
-
- let extension = ExtensionTestUtils.loadExtension({
- manifest,
- background: backgroundGetSelf,
- useAddonManager: "temporary",
- });
- yield extension.startup();
- let extInfo = yield extension.awaitMessage("management-getSelf");
-
- equal(extInfo.id, id, "getSelf returned the expected id");
- equal(extInfo.installType, "development", "getSelf returned the expected installType");
- for (let prop of ["name", "description", "version"]) {
- equal(extInfo[prop], manifest[prop], `getSelf returned the expected ${prop}`);
- }
- equal(extInfo.shortName, manifest.short_name, "getSelf returned the expected shortName");
- equal(extInfo.mayDisable, true, "getSelf returned the expected value for mayDisable");
- equal(extInfo.enabled, true, "getSelf returned the expected value for enabled");
- equal(extInfo.homepageUrl, manifest.homepage_url, "getSelf returned the expected homepageUrl");
- equal(extInfo.updateUrl, manifest.applications.gecko.update_url, "getSelf returned the expected updateUrl");
- ok(extInfo.optionsUrl.endsWith(manifest.options_ui.page), "getSelf returned the expected optionsUrl");
- for (let [index, size] of Object.keys(manifest.icons).sort().entries()) {
- equal(extInfo.icons[index].size, +size, "getSelf returned the expected icon size");
- equal(extInfo.icons[index].url, manifest.icons[size], "getSelf returned the expected icon url");
- }
- deepEqual(extInfo.permissions.sort(), permissions.sort(), "getSelf returned the expected permissions");
- deepEqual(extInfo.hostPermissions.sort(), hostPermissions.sort(), "getSelf returned the expected hostPermissions");
- equal(extInfo.installType, "development", "getSelf returned the expected installType");
- yield extension.unload();
-});
-
-add_task(function* test_management_get_self_minimal() {
- const id = "get_self_test_minimal@tests.mozilla.com";
-
- let manifest = {
- applications: {
- gecko: {
- id,
- },
- },
- name: "test extension name",
- version: "1.0",
- };
-
- let extension = ExtensionTestUtils.loadExtension({
- manifest,
- background: backgroundGetSelf,
- useAddonManager: "temporary",
- });
- yield extension.startup();
- let extInfo = yield extension.awaitMessage("management-getSelf");
-
- equal(extInfo.id, id, "getSelf returned the expected id");
- equal(extInfo.installType, "development", "getSelf returned the expected installType");
- for (let prop of ["name", "version"]) {
- equal(extInfo[prop], manifest[prop], `getSelf returned the expected ${prop}`);
- }
- for (let prop of ["shortName", "description", "optionsUrl"]) {
- equal(extInfo[prop], "", `getSelf returned the expected ${prop}`);
- }
- for (let prop of ["homepageUrl", " updateUrl", "icons"]) {
- equal(Reflect.getOwnPropertyDescriptor(extInfo, prop), undefined, `getSelf did not return a ${prop} property`);
- }
- for (let prop of ["permissions", "hostPermissions"]) {
- deepEqual(extInfo[prop], [], `getSelf returned the expected ${prop}`);
- }
- yield extension.unload();
-});
-
-add_task(function* test_management_get_self_permanent() {
- const id = "get_self_test_permanent@tests.mozilla.com";
-
- let manifest = {
- applications: {
- gecko: {
- id,
- },
- },
- name: "test extension name",
- version: "1.0",
- };
-
- let extension = ExtensionTestUtils.loadExtension({
- manifest,
- background: backgroundGetSelf,
- useAddonManager: "permanent",
- });
- yield extension.startup();
- let extInfo = yield extension.awaitMessage("management-getSelf");
-
- equal(extInfo.id, id, "getSelf returned the expected id");
- equal(extInfo.installType, "normal", "getSelf returned the expected installType");
- yield extension.unload();
-});