Bug 1449255: Part 12a - Rename test_bug953156 to test_bootstrapped_chrome_manifest.js and modernize. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Tue, 27 Mar 2018 15:46:16 -0700
changeset 773480 e84d17c68fe3d61518d700be78df6e41d0b41366
parent 773479 134012be602aabe87fc048b33a2b62dc5d1233ab
child 773481 afbe49beeaf17097267e4349ffdb2ccc835d1082
push id104243
push usermaglione.k@gmail.com
push dateWed, 28 Mar 2018 00:15:32 +0000
reviewersaswan
bugs1449255, 953156
milestone61.0a1
Bug 1449255: Part 12a - Rename test_bug953156 to test_bootstrapped_chrome_manifest.js and modernize. r?aswan MozReview-Commit-ID: HU1bBCTD207
toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js
toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
rename from toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js
rename to toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug953156.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrapped_chrome_manifest.js
@@ -1,51 +1,45 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
-function run_test() {
-  do_test_pending();
-  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
-  startupManager();
-
-  prepare_test({ }, [
-    "onNewInstall"
-  ]);
-
-  AddonManager.getInstallForFile(do_get_addon("test_bug675371"), function(install) {
-    ensure_test_completed();
-
-    Assert.notEqual(install, null);
+const ADDON = {
+  "install.rdf": {
+    "id": "bug675371@tests.mozilla.org",
+    "version": "1.0",
+    "bootstrap": "true",
+    "name": "Bug 675371 Test",
+    "description": "Test Description",
+    "targetApplications": [
+      {
+        "id": "xpcshell@tests.mozilla.org",
+        "minVersion": "1",
+        "maxVersion": "1"
+      }
+    ]
+  },
+  "chrome.manifest": `content bug675371 .`,
+  "test.js": `var active = true;`,
+};
 
-    prepare_test({
-      "bug675371@tests.mozilla.org": [
-        ["onInstalling", false],
-        "onInstalled"
-      ]
-    }, [
-      "onInstallStarted",
-      "onInstallEnded"
-    ], callback_soon(check_test));
-    install.install();
-  });
-}
+add_task(async function run_test() {
+  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
+  await promiseStartupManager();
+});
+
+add_task(async function test() {
+  let {addon} = await AddonTestUtils.promiseInstallXPI(ADDON);
+
+  Assert.ok(addon.isActive);
 
-function check_test() {
-  AddonManager.getAddonByID("bug675371@tests.mozilla.org", do_exception_wrap(function(addon) {
-    Assert.notEqual(addon, null);
-    Assert.ok(addon.isActive);
-
-    // Tests that chrome.manifest is registered when the addon is installed.
-    var target = { active: false };
-    Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target);
-    Assert.ok(target.active);
+  // Tests that chrome.manifest is registered when the addon is installed.
+  var target = { active: false };
+  Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target);
+  Assert.ok(target.active);
 
-    shutdownManager();
+  await promiseShutdownManager();
 
-    // Tests that chrome.manifest remains registered at app shutdown.
-    target.active = false;
-    Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target);
-    Assert.ok(target.active);
-
-    executeSoon(do_test_finished);
-  }));
-}
+  // Tests that chrome.manifest remains registered at app shutdown.
+  target.active = false;
+  Services.scriptloader.loadSubScript("chrome://bug675371/content/test.js", target);
+  Assert.ok(target.active);
+});
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -64,16 +64,17 @@ tags = blocklist
 [test_blocklistchange.js]
 # Times out during parallel runs on desktop
 requesttimeoutfactor = 2
 tags = blocklist
 [test_bootstrap.js]
 skip-if = true # Bug 1358846 Bug 1365021 Bug 676992
 [test_bootstrap_const.js]
 [test_bootstrap_globals.js]
+[test_bootstrapped_chrome_manifest.js]
 [test_bug1180901_2.js]
 skip-if = os != "win"
 [test_bug514327_2.js]
 # Bug 676992: test consistently hangs on Android
 skip-if = os == "android"
 tags = blocklist
 [test_bug521905.js]
 [test_bug566626.js]
@@ -91,17 +92,16 @@ fail-if = os == "android"
 tags = blocklist
 [test_bug620837.js]
 tags = blocklist
 [test_bug655254.js]
 [test_bug675371.js]
 [test_bug740612.js]
 [test_bug753900.js]
 [test_bug757663.js]
-[test_bug953156.js]
 [test_cache_certdb.js]
 run-if = addon_signing
 [test_cacheflush.js]
 [test_childprocess.js]
 [test_compatoverrides.js]
 [test_corrupt.js]
 [test_corruptfile.js]
 [test_db_path.js]