From 7a1202167744498ae2e1deb5a7b3f912f5b31e1f Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Wed, 7 Jun 2017 13:50:00 +0900 Subject: [PATCH] feat: add ChromiumHeadless --- index.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/index.js b/index.js index 2e7e4a5..93e758e 100644 --- a/index.js +++ b/index.js @@ -264,6 +264,28 @@ ChromiumBrowser.prototype = { ChromiumBrowser.$inject = ['baseBrowserDecorator', 'args'] +var ChromiumHeadlessBrowser = function (baseBrowserDecorator, args) { + ChromiumBrowser.apply(this, arguments) + + var parentOptions = this._getOptions + this._getOptions = function (url) { + return headlessGetOptions.call(this, url, args, parentOptions) + } +} + +ChromiumHeadlessBrowser.prototype = { + name: 'ChromiumHeadless', + + DEFAULT_CMD: { + // Try chromium-browser before chromium to avoid conflict with the legacy + // chromium-bsu package previously known as 'chromium' in Debian and Ubuntu. + linux: getBin(['chromium-browser', 'chromium']), + darwin: '/Applications/Chromium.app/Contents/MacOS/Chromium', + win32: getChromiumExe() + }, + ENV_CMD: 'CHROMIUM_BIN' +} + var DartiumBrowser = function () { ChromeBrowser.apply(this, arguments) @@ -291,6 +313,7 @@ module.exports = { 'launcher:ChromeCanary': ['type', ChromeCanaryBrowser], 'launcher:ChromeCanaryHeadless': ['type', ChromeCanaryHeadlessBrowser], 'launcher:Chromium': ['type', ChromiumBrowser], + 'launcher:ChromiumHeadless': ['type', ChromiumHeadlessBrowser], 'launcher:Dartium': ['type', DartiumBrowser] }