Merge pull request #5360 from Microsoft/runTestsBrowserOnLinux

pick default chrome location based on platform
This commit is contained in:
Vladimir Matveev
2015-10-22 08:59:40 -07:00

View File

@@ -5,6 +5,7 @@ import fs = require("fs");
import path = require("path");
import url = require("url");
import child_process = require("child_process");
import os = require('os');
/// Command line processing ///
@@ -263,7 +264,20 @@ http.createServer(function (req: http.ServerRequest, res: http.ServerResponse) {
var browserPath: string;
if ((browser && browser === 'chrome')) {
var defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
let defaultChromePath = "";
switch (os.platform()) {
case "win32":
case "win64":
defaultChromePath = "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe";
break;
case "linux":
defaultChromePath = "/opt/google/chrome/chrome"
break;
default:
console.log(`default Chrome location is unknown for platform '${os.platform()}'`);
break;
}
if (fs.existsSync(defaultChromePath)) {
browserPath = defaultChromePath;
} else {