Skip to content

Commit

Permalink
feat: Disabled the default browser check for Chromium (#1781)
Browse files Browse the repository at this point in the history
  • Loading branch information
mariyan-borisov committed Dec 11, 2019
1 parent 7ee3c44 commit 4ec9c7d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/extension-runners/chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ const EXCLUDED_CHROME_FLAGS = [
export const DEFAULT_CHROME_FLAGS = ChromeLauncher.defaultFlags()
.filter((flag) => !EXCLUDED_CHROME_FLAGS.includes(flag));

export const EXTRA_CHROME_FLAGS = [
'--no-default-browser-check',
];

/**
* Implements an IExtensionRunner which manages a Chromium instance.
*/
Expand Down Expand Up @@ -119,7 +123,7 @@ export class ChromiumExtensionRunner {
log.debug(`(chromiumBinary: ${chromiumBinary})`);
}

const chromeFlags = [...DEFAULT_CHROME_FLAGS];
const chromeFlags = [...DEFAULT_CHROME_FLAGS, ...EXTRA_CHROME_FLAGS];

chromeFlags.push(`--load-extension=${extensions}`);

Expand Down
10 changes: 10 additions & 0 deletions tests/unit/test-extension-runners/test.chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import {
ChromiumExtensionRunner,
DEFAULT_CHROME_FLAGS,
EXTRA_CHROME_FLAGS,
} from '../../../src/extension-runners/chromium';
import type {
ChromiumExtensionRunnerParams,
Expand Down Expand Up @@ -62,6 +63,10 @@ describe('util/extension-runners/chromium', async () => {
assert.deepEqual(DEFAULT_CHROME_FLAGS, expectedFlags);
});

it('disables the default browser check', () => {
assert.include(EXTRA_CHROME_FLAGS, '--no-default-browser-check');
});

it('installs and runs the extension', async () => {
const {params, fakeChromeInstance} = prepareExtensionRunnerParams();
const runnerInstance = new ChromiumExtensionRunner(params);
Expand All @@ -78,6 +83,7 @@ describe('util/extension-runners/chromium', async () => {
chromePath: undefined,
chromeFlags: [
...DEFAULT_CHROME_FLAGS,
...EXTRA_CHROME_FLAGS,
`--load-extension=${reloadManagerExtension},/fake/sourceDir`,
],
startingUrl: undefined,
Expand Down Expand Up @@ -271,6 +277,7 @@ describe('util/extension-runners/chromium', async () => {
chromePath: '/my/custom/chrome-bin',
chromeFlags: [
...DEFAULT_CHROME_FLAGS,
...EXTRA_CHROME_FLAGS,
`--load-extension=${reloadManagerExtension},/fake/sourceDir`,
],
startingUrl: undefined,
Expand All @@ -296,6 +303,7 @@ describe('util/extension-runners/chromium', async () => {
chromePath: undefined,
chromeFlags: [
...DEFAULT_CHROME_FLAGS,
...EXTRA_CHROME_FLAGS,
`--load-extension=${reloadManagerExtension},/fake/sourceDir`,
'url2',
'url3',
Expand Down Expand Up @@ -326,6 +334,7 @@ describe('util/extension-runners/chromium', async () => {
chromePath: undefined,
chromeFlags: [
...DEFAULT_CHROME_FLAGS,
...EXTRA_CHROME_FLAGS,
`--load-extension=${reloadManagerExtension},/fake/sourceDir`,
'--arg1',
'arg2',
Expand Down Expand Up @@ -358,6 +367,7 @@ describe('util/extension-runners/chromium', async () => {
chromePath: undefined,
chromeFlags: [
...DEFAULT_CHROME_FLAGS,
...EXTRA_CHROME_FLAGS,
`--load-extension=${reloadManagerExtension},/fake/sourceDir`,
'--user-data-dir=/fake/chrome/profile',
],
Expand Down

0 comments on commit 4ec9c7d

Please sign in to comment.