Bug 1438255 Part 2 Convert sync addon unit tests to use webextensions r=tcsc
authorAndrew Swan <aswan@mozilla.com>
Wed, 24 Oct 2018 13:26:06 -0700
changeset 499864 0af4e03a28324571a26eb755a769c2f326533788
parent 499863 63520174c8a5ec18cb71cf9c0ebaee790dfd5323
child 499865 fc21376e28da2879eb57bfe6f9077f8ee74a80ce
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstcsc
bugs1438255
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1438255 Part 2 Convert sync addon unit tests to use webextensions r=tcsc This isn't strictly part of removing support for non-restartless extensions, but it ensures that sync is testing with the types of extensions that people are really using these days. Differential Revision: https://phabricator.services.mozilla.com/D10111
services/sync/tests/unit/head_helpers.js
services/sync/tests/unit/test_addons_engine.js
services/sync/tests/unit/test_addons_reconciler.js
services/sync/tests/unit/test_addons_store.js
services/sync/tests/unit/test_addons_tracker.js
--- a/services/sync/tests/unit/head_helpers.js
+++ b/services/sync/tests/unit/head_helpers.js
@@ -102,26 +102,17 @@ function loadWebExtensionTestFunctions()
 }
 
 /**
  * Installs an add-on from an addonInstall
  *
  * @param  install addonInstall instance to install
  */
 async function installAddonFromInstall(install) {
-  await new Promise(res => {
-    let listener = {
-      onInstallEnded() {
-        AddonManager.removeAddonListener(listener);
-        res();
-      },
-    };
-    AddonManager.addInstallListener(listener);
-    install.install();
-  });
+  await install.install();
 
   Assert.notEqual(null, install.addon);
   Assert.notEqual(null, install.addon.syncGUID);
 
   return install.addon;
 }
 
 /**
--- a/services/sync/tests/unit/test_addons_engine.js
+++ b/services/sync/tests/unit/test_addons_engine.js
@@ -1,15 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
-ChromeUtils.import("resource://gre/modules/Preferences.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://services-common/async.js");
 ChromeUtils.import("resource://services-sync/addonsreconciler.js");
 ChromeUtils.import("resource://services-sync/engines/addons.js");
 ChromeUtils.import("resource://services-sync/service.js");
 ChromeUtils.import("resource://services-sync/util.js");
 ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");
 ChromeUtils.defineModuleGetter(this, "Preferences", "resource://gre/modules/Preferences.jsm");
@@ -21,58 +20,24 @@ prefs.set("extensions.install.requireSec
 
 let engine;
 let syncID;
 let reconciler;
 let tracker;
 
 AddonTestUtils.init(this);
 
-const ADDONS = {
-  test_install1: {
-    "install.rdf": {
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      name: "Test 1",
-      description: "Test Description",
-      bootstrap: true,
-
-      targetApplications: [{
-          id: "xpcshell@tests.mozilla.org",
-          minVersion: "1",
-          maxVersion: "1"}],
-    },
-    "icon.png": "Fake icon image",
-    "icon64.png": "Fake icon image",
+const ADDON_ID = "addon1@tests.mozilla.org";
+const XPI = AddonTestUtils.createTempWebExtensionFile({
+  manifest: {
+    name: "Test 1",
+    description: "Test Description",
+    applications: { gecko: { id: ADDON_ID } },
   },
-  test_bootstrap1_1: {
-    "install.rdf": {
-      id: "bootstrap1@tests.mozilla.org",
-      version: "1.0",
-      bootstrap: "true",
-      multiprocessCompatible: "true",
-      name: "Test Bootstrap 1",
-      description: "Test Description",
-
-      iconURL: "chrome://foo/skin/icon.png",
-      aboutURL: "chrome://foo/content/about.xul",
-      optionsURL: "chrome://foo/content/options.xul",
-
-      targetApplications: [{
-          id: "xpcshell@tests.mozilla.org",
-          minVersion: "1",
-          maxVersion: "1"}],
-    },
-  },
-};
-
-const XPIS = {};
-for (let [name, files] of Object.entries(ADDONS)) {
-  XPIS[name] = AddonTestUtils.createTempXPIFile(files);
-}
+});
 
 async function resetReconciler() {
   reconciler._addons = {};
   reconciler._changes = [];
 
   await reconciler.saveState();
 
   await tracker.clearChangedIDs();
@@ -98,36 +63,36 @@ add_task(async function setup() {
   await resetReconciler();
 });
 
 // This is a basic sanity test for the unit test itself. If this breaks, the
 // add-ons API likely changed upstream.
 add_task(async function test_addon_install() {
   _("Ensure basic add-on APIs work as expected.");
 
-  let install = await AddonManager.getInstallForFile(XPIS.test_bootstrap1_1);
+  let install = await AddonManager.getInstallForFile(XPI);
   Assert.notEqual(install, null);
   Assert.equal(install.type, "extension");
-  Assert.equal(install.name, "Test Bootstrap 1");
+  Assert.equal(install.name, "Test 1");
 
   await resetReconciler();
 });
 
 add_task(async function test_find_dupe() {
   _("Ensure the _findDupe() implementation is sane.");
 
   // This gets invoked at the top of sync, which is bypassed by this
   // test, so we do it manually.
   await engine._refreshReconcilerState();
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPI, reconciler);
 
   let record = {
     id:            Utils.makeGUID(),
-    addonID:       addon.id,
+    addonID:       ADDON_ID,
     enabled:       true,
     applicationID: Services.appinfo.ID,
     source:        "amo",
   };
 
   let dupe = await engine._findDupe(record);
   Assert.equal(addon.syncGUID, dupe);
 
@@ -164,17 +129,17 @@ add_task(async function test_get_changed
   Assert.equal("object", typeof(changes));
   Assert.equal(1, Object.keys(changes).length);
   Assert.ok(guid1 in changes);
   Assert.equal(changeTime, changes[guid1]);
 
   await tracker.clearChangedIDs();
 
   _("Ensure reconciler changes are populated.");
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPI, reconciler);
   await tracker.clearChangedIDs(); // Just in case.
   changes = await engine.getChangedIDs();
   Assert.equal("object", typeof(changes));
   Assert.equal(1, Object.keys(changes).length);
   Assert.ok(addon.syncGUID in changes);
   _("Change time: " + changeTime + ", addon change: " + changes[addon.syncGUID]);
   Assert.ok(changes[addon.syncGUID] >= changeTime);
 
@@ -212,17 +177,16 @@ add_task(async function test_get_changed
 add_task(async function test_disabled_install_semantics() {
   _("Ensure that syncing a disabled add-on preserves proper state.");
 
   // This is essentially a test for bug 712542, which snuck into the original
   // add-on sync drop. It ensures that when an add-on is installed that the
   // disabled state and incoming syncGUID is preserved, even on the next sync.
   const USER       = "foo";
   const PASSWORD   = "password";
-  const ADDON_ID   = "addon1@tests.mozilla.org";
 
   let server = new SyncServer();
   server.start();
   await SyncTestingInfrastructure(server, USER, PASSWORD);
 
   await generateNewKeys(Service.collectionKeys);
 
   let contents = {
@@ -233,17 +197,17 @@ add_task(async function test_disabled_in
 
   server.registerUser(USER, "password");
   server.createContents(USER, contents);
 
   let amoServer = new HttpServer();
   amoServer.registerFile("/search/guid:addon1%40tests.mozilla.org",
                          do_get_file("addon1-search.json"));
 
-  amoServer.registerFile("/addon1.xpi", XPIS.test_install1);
+  amoServer.registerFile("/addon1.xpi", XPI);
   amoServer.start(8888);
 
   // Insert an existing record into the server.
   let id = Utils.makeGUID();
   let now = Date.now() / 1000;
 
   let record = encryptPayload({
     id,
--- a/services/sync/tests/unit/test_addons_reconciler.js
+++ b/services/sync/tests/unit/test_addons_reconciler.js
@@ -10,42 +10,24 @@ ChromeUtils.import("resource://services-
 ChromeUtils.import("resource://services-sync/service.js");
 ChromeUtils.import("resource://services-sync/util.js");
 
 AddonTestUtils.init(this);
 AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 AddonTestUtils.overrideCertDB();
 AddonTestUtils.awaitPromise(AddonTestUtils.promiseStartupManager());
 
-const ADDONS = {
-  test_bootstrap1_1: {
-    "install.rdf": {
-      id: "bootstrap1@tests.mozilla.org",
-      version: "1.0",
-      bootstrap: "true",
-      multiprocessCompatible: "true",
-      name: "Test Bootstrap 1",
-      description: "Test Description",
-
-      iconURL: "chrome://foo/skin/icon.png",
-      aboutURL: "chrome://foo/content/about.xul",
-      optionsURL: "chrome://foo/content/options.xul",
-
-      targetApplications: [{
-          id: "xpcshell@tests.mozilla.org",
-          minVersion: "1",
-          maxVersion: "1"}],
-    },
+const ADDON_ID = "addon1@tests.mozilla.org";
+const XPI = AddonTestUtils.createTempWebExtensionFile({
+  manifest: {
+    name: "Test 1",
+    description: "Test Description",
+    applications: { gecko: { id: ADDON_ID } },
   },
-};
-
-const XPIS = {};
-for (let [name, files] of Object.entries(ADDONS)) {
-  XPIS[name] = AddonTestUtils.createTempXPIFile(files);
-}
+});
 
 function makeAddonsReconciler() {
   const log = Service.engineManager.get("addons")._log;
   const queueCaller = Async.asyncQueueCaller(log);
   return new AddonsReconciler(queueCaller);
 }
 
 add_task(async function setup() {
@@ -83,22 +65,22 @@ add_task(async function test_load_state_
 add_task(async function test_install_detection() {
   _("Ensure that add-on installation results in appropriate side-effects.");
 
   let reconciler = makeAddonsReconciler();
   await reconciler.ensureStateLoaded();
   reconciler.startListening();
 
   let before = new Date();
-  let addon = await installAddon(XPIS.test_bootstrap1_1);
+  let addon = await installAddon(XPI);
   let after = new Date();
 
   Assert.equal(1, Object.keys(reconciler.addons).length);
   Assert.ok(addon.id in reconciler.addons);
-  let record = reconciler.addons[addon.id];
+  let record = reconciler.addons[ADDON_ID];
 
   const KEYS = ["id", "guid", "enabled", "installed", "modified", "type",
                 "scope", "foreignInstall"];
   for (let key of KEYS) {
     Assert.ok(key in record);
     Assert.notEqual(null, record[key]);
   }
 
@@ -124,17 +106,17 @@ add_task(async function test_uninstall_d
 
   let reconciler = makeAddonsReconciler();
   await reconciler.ensureStateLoaded();
   reconciler.startListening();
 
   reconciler._addons = {};
   reconciler._changes = [];
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1);
+  let addon = await installAddon(XPI);
   let id = addon.id;
 
   reconciler._changes = [];
   await uninstallAddon(addon, reconciler);
 
   Assert.equal(1, Object.keys(reconciler.addons).length);
   Assert.ok(id in reconciler.addons);
 
--- a/services/sync/tests/unit/test_addons_store.js
+++ b/services/sync/tests/unit/test_addons_store.js
@@ -16,108 +16,124 @@ const HTTP_PORT = 8888;
 
 const prefs = new Preferences();
 
 prefs.set("extensions.getAddons.get.url", "http://localhost:8888/search/guid:%IDS%");
 // Note that all compat-override URLs currently 404, but that's OK - the main
 // thing is to avoid us hitting the real AMO.
 prefs.set("extensions.getAddons.compatOverides.url", "http://localhost:8888/compat-override/guid:%IDS%");
 prefs.set("extensions.install.requireSecureOrigin", false);
-
-const SYSTEM_ADDON_ID = "system1@tests.mozilla.org";
-let systemAddonFile;
-
-// The system add-on must be installed before AddonManager is started.
-function loadSystemAddon() {
-  let addonFilename = SYSTEM_ADDON_ID + ".xpi";
-  const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
-  do_get_file(ExtensionsTestPath("/data/system_addons/system1_1.xpi")).copyTo(distroDir, addonFilename);
-  systemAddonFile = FileUtils.File(distroDir.path);
-  systemAddonFile.append(addonFilename);
-  systemAddonFile.lastModifiedTime = Date.now();
-  // As we're not running in application, we need to setup the features directory
-  // used by system add-ons.
-  AddonTestUtils.registerDirectory("XREAppFeat", distroDir);
-}
-
-var resHandler = Services.io.getProtocolHandler("resource")
-                         .QueryInterface(Ci.nsISubstitutingProtocolHandler);
-var dataURI = NetUtil.newURI(do_get_file(ExtensionsTestPath("/data"), true));
-resHandler.setSubstitution("xpcshell-data", dataURI);
+prefs.set("extensions.checkUpdateSecurity", false);
 
 AddonTestUtils.init(this);
 AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
 AddonTestUtils.overrideCertDB();
 
 Services.prefs.setCharPref("extensions.minCompatibleAppVersion", "0");
 Services.prefs.setCharPref("extensions.minCompatiblePlatformVersion", "0");
 Services.prefs.setBoolPref("extensions.legacy.enabled", true);
 
-loadSystemAddon();
+
+const SYSTEM_ADDON_ID = "system1@tests.mozilla.org";
+add_task(async function setupSystemAddon() {
+  const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
+  AddonTestUtils.registerDirectory("XREAppFeat", distroDir);
 
-AddonTestUtils.awaitPromise(AddonTestUtils.overrideBuiltIns({ "system": [SYSTEM_ADDON_ID] }));
-AddonTestUtils.awaitPromise(AddonTestUtils.promiseStartupManager());
+  let xpi = await AddonTestUtils.createTempWebExtensionFile({
+    manifest: {
+      applications: {gecko: {id: SYSTEM_ADDON_ID}},
+    },
+  });
+
+  xpi.copyTo(distroDir, `${SYSTEM_ADDON_ID}.xpi`);
+
+  await AddonTestUtils.overrideBuiltIns({system: [SYSTEM_ADDON_ID]});
+  await AddonTestUtils.promiseStartupManager();
+});
+
+const ID1 = "addon1@tests.mozilla.org";
+const ID2 = "addon2@tests.mozilla.org";
+const ID3 = "addon3@tests.mozilla.org";
 
 const ADDONS = {
-  test_install1: {
-    "install.rdf": {
-      id: "addon1@tests.mozilla.org",
-      version: "1.0",
-      name: "Test 1",
-      description: "Test Description",
-      bootstrap: true,
-
-      targetApplications: [{
-          id: "xpcshell@tests.mozilla.org",
-          minVersion: "1",
-          maxVersion: "1"}],
-    },
-    "icon.png": "Fake icon image",
-    "icon64.png": "Fake icon image",
-  },
-  test_install3: {
-    "install.rdf": {
-      id: "addon3@tests.mozilla.org",
-      version: "1.0",
-      name: "Real Test 4",
-      description: "Test Description",
-      bootstrap: true,
-
-      updateURL: "http://example.com/data/test_install.rdf",
-
-      targetApplications: [{
-          id: "xpcshell@tests.mozilla.org",
-          minVersion: "0",
-          maxVersion: "0"}],
+  test_addon1: {
+    manifest: {
+      applications: {
+        gecko: {
+          id: ID1,
+          update_url: "http://example.com/data/test_install.json",
+        },
+      },
     },
   },
-  test_bootstrap1_1: {
-    "install.rdf": {
-      id: "bootstrap1@tests.mozilla.org",
-      version: "1.0",
-      bootstrap: "true",
-      multiprocessCompatible: "true",
-      name: "Test Bootstrap 1",
-      description: "Test Description",
+
+  test_addon2: {
+    manifest: {
+      applications: {gecko: {id: ID2}},
+    },
+  },
 
-      iconURL: "chrome://foo/skin/icon.png",
-      aboutURL: "chrome://foo/content/about.xul",
-      optionsURL: "chrome://foo/content/options.xul",
-
-      targetApplications: [{
-          id: "xpcshell@tests.mozilla.org",
-          minVersion: "1",
-          maxVersion: "1"}],
+  test_addon3: {
+    manifest: {
+      applications: {
+        gecko: {
+          id: ID3,
+          strict_max_version: "0",
+        },
+      },
     },
   },
 };
 
+const SEARCH_RESULT = {
+  next: null,
+  results: [
+    {
+      name: "Test Extension",
+      type: "extension",
+      guid: "addon1@tests.mozilla.org",
+      current_version: {
+        version: "1.0",
+        files: [
+          {
+            platform: "all",
+            size: 485,
+            url: "http://localhost:8888/addon1.xpi",
+          },
+        ],
+      },
+      last_updated: "2018-10-27T04:12:00.826Z",
+    },
+  ],
+};
+
+const MISSING_SEARCH_RESULT = {
+  next: null,
+  results: [
+    {
+      name: "Test",
+      type: "extension",
+      guid: "missing-xpi@tests.mozilla.org",
+      current_version: {
+        version: "1.0",
+        files: [
+          {
+            platform: "all",
+            size: 123,
+            url: "http://localhost:8888/THIS_DOES_NOT_EXIST.xpi",
+          },
+        ],
+      },
+    },
+  ],
+};
+
 const XPIS = {};
 for (let [name, files] of Object.entries(ADDONS)) {
-  XPIS[name] = AddonTestUtils.createTempXPIFile(files);
+  XPIS[name] = AddonTestUtils.createTempWebExtensionFile(files);
 }
 
 let engine;
 let tracker;
 let store;
 let reconciler;
 
 const proxyService = Cc["@mozilla.org/network/protocol-proxy-service;1"]
@@ -158,26 +174,25 @@ function createRecordForThisApp(id, addo
     source:        "amo",
   };
 }
 
 function createAndStartHTTPServer(port) {
   try {
     let server = new HttpServer();
 
-    server.registerFile("/search/guid:bootstrap1%40tests.mozilla.org",
-                        do_get_file("bootstrap1-search.json"));
-    server.registerFile("/bootstrap1.xpi", XPIS.test_bootstrap1_1);
-
-    server.registerFile("/search/guid:missing-xpi%40tests.mozilla.org",
-                        do_get_file("missing-xpi-search.json"));
-
-    server.registerFile("/search/guid:system1%40tests.mozilla.org",
-                        do_get_file("systemaddon-search.json"));
-    server.registerFile("/system.xpi", systemAddonFile);
+    server.registerPathHandler("/search/guid:addon1%40tests.mozilla.org", (req, resp) => {
+      resp.setHeader("Content-type", "application/json", true);
+      resp.write(JSON.stringify(SEARCH_RESULT));
+    });
+    server.registerPathHandler("/search/guid:missing-xpi%40tests.mozilla.org", (req, resp) => {
+      resp.setHeader("Content-type", "application/json", true);
+      resp.write(JSON.stringify(MISSING_SEARCH_RESULT));
+    });
+    server.registerFile("/addon1.xpi", XPIS.test_addon1);
 
     server.start(port);
 
     return server;
   } catch (ex) {
     _("Got exception starting HTTP server on port " + port);
     _("Error: " + Log.exceptionStr(ex));
     do_throw(ex);
@@ -208,156 +223,163 @@ add_task(async function setup() {
   // Don't flush to disk in the middle of an event listener!
   // This causes test hangs on WinXP.
   reconciler._shouldPersist = false;
 });
 
 add_task(async function test_remove() {
   _("Ensure removing add-ons from deleted records works.");
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
-  let record = createRecordForThisApp(addon.syncGUID, addon.id, true, true);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
+  let record = createRecordForThisApp(addon.syncGUID, ID1, true, true);
 
   let failed = await store.applyIncomingBatch([record]);
   Assert.equal(0, failed.length);
 
-  let newAddon = await AddonManager.getAddonByID(addon.id);
+  let newAddon = await AddonManager.getAddonByID(ID1);
   Assert.equal(null, newAddon);
 });
 
 add_task(async function test_apply_enabled() {
   _("Ensures that changes to the userEnabled flag apply.");
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
   Assert.ok(addon.isActive);
   Assert.ok(!addon.userDisabled);
 
   _("Ensure application of a disable record works as expected.");
   let records = [];
-  records.push(createRecordForThisApp(addon.syncGUID, addon.id, false, false));
-  let failed = await store.applyIncomingBatch(records);
+  records.push(createRecordForThisApp(addon.syncGUID, ID1, false, false));
+  let [failed] = await Promise.all([
+    store.applyIncomingBatch(records),
+    AddonTestUtils.promiseAddonEvent("onDisabled"),
+  ]);
   Assert.equal(0, failed.length);
-  addon = await AddonManager.getAddonByID(addon.id);
+  addon = await AddonManager.getAddonByID(ID1);
   Assert.ok(addon.userDisabled);
   await checkReconcilerUpToDate(addon);
   records = [];
 
   _("Ensure enable record works as expected.");
-  records.push(createRecordForThisApp(addon.syncGUID, addon.id, true, false));
-  failed = await store.applyIncomingBatch(records);
+  records.push(createRecordForThisApp(addon.syncGUID, ID1, true, false));
+  [failed] = await Promise.all([
+    store.applyIncomingBatch(records),
+    AddonTestUtils.promiseWebExtensionStartup(ID1),
+  ]);
   Assert.equal(0, failed.length);
-  addon = await AddonManager.getAddonByID(addon.id);
+  addon = await AddonManager.getAddonByID(ID1);
   Assert.ok(!addon.userDisabled);
   await checkReconcilerUpToDate(addon);
   records = [];
 
   _("Ensure enabled state updates don't apply if the ignore pref is set.");
-  records.push(createRecordForThisApp(addon.syncGUID, addon.id, false, false));
+  records.push(createRecordForThisApp(addon.syncGUID, ID1, false, false));
   Svc.Prefs.set("addons.ignoreUserEnabledChanges", true);
   failed = await store.applyIncomingBatch(records);
   Assert.equal(0, failed.length);
-  addon = await AddonManager.getAddonByID(addon.id);
+  addon = await AddonManager.getAddonByID(ID1);
   Assert.ok(!addon.userDisabled);
   records = [];
 
   await uninstallAddon(addon, reconciler);
   Svc.Prefs.reset("addons.ignoreUserEnabledChanges");
 });
 
 add_task(async function test_apply_enabled_appDisabled() {
   _("Ensures that changes to the userEnabled flag apply when the addon is appDisabled.");
 
-  let addon = await installAddon(XPIS.test_install3); // this addon is appDisabled by default.
+  // this addon is appDisabled by default.
+  let addon = await installAddon(XPIS.test_addon3);
   Assert.ok(addon.appDisabled);
   Assert.ok(!addon.isActive);
   Assert.ok(!addon.userDisabled);
 
   _("Ensure application of a disable record works as expected.");
   store.reconciler.pruneChangesBeforeDate(Date.now() + 10);
   store.reconciler._changes = [];
   let records = [];
-  records.push(createRecordForThisApp(addon.syncGUID, addon.id, false, false));
+  records.push(createRecordForThisApp(addon.syncGUID, ID3, false, false));
   let failed = await store.applyIncomingBatch(records);
   Assert.equal(0, failed.length);
-  addon = await AddonManager.getAddonByID(addon.id);
+  addon = await AddonManager.getAddonByID(ID3);
   Assert.ok(addon.userDisabled);
   await checkReconcilerUpToDate(addon);
   records = [];
 
   _("Ensure enable record works as expected.");
-  records.push(createRecordForThisApp(addon.syncGUID, addon.id, true, false));
+  records.push(createRecordForThisApp(addon.syncGUID, ID3, true, false));
   failed = await store.applyIncomingBatch(records);
   Assert.equal(0, failed.length);
-  addon = await AddonManager.getAddonByID(addon.id);
+  addon = await AddonManager.getAddonByID(ID3);
   Assert.ok(!addon.userDisabled);
   await checkReconcilerUpToDate(addon);
   records = [];
 
   await uninstallAddon(addon, reconciler);
 });
 
-add_task(async function test_ignore_different_appid() {
-  _("Ensure that incoming records with a different application ID are ignored.");
+ add_task(async function test_ignore_different_appid() {
+   _("Ensure that incoming records with a different application ID are ignored.");
 
   // We test by creating a record that should result in an update.
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
   Assert.ok(!addon.userDisabled);
 
-  let record = createRecordForThisApp(addon.syncGUID, addon.id, false, false);
+  let record = createRecordForThisApp(addon.syncGUID, ID1, false, false);
   record.applicationID = "FAKE_ID";
 
   let failed = await store.applyIncomingBatch([record]);
   Assert.equal(0, failed.length);
 
-  let newAddon = await AddonManager.getAddonByID(addon.id);
+  let newAddon = await AddonManager.getAddonByID(ID1);
   Assert.ok(!newAddon.userDisabled);
 
   await uninstallAddon(addon, reconciler);
 });
 
 add_task(async function test_ignore_unknown_source() {
   _("Ensure incoming records with unknown source are ignored.");
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
 
-  let record = createRecordForThisApp(addon.syncGUID, addon.id, false, false);
+  let record = createRecordForThisApp(addon.syncGUID, ID1, false, false);
   record.source = "DUMMY_SOURCE";
 
   let failed = await store.applyIncomingBatch([record]);
   Assert.equal(0, failed.length);
 
-  let newAddon = await AddonManager.getAddonByID(addon.id);
+  let newAddon = await AddonManager.getAddonByID(ID1);
   Assert.ok(!newAddon.userDisabled);
 
   await uninstallAddon(addon, reconciler);
 });
 
 add_task(async function test_apply_uninstall() {
   _("Ensures that uninstalling an add-on from a record works.");
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
 
   let records = [];
-  records.push(createRecordForThisApp(addon.syncGUID, addon.id, true, true));
+  records.push(createRecordForThisApp(addon.syncGUID, ID1, true, true));
   let failed = await store.applyIncomingBatch(records);
   Assert.equal(0, failed.length);
 
-  addon = await AddonManager.getAddonByID(addon.id);
+  addon = await AddonManager.getAddonByID(ID1);
   Assert.equal(null, addon);
 });
 
 add_task(async function test_addon_syncability() {
   _("Ensure isAddonSyncable functions properly.");
 
   Svc.Prefs.set("addons.trustedSourceHostnames",
                 "addons.mozilla.org,other.example.com");
 
   Assert.ok(!(await store.isAddonSyncable(null)));
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
   Assert.ok((await store.isAddonSyncable(addon)));
 
   let dummy = {};
   const KEYS = ["id", "syncGUID", "type", "scope", "foreignInstall", "isSyncable"];
   for (let k of KEYS) {
     dummy[k] = addon[k];
   }
 
@@ -418,19 +440,19 @@ add_task(async function test_get_all_ids
 
   _("Installing two addons.");
   // XXX - this test seems broken - at this point, before we've installed the
   // addons below, store.getAllIDs() returns all addons installed by previous
   // tests, even though those tests uninstalled the addon.
   // So if any tests above ever add a new addon ID, they are going to need to
   // be added here too.
   // Assert.equal(0, Object.keys(store.getAllIDs()).length);
-  let addon1 = await installAddon(XPIS.test_install1, reconciler);
-  let addon2 = await installAddon(XPIS.test_bootstrap1_1, reconciler);
-  let addon3 = await installAddon(XPIS.test_install3, reconciler);
+  let addon1 = await installAddon(XPIS.test_addon1, reconciler);
+  let addon2 = await installAddon(XPIS.test_addon2, reconciler);
+  let addon3 = await installAddon(XPIS.test_addon3, reconciler);
 
   _("Ensure they're syncable.");
   Assert.ok((await store.isAddonSyncable(addon1)));
   Assert.ok((await store.isAddonSyncable(addon2)));
   Assert.ok((await store.isAddonSyncable(addon3)));
 
   let ids = await store.getAllIDs();
 
@@ -443,46 +465,42 @@ add_task(async function test_get_all_ids
   await uninstallAddon(addon1, reconciler);
   await uninstallAddon(addon2, reconciler);
   await uninstallAddon(addon3, reconciler);
 });
 
 add_task(async function test_change_item_id() {
   _("Ensures that changeItemID() works properly.");
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
 
   let oldID = addon.syncGUID;
   let newID = Utils.makeGUID();
 
   await store.changeItemID(oldID, newID);
 
-  let newAddon = await AddonManager.getAddonByID(addon.id);
+  let newAddon = await AddonManager.getAddonByID(ID1);
   Assert.notEqual(null, newAddon);
   Assert.equal(newID, newAddon.syncGUID);
 
   await uninstallAddon(newAddon, reconciler);
 });
 
 add_task(async function test_create() {
   _("Ensure creating/installing an add-on from a record works.");
 
   let server = createAndStartHTTPServer(HTTP_PORT);
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
-  let id = addon.id;
-  await uninstallAddon(addon, reconciler);
-
   let guid = Utils.makeGUID();
-  let record = createRecordForThisApp(guid, id, true, false);
+  let record = createRecordForThisApp(guid, ID1, true, false);
 
   let failed = await store.applyIncomingBatch([record]);
   Assert.equal(0, failed.length);
 
-  let newAddon = await AddonManager.getAddonByID(id);
+  let newAddon = await AddonManager.getAddonByID(ID1);
   Assert.notEqual(null, newAddon);
   Assert.equal(guid, newAddon.syncGUID);
   Assert.ok(!newAddon.userDisabled);
 
   await uninstallAddon(newAddon, reconciler);
 
   await promiseStopServer(server);
 });
@@ -575,38 +593,37 @@ add_task(async function test_incoming_sy
   Assert.ok(!(await AddonManager.getAddonByID(SYSTEM_ADDON_ID).userDisabled));
 
   await promiseStopServer(server);
 });
 
 add_task(async function test_wipe() {
   _("Ensures that wiping causes add-ons to be uninstalled.");
 
-  let addon1 = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  await installAddon(XPIS.test_addon1, reconciler);
 
   await store.wipe();
 
-  let addon = await AddonManager.getAddonByID(addon1.id);
+  let addon = await AddonManager.getAddonByID(ID1);
   Assert.equal(null, addon);
 });
 
 add_task(async function test_wipe_and_install() {
   _("Ensure wipe followed by install works.");
 
   // This tests the reset sync flow where remote data is replaced by local. The
   // receiving client will see a wipe followed by a record which should undo
   // the wipe.
-  let installed = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let installed = await installAddon(XPIS.test_addon1, reconciler);
 
-  let record = createRecordForThisApp(installed.syncGUID, installed.id, true,
-                                      false);
+  let record = createRecordForThisApp(installed.syncGUID, ID1, true, false);
 
   await store.wipe();
 
-  let deleted = await AddonManager.getAddonByID(installed.id);
+  let deleted = await AddonManager.getAddonByID(ID1);
   Assert.equal(null, deleted);
 
   // Re-applying the record can require re-fetching the XPI.
   let server = createAndStartHTTPServer(HTTP_PORT);
 
   await store.applyIncoming(record);
 
   let fetched = await AddonManager.getAddonByID(record.addonID);
@@ -628,41 +645,41 @@ add_task(async function test_wipe_and_in
 // * Sync this profile
 // Before bug 1467904, the addon would fail to install because this profile
 // has a copy of the addon in our addonsreconciler.json, but the addon manager
 // does *not* have a copy in its cache, and repopulating that cache would not
 // re-add it as the addon is no longer installed locally.
 add_task(async function test_incoming_reconciled_but_not_cached() {
   _("Ensure we handle incoming records our reconciler has but the addon cache does not");
 
-  let addonid = "bootstrap1@tests.mozilla.org";
   // Make sure addon is not installed.
-  let addon = await AddonManager.getAddonByID(addonid);
+  let addon = await AddonManager.getAddonByID(ID1);
   Assert.equal(null, addon);
 
   Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", false);
 
-  addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
-  Assert.notEqual((await AddonManager.getAddonByID(addonid)), null);
+  addon = await installAddon(XPIS.test_addon1, reconciler);
+  Assert.notEqual((await AddonManager.getAddonByID(ID1)), null);
   await uninstallAddon(addon, reconciler);
 
   Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
 
   // now pretend it is incoming.
   let server = createAndStartHTTPServer(HTTP_PORT);
   let guid = Utils.makeGUID();
-  let record = createRecordForThisApp(guid, addonid, true, false);
+  let record = createRecordForThisApp(guid, ID1, true, false);
 
   let failed = await store.applyIncomingBatch([record]);
   Assert.equal(0, failed.length);
 
-  Assert.notEqual((await AddonManager.getAddonByID(addonid)), null);
+  Assert.notEqual((await AddonManager.getAddonByID(ID1)), null);
 
   await promiseStopServer(server);
 });
+
 // NOTE: The test above must be the last test run due to the addon cache
 // being trashed. It is probably possible to fix that by running, eg,
 // AddonRespository.backgroundUpdateCheck() to rebuild the cache, but that
 // requires implementing more AMO functionality in our test server
 
 add_task(async function cleanup() {
   // There's an xpcom-shutdown hook for this, but let's give this a shot.
   reconciler.stopListening();
--- a/services/sync/tests/unit/test_addons_tracker.js
+++ b/services/sync/tests/unit/test_addons_tracker.js
@@ -23,40 +23,26 @@ Svc.Prefs.set("engine.addons", true);
 let engine;
 let reconciler;
 let store;
 let tracker;
 
 const addon1ID = "addon1@tests.mozilla.org";
 
 const ADDONS = {
-  test_bootstrap1_1: {
-    "install.rdf": {
-      id: "bootstrap1@tests.mozilla.org",
-      version: "1.0",
-      bootstrap: "true",
-      multiprocessCompatible: "true",
-      name: "Test Bootstrap 1",
-      description: "Test Description",
-
-      iconURL: "chrome://foo/skin/icon.png",
-      aboutURL: "chrome://foo/content/about.xul",
-      optionsURL: "chrome://foo/content/options.xul",
-
-      targetApplications: [{
-          id: "xpcshell@tests.mozilla.org",
-          minVersion: "1",
-          maxVersion: "1"}],
+  test_addon1: {
+    manifest: {
+      applications: {gecko: {id: addon1ID}},
     },
   },
 };
 
 const XPIS = {};
-for (let [name, files] of Object.entries(ADDONS)) {
-  XPIS[name] = AddonTestUtils.createTempXPIFile(files);
+for (let [name, data] of Object.entries(ADDONS)) {
+  XPIS[name] = AddonTestUtils.createTempWebExtensionFile(data);
 }
 
 async function cleanup() {
   tracker.stop();
 
   tracker.resetScore();
   await tracker.clearChangedIDs();
 
@@ -85,50 +71,50 @@ add_task(async function test_empty() {
   Assert.equal(0, tracker.score);
 
   await cleanup();
 });
 
 add_task(async function test_not_tracking() {
   _("Ensures the tracker doesn't do anything when it isn't tracking.");
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
   await uninstallAddon(addon, reconciler);
 
   Assert.equal(0, Object.keys((await tracker.getChangedIDs())).length);
   Assert.equal(0, tracker.score);
 
   await cleanup();
 });
 
 add_task(async function test_track_install() {
   _("Ensure that installing an add-on notifies tracker.");
 
   reconciler.startListening();
 
   tracker.start();
 
   Assert.equal(0, tracker.score);
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
   let changed = await tracker.getChangedIDs();
 
   Assert.equal(1, Object.keys(changed).length);
   Assert.ok(addon.syncGUID in changed);
   Assert.equal(SCORE_INCREMENT_XLARGE, tracker.score);
 
   await uninstallAddon(addon, reconciler);
   await cleanup();
 });
 
 add_task(async function test_track_uninstall() {
   _("Ensure that uninstalling an add-on notifies tracker.");
 
   reconciler.startListening();
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
   let guid = addon.syncGUID;
   Assert.equal(0, tracker.score);
 
   tracker.start();
 
   await uninstallAddon(addon, reconciler);
   let changed = await tracker.getChangedIDs();
   Assert.equal(1, Object.keys(changed).length);
@@ -138,61 +124,43 @@ add_task(async function test_track_unins
   await cleanup();
 });
 
 add_task(async function test_track_user_disable() {
   _("Ensure that tracker sees disabling of add-on");
 
   reconciler.startListening();
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
   Assert.ok(!addon.userDisabled);
   Assert.ok(!addon.appDisabled);
   Assert.ok(addon.isActive);
 
   tracker.start();
   Assert.equal(0, tracker.score);
 
-  let disabledPromise = new Promise(res => {
-    let listener = {
-      onDisabled(disabled) {
-        _("onDisabled");
-        if (disabled.id == addon.id) {
-          AddonManager.removeAddonListener(listener);
-          res();
-        }
-      },
-      onDisabling(disabling) {
-        _("onDisabling add-on");
-      },
-    };
-    AddonManager.addAddonListener(listener);
-  });
-
   _("Disabling add-on");
   await addon.disable();
-  _("Disabling started...");
-  await disabledPromise;
   await reconciler.queueCaller.promiseCallsComplete();
 
   let changed = await tracker.getChangedIDs();
   Assert.equal(1, Object.keys(changed).length);
   Assert.ok(addon.syncGUID in changed);
   Assert.equal(SCORE_INCREMENT_XLARGE, tracker.score);
 
   await uninstallAddon(addon, reconciler);
   await cleanup();
 });
 
 add_task(async function test_track_enable() {
   _("Ensure that enabling a disabled add-on notifies tracker.");
 
   reconciler.startListening();
 
-  let addon = await installAddon(XPIS.test_bootstrap1_1, reconciler);
+  let addon = await installAddon(XPIS.test_addon1, reconciler);
   await addon.disable();
   await Async.promiseYield();
 
   Assert.equal(0, tracker.score);
 
   tracker.start();
   await addon.enable();
   await Async.promiseYield();