Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: tools/testing/dart/utils.dart

Issue 60503002: Add browser path options to testing scripts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Change switch statement and chained if statements to map lookups Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:math' show min; 9 import 'dart:math' show min;
10 import 'dart:convert'; 10 import 'dart:convert';
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 } 119 }
120 120
121 // TODO(kustermann,ricow): As soon we have a debug log we should log 121 // TODO(kustermann,ricow): As soon we have a debug log we should log
122 // invalid utf8-encoded input to the log. 122 // invalid utf8-encoded input to the log.
123 // Currently invalid bytes will be replaced by a replacement character. 123 // Currently invalid bytes will be replaced by a replacement character.
124 String decodeUtf8(List<int> bytes) { 124 String decodeUtf8(List<int> bytes) {
125 return UTF8.decode(bytes, allowMalformed: true); 125 return UTF8.decode(bytes, allowMalformed: true);
126 } 126 }
127 127
128 class Locations { 128 class Locations {
129 static String getDartiumLocation(Map globalConfiguration) { 129 static String getBrowserLocation(String browserName,
130 var dartium = globalConfiguration['dartium']; 130 Map globalConfiguration) {
131 if (dartium != null && dartium != '') { 131 var location = globalConfiguration[browserName];
132 return dartium; 132 if (location != null && location != '') {
133 return location;
133 } 134 }
134 if (Platform.operatingSystem == 'macos') { 135 final browserLocations = const {
135 return new Path('client/tests/dartium/Chromium.app/Contents/' 136 'firefox': const {
136 'MacOS/Chromium').toNativePath(); 137 'windows': 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe',
138 'linux': 'firefox',
139 'macos': '/Applications/Firefox.app/Contents/MacOS/firefox'
140 },
141 'chrome': const {
142 'windows':
143 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe',
144 'macos':
145 '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
146 'linux': 'google-chrome'
147 },
148 'dartium': const {
149 'windows': 'client\\tests\\dartium\\chrome.exe',
150 'macos': 'client/tests/dartium/Chromium.app/Contents/MacOS/Chromium',
151 'linux': 'client/tests/dartium/chrome'
152 },
153 'safari': const {
154 'macos': '/Applications/Safari.app/Contents/MacOS/Safari'
155 },
156 'ie9': const {
157 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe'
158 },
159 'ie10': const {
160 'windows': 'C:\\Program Files\\Internet Explorer\\iexplore.exe'
161 }};
162
163 assert(browserLocations[browserName] != null);
164 location = browserLocations[browserName][Platform.operatingSystem];
165 if (location != null) {
166 return location;
167 } else {
168 throw '$browserName not supported on ${Platform.operatingSystem}';
137 } 169 }
138 return new Path('client/tests/dartium/chrome').toNativePath();
139 } 170 }
140 } 171 }
141 172
142 // This function is pretty stupid and only puts quotes around an argument if 173 // This function is pretty stupid and only puts quotes around an argument if
143 // it the argument contains a space. 174 // it the argument contains a space.
144 String escapeCommandLineArgument(String argument) { 175 String escapeCommandLineArgument(String argument) {
145 if (argument.contains(' ')) { 176 if (argument.contains(' ')) {
146 return '"$argument"'; 177 return '"$argument"';
147 } 178 }
148 return argument; 179 return argument;
(...skipping 11 matching lines...) Expand all
160 191
161 class UniqueObject { 192 class UniqueObject {
162 static int _nextId = 1; 193 static int _nextId = 1;
163 final int _hashCode; 194 final int _hashCode;
164 195
165 int get hashCode => _hashCode; 196 int get hashCode => _hashCode;
166 operator==(other) => other is UniqueObject && _hashCode == other._hashCode; 197 operator==(other) => other is UniqueObject && _hashCode == other._hashCode;
167 198
168 UniqueObject() : _hashCode = ++_nextId; 199 UniqueObject() : _hashCode = ++_nextId;
169 } 200 }
OLDNEW
« no previous file with comments | « tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698