mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
feat: browsers: recognize chromium as a valid browser (#9760)
This commit is contained in:
parent
677760456d
commit
04247a4e00
@ -20,11 +20,13 @@ import {Browser, BrowserPlatform, BrowserTag} from './types.js';
|
|||||||
|
|
||||||
export const downloadUrls = {
|
export const downloadUrls = {
|
||||||
[Browser.CHROME]: chrome.resolveDownloadUrl,
|
[Browser.CHROME]: chrome.resolveDownloadUrl,
|
||||||
|
[Browser.CHROMIUM]: chrome.resolveDownloadUrl,
|
||||||
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
|
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const executablePathByBrowser = {
|
export const executablePathByBrowser = {
|
||||||
[Browser.CHROME]: chrome.relativeExecutablePath,
|
[Browser.CHROME]: chrome.relativeExecutablePath,
|
||||||
|
[Browser.CHROMIUM]: chrome.relativeExecutablePath,
|
||||||
[Browser.FIREFOX]: firefox.relativeExecutablePath,
|
[Browser.FIREFOX]: firefox.relativeExecutablePath,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -42,6 +44,7 @@ export async function resolveBuildId(
|
|||||||
return await firefox.resolveBuildId('FIREFOX_NIGHTLY');
|
return await firefox.resolveBuildId('FIREFOX_NIGHTLY');
|
||||||
}
|
}
|
||||||
case Browser.CHROME:
|
case Browser.CHROME:
|
||||||
|
case Browser.CHROMIUM:
|
||||||
switch (tag as BrowserTag) {
|
switch (tag as BrowserTag) {
|
||||||
case BrowserTag.LATEST:
|
case BrowserTag.LATEST:
|
||||||
return await chrome.resolveBuildId(platform, 'latest');
|
return await chrome.resolveBuildId(platform, 'latest');
|
||||||
|
@ -22,6 +22,7 @@ import * as firefox from './firefox.js';
|
|||||||
*/
|
*/
|
||||||
export enum Browser {
|
export enum Browser {
|
||||||
CHROME = 'chrome',
|
CHROME = 'chrome',
|
||||||
|
CHROMIUM = 'chromium',
|
||||||
FIREFOX = 'firefox',
|
FIREFOX = 'firefox',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -39,6 +40,7 @@ export enum BrowserPlatform {
|
|||||||
|
|
||||||
export const downloadUrls = {
|
export const downloadUrls = {
|
||||||
[Browser.CHROME]: chrome.resolveDownloadUrl,
|
[Browser.CHROME]: chrome.resolveDownloadUrl,
|
||||||
|
[Browser.CHROMIUM]: chrome.resolveDownloadUrl,
|
||||||
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
|
[Browser.FIREFOX]: firefox.resolveDownloadUrl,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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', () => {
|
it('should compute executable path for Firefox', () => {
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
computeExecutablePath({
|
computeExecutablePath({
|
||||||
|
Loading…
Reference in New Issue
Block a user