Bug 1447903: Part 12 - Update test_update.js to use only bootstrapped extensions. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Wed, 21 Mar 2018 22:36:13 -0700
changeset 772383 84b3283d06449676e5ddb1f112a6cacc05380142
parent 772382 07a4c48cadea3d58224f7bace72d1668779d3d31
child 772384 ac7872ed8fc020744225c9113ceac24ad36924ff
push id103897
push usermaglione.k@gmail.com
push dateMon, 26 Mar 2018 01:31:53 +0000
reviewersaswan
bugs1447903
milestone61.0a1
Bug 1447903: Part 12 - Update test_update.js to use only bootstrapped extensions. r?aswan MozReview-Commit-ID: GHOPj0pV6Tt
toolkit/mozapps/extensions/test/xpcshell/head_addons.js
toolkit/mozapps/extensions/test/xpcshell/test_upgrade.js
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -77,17 +77,16 @@ const LEGACY_NON_RESTARTLESS_TESTS = new
   "test_bug455906.js",
   "test_bug470377_1.js",
   "test_bug470377_2.js",
   "test_bug470377_3.js",
   "test_bug470377_4.js",
   "test_bug655254.js",
   "test_signed_verify.js",
   "test_syncGUID.js",
-  "test_upgrade.js",
 ]);
 
 if (LEGACY_NON_RESTARTLESS_TESTS.has(_TEST_FILE[0].replace(/.*\//, ""))) {
   Services.prefs.setBoolPref("extensions.legacy.non-restartless.enabled", true);
 }
 
 const {
   awaitPromise,
--- a/toolkit/mozapps/extensions/test/xpcshell/test_upgrade.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_upgrade.js
@@ -23,59 +23,63 @@ var gInstallTime = Date.now();
 
 function run_test() {
   createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 
   // Will be compatible in the first version and incompatible in subsequent versions
   writeInstallRDFForExtension({
     id: "addon1@tests.mozilla.org",
     version: "1.0",
+    bootstrap: true,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon 1",
     targetPlatforms: [
       "XPCShell",
       "WINNT_x86",
     ]
   }, profileDir);
 
   // Works in all tested versions
   writeInstallRDFForExtension({
     id: "addon2@tests.mozilla.org",
     version: "1.0",
+    bootstrap: true,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "2"
     }],
     name: "Test Addon 2",
     targetPlatforms: [
       "XPCShell_noarch-spidermonkey"
     ]
   }, profileDir);
 
   // Will be disabled in the first version and enabled in the second.
   writeInstallRDFForExtension({
     id: "addon3@tests.mozilla.org",
     version: "1.0",
+    bootstrap: true,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "2",
       maxVersion: "2"
     }],
     name: "Test Addon 3",
   }, profileDir);
 
   // Will be compatible in both versions but will change version in between
   var dest = writeInstallRDFForExtension({
     id: "addon4@tests.mozilla.org",
     version: "1.0",
+    bootstrap: true,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "1",
       maxVersion: "1"
     }],
     name: "Test Addon 4",
   }, globalDir);
   setExtensionModifiedTime(dest, gInstallTime);
@@ -101,38 +105,39 @@ async function run_test_1() {
 
   AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
                                "addon2@tests.mozilla.org",
                                "addon3@tests.mozilla.org",
                                "addon4@tests.mozilla.org"],
                                function([a1, a2, a3, a4]) {
 
     Assert.notEqual(a1, null);
-    Assert.ok(isExtensionInAddonsList(profileDir, a1.id));
+    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
 
     Assert.notEqual(a2, null);
-    Assert.ok(isExtensionInAddonsList(profileDir, a2.id));
+    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
 
     Assert.notEqual(a3, null);
-    Assert.ok(!isExtensionInAddonsList(profileDir, a3.id));
+    Assert.ok(!isExtensionInBootstrappedList(profileDir, a3.id));
 
     Assert.notEqual(a4, null);
-    Assert.ok(isExtensionInAddonsList(globalDir, a4.id));
+    Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
     Assert.equal(a4.version, "1.0");
 
     executeSoon(run_test_2);
   });
 }
 
 // Test that upgrading the application doesn't disable now incompatible add-ons
 async function run_test_2() {
   // Upgrade the extension
   var dest = writeInstallRDFForExtension({
     id: "addon4@tests.mozilla.org",
     version: "2.0",
+    bootstrap: true,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "2",
       maxVersion: "2"
     }],
     name: "Test Addon 4",
   }, globalDir);
   setExtensionModifiedTime(dest, gInstallTime);
@@ -140,38 +145,39 @@ async function run_test_2() {
   await promiseRestartManager("2");
   AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
                                "addon2@tests.mozilla.org",
                                "addon3@tests.mozilla.org",
                                "addon4@tests.mozilla.org"],
                                function([a1, a2, a3, a4]) {
 
     Assert.notEqual(a1, null);
-    Assert.ok(isExtensionInAddonsList(profileDir, a1.id));
+    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
 
     Assert.notEqual(a2, null);
-    Assert.ok(isExtensionInAddonsList(profileDir, a2.id));
+    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
 
     Assert.notEqual(a3, null);
-    Assert.ok(isExtensionInAddonsList(profileDir, a3.id));
+    Assert.ok(isExtensionInBootstrappedList(profileDir, a3.id));
 
     Assert.notEqual(a4, null);
-    Assert.ok(isExtensionInAddonsList(globalDir, a4.id));
+    Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
     Assert.equal(a4.version, "2.0");
 
     executeSoon(run_test_3);
   });
 }
 
 // Test that nothing changes when only the build ID changes.
 function run_test_3() {
   // Upgrade the extension
   var dest = writeInstallRDFForExtension({
     id: "addon4@tests.mozilla.org",
     version: "3.0",
+    bootstrap: true,
     targetApplications: [{
       id: "xpcshell@tests.mozilla.org",
       minVersion: "3",
       maxVersion: "3"
     }],
     name: "Test Addon 4",
   }, globalDir);
   setExtensionModifiedTime(dest, gInstallTime);
@@ -183,23 +189,23 @@ function run_test_3() {
 
   AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
                                "addon2@tests.mozilla.org",
                                "addon3@tests.mozilla.org",
                                "addon4@tests.mozilla.org"],
                                function([a1, a2, a3, a4]) {
 
     Assert.notEqual(a1, null);
-    Assert.ok(isExtensionInAddonsList(profileDir, a1.id));
+    Assert.ok(isExtensionInBootstrappedList(profileDir, a1.id));
 
     Assert.notEqual(a2, null);
-    Assert.ok(isExtensionInAddonsList(profileDir, a2.id));
+    Assert.ok(isExtensionInBootstrappedList(profileDir, a2.id));
 
     Assert.notEqual(a3, null);
-    Assert.ok(isExtensionInAddonsList(profileDir, a3.id));
+    Assert.ok(isExtensionInBootstrappedList(profileDir, a3.id));
 
     Assert.notEqual(a4, null);
-    Assert.ok(isExtensionInAddonsList(globalDir, a4.id));
+    Assert.ok(isExtensionInBootstrappedList(globalDir, a4.id));
     Assert.equal(a4.version, "2.0");
 
     end_test();
   });
 }