1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 import { MigratorBase } from "resource:///modules/MigratorBase.sys.mjs";
6 import { MigrationWizardConstants } from "chrome://browser/content/migration/migration-wizard-constants.mjs";
10 ChromeUtils.defineESModuleGetters(lazy, {
11 MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs",
15 * A stub of a migrator used for automated testing only.
17 export class InternalTestingProfileMigrator extends MigratorBase {
19 return "internal-testing";
22 static get displayNameL10nID() {
23 return "Internal Testing Migrator";
26 static get sourceID() {
31 return Promise.resolve([InternalTestingProfileMigrator.testProfile]);
34 // We will create a single MigratorResource for each resource type that
35 // just immediately reports a successful migration.
36 getResources(aProfile) {
39 aProfile.id != InternalTestingProfileMigrator.testProfile.id
42 "InternalTestingProfileMigrator.getResources expects test profile."
45 return Object.values(lazy.MigrationUtils.resourceTypes).map(type => {
48 migrate: callback => {
49 if (type == lazy.MigrationUtils.resourceTypes.EXTENSIONS) {
51 progressValue: MigrationWizardConstants.PROGRESS_VALUE.SUCCESS,
53 importedExtensions: [],
56 callback(true /* success */);
64 * Clears the MigratorResources that are normally cached by the
65 * MigratorBase parent class after a call to getResources. This
66 * allows our automated tests to try different resource availability
67 * scenarios between tests.
69 flushResourceCache() {
70 this._resourcesByProfile = null;
73 static get testProfile() {
74 return { id: "test-profile", name: "Some test profile" };