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 772455 effb420053178be1c494bb3ad739db8ab35806cd
parent 772454 e3db16f7479d4a56de8b8657cc43d272a1a08816
child 772456 6510c8088471a654866cf728a49325932e8867ab
push id103918
push usermaglione.k@gmail.com
push dateMon, 26 Mar 2018 06:33:35 +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();
   });
 }