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

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: Move default browser paths to utils.dart 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 switch (browserName) {
kustermann 2013/11/06 14:28:01 You could do something like this, to make it a bit
135 return new Path('client/tests/dartium/Chromium.app/Contents/' 136 case 'firefox':
136 'MacOS/Chromium').toNativePath(); 137 if (Platform.isWindows) {
138 return "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe";
139 } else if (Platform.isLinux) {
140 return 'firefox';
141 } else if (Platform.isMacOS) {
142 return "/Applications/Firefox.app/Contents/MacOS/firefox";
143 } else {
144 throw 'Firefox not supported on ${Platform.operatingSystem}';
145 }
146 break;
147 case 'chrome':
148 if (Platform.isWindows) {
149 return "C:\\Program Files (x86)\\Google\\Chrome"
150 "\\Application\\chrome.exe";
151 } else if (Platform.isMacOS) {
152 return "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
153 } else if (Platform.isLinux) {
154 return 'google-chrome';
155 } else {
156 throw "Chrome is not supported on ${Platform.operatingSystem}";
157 }
158 break;
159 case 'dartium':
160 if (Platform.isMacOS) {
161 return 'client/tests/dartium/Chromium.app/Contents/MacOS/Chromium';
162 } else {
163 return new Uri.file('client/tests/dartium/chrome').toFilePath();
164 }
165 break;
166 case 'safari':
167 if (Platform.isMacOS) {
168 return "/Applications/Safari.app/Contents/MacOS/Safari";
169 } else {
170 throw "Safari browser not supported on ${Platform.operatingSystem}";
171 }
172 break;
173 case 'ie9':
174 case 'ie10':
175 return "C:\\Program Files\\Internet Explorer\\iexplore.exe";
176 break;
177 default:
178 throw 'Non-supported browser $browserName';
137 } 179 }
138 return new Path('client/tests/dartium/chrome').toNativePath();
139 } 180 }
140 } 181 }
141 182
142 // This function is pretty stupid and only puts quotes around an argument if 183 // This function is pretty stupid and only puts quotes around an argument if
143 // it the argument contains a space. 184 // it the argument contains a space.
144 String escapeCommandLineArgument(String argument) { 185 String escapeCommandLineArgument(String argument) {
145 if (argument.contains(' ')) { 186 if (argument.contains(' ')) {
146 return '"$argument"'; 187 return '"$argument"';
147 } 188 }
148 return argument; 189 return argument;
(...skipping 11 matching lines...) Expand all
160 201
161 class UniqueObject { 202 class UniqueObject {
162 static int _nextId = 1; 203 static int _nextId = 1;
163 final int _hashCode; 204 final int _hashCode;
164 205
165 int get hashCode => _hashCode; 206 int get hashCode => _hashCode;
166 operator==(other) => other is UniqueObject && _hashCode == other._hashCode; 207 operator==(other) => other is UniqueObject && _hashCode == other._hashCode;
167 208
168 UniqueObject() : _hashCode = ++_nextId; 209 UniqueObject() : _hashCode = ++_nextId;
169 } 210 }
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