feat: browsers: recognize chromium as a valid browser (#9760)

This commit is contained in:
Thiago Perrotta 2023-03-06 05:59:44 -05:00 committed by GitHub
parent 677760456d
commit 04247a4e00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 0 deletions

View File

@ -20,11 +20,13 @@ import {Browser, BrowserPlatform, BrowserTag} from './types.js';
export const downloadUrls = {
[Browser.CHROME]: chrome.resolveDownloadUrl,
[Browser.CHROMIUM]: chrome.resolveDownloadUrl,
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
};
export const executablePathByBrowser = {
[Browser.CHROME]: chrome.relativeExecutablePath,
[Browser.CHROMIUM]: chrome.relativeExecutablePath,
[Browser.FIREFOX]: firefox.relativeExecutablePath,
};
@ -42,6 +44,7 @@ export async function resolveBuildId(
return await firefox.resolveBuildId('FIREFOX_NIGHTLY');
}
case Browser.CHROME:
case Browser.CHROMIUM:
switch (tag as BrowserTag) {
case BrowserTag.LATEST:
return await chrome.resolveBuildId(platform, 'latest');

View File

@ -22,6 +22,7 @@ import * as firefox from './firefox.js';
*/
export enum Browser {
CHROME = 'chrome',
CHROMIUM = 'chromium',
FIREFOX = 'firefox',
}
@ -39,6 +40,7 @@ export enum BrowserPlatform {
export const downloadUrls = {
[Browser.CHROME]: chrome.resolveDownloadUrl,
[Browser.CHROMIUM]: chrome.resolveDownloadUrl,
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
};

View File

@ -38,6 +38,18 @@ describe('launcher', () => {
);
});
it('should compute executable path for Chromium', () => {
assert.strictEqual(
computeExecutablePath({
browser: Browser.CHROMIUM,
platform: BrowserPlatform.LINUX,
buildId: '123',
cacheDir: 'cache',
}),
path.join('cache', 'chromium', 'linux-123', 'chrome-linux', 'chrome')
);
});
it('should compute executable path for Firefox', () => {
assert.strictEqual(
computeExecutablePath({