Skip to content

Commit

Permalink
feat: support --pref in "web-ext run" for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob--W committed May 2, 2019
1 parent 64342ef commit 3ad3485
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/extension-runners/firefox-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,13 +423,17 @@ export class FirefoxAndroidExtensionRunner {
selectedAdbDevice,
selectedFirefoxApk,
params: {
customPrefs,
firefoxApp,
},
} = this;
// Create the preferences file and the Fennec temporary profile.
log.debug(`Preparing a temporary profile for ${selectedFirefoxApk}...`);

const profile = await firefoxApp.createProfile({app: 'fennec'});
const profile = await firefoxApp.createProfile({
app: 'fennec',
customPrefs,
});

// Choose a artifacts dir name for the assets pushed to the
// Android device.
Expand Down
25 changes: 25 additions & 0 deletions tests/unit/test-extension-runners/test.firefox-android.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,31 @@ describe('util/extension-runners/firefox-android', () => {
);
});

it('supports custom prefs via --pref', async () => {
const fakeFirefoxApp = {
createProfile: sinon.spy(() => {
return Promise.resolve({profileDir: '/path/to/fake/profile'});
}),
};
const {params} = prepareSelectedDeviceAndAPKParams({
fakeFirefoxApp,
});

// cmd/run.js maps --pref to customPrefs.
params.customPrefs = {'some.pref.name': 123};

const runnerInstance = new FirefoxAndroidExtensionRunner(params);
await runnerInstance.run();

sinon.assert.calledWithMatch(
fakeFirefoxApp.createProfile,
{
app: 'fennec',
customPrefs: {'some.pref.name': 123},
},
);
});

it('builds and pushes the extension xpi to the android device',
async () => {
const {
Expand Down

0 comments on commit 3ad3485

Please sign in to comment.