From 0834a29b15e2f04fbce56329271662c457dea481 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Wed, 21 Oct 2015 17:04:18 -0700 Subject: [PATCH] pick default chrome location based on platform --- tests/webTestServer.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/webTestServer.ts b/tests/webTestServer.ts index 6d3144eeaec..18a1f05d47b 100644 --- a/tests/webTestServer.ts +++ b/tests/webTestServer.ts @@ -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 {