| 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: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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 return UTF8.encode(string); | 118 return UTF8.encode(string); |
| 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 // This is only used for selenium support for Dartium. Remove the class |
| 129 // when this support goes away. |
| 128 class Locations { | 130 class Locations { |
| 129 static String getDartiumLocation(Map globalConfiguration) { | 131 static String getDartiumLocation(Map globalConfiguration) { |
| 130 var dartium = globalConfiguration['dartium']; | 132 var dartium = globalConfiguration['dartium']; |
| 131 if (dartium != null && dartium != '') { | 133 if (dartium != null && dartium != '') { |
| 132 return dartium; | 134 return dartium; |
| 133 } | 135 } |
| 134 if (Platform.operatingSystem == 'macos') { | 136 if (Platform.operatingSystem == 'macos') { |
| 135 return new Path('client/tests/dartium/Chromium.app/Contents/' | 137 return new Path('client/tests/dartium/Chromium.app/Contents/' |
| 136 'MacOS/Chromium').toNativePath(); | 138 'MacOS/Chromium').toNativePath(); |
| 137 } | 139 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 160 | 162 |
| 161 class UniqueObject { | 163 class UniqueObject { |
| 162 static int _nextId = 1; | 164 static int _nextId = 1; |
| 163 final int _hashCode; | 165 final int _hashCode; |
| 164 | 166 |
| 165 int get hashCode => _hashCode; | 167 int get hashCode => _hashCode; |
| 166 operator==(other) => other is UniqueObject && _hashCode == other._hashCode; | 168 operator==(other) => other is UniqueObject && _hashCode == other._hashCode; |
| 167 | 169 |
| 168 UniqueObject() : _hashCode = ++_nextId; | 170 UniqueObject() : _hashCode = ++_nextId; |
| 169 } | 171 } |
| OLD | NEW |