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

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

Issue 25876002: test.py: Propagate the global --dartium option to the browser controller (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months 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:utf' as utf; 10 import 'dart:utf' as utf;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return utf.encodeUtf8(string); 120 return utf.encodeUtf8(string);
121 } 121 }
122 122
123 // TODO(kustermann,ricow): As soon we have a debug log we should log 123 // TODO(kustermann,ricow): As soon we have a debug log we should log
124 // invalid utf8-encoded input to the log. 124 // invalid utf8-encoded input to the log.
125 // Currently invalid bytes will be replaced by a replacement character. 125 // Currently invalid bytes will be replaced by a replacement character.
126 String decodeUtf8(List<int> bytes) { 126 String decodeUtf8(List<int> bytes) {
127 return utf.decodeUtf8(bytes); 127 return utf.decodeUtf8(bytes);
128 } 128 }
129 129
130 class Locations {
131 static String getDartiumLocation(Map globalConfiguration) {
132 var dartium = globalConfiguration['dartium'];
133 if (dartium != null && dartium != '') {
134 return dartium;
135 }
136 if (Platform.operatingSystem == 'macos') {
137 return new Path('client/tests/dartium/Chromium.app/Contents/'
138 'MacOS/Chromium').toNativePath();
139 }
140 return new Path('client/tests/dartium/chrome').toNativePath();
141 }
142 }
143
130 // This function is pretty stupid and only puts quotes around an argument if 144 // This function is pretty stupid and only puts quotes around an argument if
131 // it the argument contains a space. 145 // it the argument contains a space.
132 String escapeCommandLineArgument(String argument) { 146 String escapeCommandLineArgument(String argument) {
133 if (argument.contains(' ')) { 147 if (argument.contains(' ')) {
134 return '"$argument"'; 148 return '"$argument"';
135 } 149 }
136 return argument; 150 return argument;
137 } 151 }
138 152
139 class HashCodeBuilder { 153 class HashCodeBuilder {
140 int _value = 0; 154 int _value = 0;
141 155
142 void add(Object object) { 156 void add(Object object) {
143 _value = ((_value * 31) ^ object.hashCode) & 0x3FFFFFFF; 157 _value = ((_value * 31) ^ object.hashCode) & 0x3FFFFFFF;
144 } 158 }
145 159
146 int get value => _value; 160 int get value => _value;
147 } 161 }
148 162
149 class UniqueObject { 163 class UniqueObject {
150 static int _nextId = 1; 164 static int _nextId = 1;
151 final int _hashCode; 165 final int _hashCode;
152 166
153 int get hashCode => _hashCode; 167 int get hashCode => _hashCode;
154 operator==(other) => other is UniqueObject && _hashCode == other._hashCode; 168 operator==(other) => other is UniqueObject && _hashCode == other._hashCode;
155 169
156 UniqueObject() : _hashCode = ++_nextId; 170 UniqueObject() : _hashCode = ++_nextId;
157 } 171 }
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