| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library utils; | 5 library utils; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:math' show min; | 8 import 'dart:math' show min; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 | 10 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return UTF8.decode(bytes, allowMalformed: true); | 171 return UTF8.decode(bytes, allowMalformed: true); |
| 172 } | 172 } |
| 173 | 173 |
| 174 class Locations { | 174 class Locations { |
| 175 static String getBrowserLocation(String browserName, | 175 static String getBrowserLocation(String browserName, |
| 176 Map globalConfiguration) { | 176 Map globalConfiguration) { |
| 177 var location = globalConfiguration[browserName]; | 177 var location = globalConfiguration[browserName]; |
| 178 if (location != null && location != '') { | 178 if (location != null && location != '') { |
| 179 return location; | 179 return location; |
| 180 } | 180 } |
| 181 final browserLocations = const { | 181 var browserLocations = { |
| 182 'firefox': const { | 182 'firefox': const { |
| 183 'windows': 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', | 183 'windows': 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe', |
| 184 'linux': 'firefox', | 184 'linux': 'firefox', |
| 185 'macos': '/Applications/Firefox.app/Contents/MacOS/firefox' | 185 'macos': '/Applications/Firefox.app/Contents/MacOS/firefox' |
| 186 }, | 186 }, |
| 187 'chrome': const { | 187 'chrome': const { |
| 188 'windows': | 188 'windows': |
| 189 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', | 189 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe', |
| 190 'macos': | 190 'macos': |
| 191 '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', | 191 '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', |
| 192 'linux': 'google-chrome' | 192 'linux': 'google-chrome' |
| 193 }, | 193 }, |
| 194 'dartium': const { | 194 'dartium': const { |
| 195 'windows': 'client\\tests\\dartium\\chrome.exe', | 195 'windows': 'client\\tests\\dartium\\chrome.exe', |
| 196 'macos': 'client/tests/dartium/Chromium.app/Contents/MacOS/Chromium', | 196 'macos': 'client/tests/dartium/Chromium.app/Contents/MacOS/Chromium', |
| 197 'linux': 'client/tests/dartium/chrome' | 197 'linux': 'client/tests/dartium/chrome' |
| 198 }, | 198 }, |
| 199 'safari': const { | 199 'safari': const { |
| 200 'macos': '/Applications/Safari.app/Contents/MacOS/Safari' | 200 'macos': '/Applications/Safari.app/Contents/MacOS/Safari' |
| 201 }, | 201 }, |
| 202 'ie9': const { | 202 'ie9': const { |
| 203 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe' | 203 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe' |
| 204 }, | 204 }, |
| 205 'ie10': const { | 205 'ie10': const { |
| 206 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe' | 206 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe' |
| 207 }}; | 207 }}; |
| 208 browserLocations['ff'] = browserLocations['firefox']; |
| 208 | 209 |
| 209 assert(browserLocations[browserName] != null); | 210 assert(browserLocations[browserName] != null); |
| 210 location = browserLocations[browserName][Platform.operatingSystem]; | 211 location = browserLocations[browserName][Platform.operatingSystem]; |
| 211 if (location != null) { | 212 if (location != null) { |
| 212 return location; | 213 return location; |
| 213 } else { | 214 } else { |
| 214 throw '$browserName not supported on ${Platform.operatingSystem}'; | 215 throw '$browserName not supported on ${Platform.operatingSystem}'; |
| 215 } | 216 } |
| 216 } | 217 } |
| 217 } | 218 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 237 | 238 |
| 238 class UniqueObject { | 239 class UniqueObject { |
| 239 static int _nextId = 1; | 240 static int _nextId = 1; |
| 240 final int _hashCode; | 241 final int _hashCode; |
| 241 | 242 |
| 242 int get hashCode => _hashCode; | 243 int get hashCode => _hashCode; |
| 243 operator==(other) => other is UniqueObject && _hashCode == other._hashCode; | 244 operator==(other) => other is UniqueObject && _hashCode == other._hashCode; |
| 244 | 245 |
| 245 UniqueObject() : _hashCode = ++_nextId; | 246 UniqueObject() : _hashCode = ++_nextId; |
| 246 } | 247 } |
| OLD | NEW |