Index: tools/testing/dart/utils.dart |
diff --git a/tools/testing/dart/utils.dart b/tools/testing/dart/utils.dart |
index f1abfaebcee77af0a9fdff2de10be1487432f240..a6d008e6993757ea76ae6535cfcfd400265b0b15 100644 |
--- a/tools/testing/dart/utils.dart |
+++ b/tools/testing/dart/utils.dart |
@@ -2,6 +2,8 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+library utils; |
+ |
import 'dart:io'; |
import 'dart:convert'; |
@@ -176,6 +178,60 @@ String decodeUtf8(List<int> bytes) { |
return UTF8.decode(bytes, allowMalformed: true); |
} |
+class Locations { |
+ static String getBrowserLocation( |
+ String browserName, Map<String, dynamic> globalConfiguration) { |
+ var location = globalConfiguration[browserName] as String; |
+ if (location != null && location != '') { |
+ return location; |
+ } |
+ var browserLocations = { |
+ 'firefox': const { |
+ 'windows': 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', |
+ 'linux': 'firefox', |
+ 'macos': '/Applications/Firefox.app/Contents/MacOS/firefox' |
+ }, |
+ 'chrome': const { |
+ 'windows': |
+ 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', |
+ 'macos': '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', |
+ 'linux': 'google-chrome' |
+ }, |
+ 'dartium': const { |
+ 'windows': 'client\\tests\\dartium\\chrome.exe', |
+ 'macos': 'client/tests/dartium/Chromium.app/Contents/MacOS/Chromium', |
+ 'linux': 'client/tests/dartium/chrome' |
+ }, |
+ 'safari': const { |
+ 'macos': '/Applications/Safari.app/Contents/MacOS/Safari' |
+ }, |
+ 'safarimobilesim': const { |
+ 'macos': '/Applications/Xcode.app/Contents/Developer/Platforms/' |
+ 'iPhoneSimulator.platform/Developer/Applications/' |
+ 'iPhone Simulator.app/Contents/MacOS/iPhone Simulator' |
+ }, |
+ 'ie9': const { |
+ 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe' |
+ }, |
+ 'ie10': const { |
+ 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe' |
+ }, |
+ 'ie11': const { |
+ 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe' |
+ } |
+ }; |
+ browserLocations['ff'] = browserLocations['firefox']; |
+ |
+ assert(browserLocations[browserName] != null); |
+ location = browserLocations[browserName][Platform.operatingSystem]; |
+ if (location != null) { |
+ return location; |
+ } else { |
+ throw '$browserName not supported on ${Platform.operatingSystem}'; |
+ } |
+ } |
+} |
+ |
// This function is pretty stupid and only puts quotes around an argument if |
// it the argument contains a space. |
String escapeCommandLineArgument(String argument) { |