Skip to content

Commit

Permalink
Wrap Google Chrome with dbus-launch
Browse files Browse the repository at this point in the history
This reverts commit 0cd0f88.
  • Loading branch information
David Hao committed Feb 3, 2016
1 parent 6b9a5a5 commit 7df7539
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions lib/browser_launcher.js
Expand Up @@ -195,7 +195,7 @@ function browsersForPlatform(config, cb) {
}
]);
} else if (platform === 'linux') {
cb([
var browsers = [
{
name: 'Firefox',
exe: 'firefox',
Expand Down Expand Up @@ -231,7 +231,36 @@ function browsersForPlatform(config, cb) {
args: buildPhantomJsArgs,
supported: findableByWhichOrModule
}
]);
];

// If dbus-launch is present, wrap google-chrome launch
// to prevent a race condition in Google Chrome
// Discussion here: https://github.com/angular/protractor/issues/2419
// Adds a second set of wrapper browsers that will override Chrome
// if dbus-launch is available.
var dbus = {
exe: 'dbus-launch',
supported: findableByWhich
};
dbus.supported(function(dbusAvailable) {
if (dbusAvailable) {
// Make sure the original browser was supported.
async.filter(browsers, function(browser, cb) {
browser.supported(cb);
}, function(available) {
available.forEach(function(browser) {
// Only wrap Chrome with dbus-launch
if (browser.name === 'Chrome') {
browser.args.unshift('--exit-with-session', browser.exe);
browser.exe = dbus.exe;
}
});
cb(available);
});
} else {
cb(browsers);
}
});
} else if (platform === 'sunos') {
cb([
{
Expand Down

0 comments on commit 7df7539

Please sign in to comment.