| 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 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override --checked | 4 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override --checked |
| 5 | 5 |
| 6 library test_helper; | 6 library test_helper; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 subscription.cancel(); | 189 subscription.cancel(); |
| 190 completer.complete(); | 190 completer.complete(); |
| 191 } | 191 } |
| 192 }); | 192 }); |
| 193 }); | 193 }); |
| 194 isolate.resume(); | 194 isolate.resume(); |
| 195 return completer.future; | 195 return completer.future; |
| 196 } | 196 } |
| 197 | 197 |
| 198 | 198 |
| 199 Future<Class> getClassFromRootLib(Isolate isolate, String className) async { |
| 200 Library rootLib = await isolate.rootLibrary.load(); |
| 201 for (var i = 0; i < rootLib.classes.length; i++) { |
| 202 Class cls = rootLib.classes[i]; |
| 203 if (cls.name == className) { |
| 204 return cls; |
| 205 } |
| 206 } |
| 207 return null; |
| 208 } |
| 209 |
| 210 |
| 199 /// Runs [tests] in sequence, each of which should take an [Isolate] and | 211 /// Runs [tests] in sequence, each of which should take an [Isolate] and |
| 200 /// return a [Future]. Code for setting up state can run before and/or | 212 /// return a [Future]. Code for setting up state can run before and/or |
| 201 /// concurrently with the tests. Uses [mainArgs] to determine whether | 213 /// concurrently with the tests. Uses [mainArgs] to determine whether |
| 202 /// to run tests or testee in this invokation of the script. | 214 /// to run tests or testee in this invokation of the script. |
| 203 Future runVMTests(List<String> mainArgs, | 215 Future runVMTests(List<String> mainArgs, |
| 204 List<VMTest> tests, | 216 List<VMTest> tests, |
| 205 {Future testeeBefore(), | 217 {Future testeeBefore(), |
| 206 Future testeeConcurrent(), | 218 Future testeeConcurrent(), |
| 207 bool pause_on_exit}) async { | 219 bool pause_on_exit}) async { |
| 208 if (mainArgs.contains(_TESTEE_MODE_FLAG)) { | 220 if (mainArgs.contains(_TESTEE_MODE_FLAG)) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 235 }, onError: (e, st) { | 247 }, onError: (e, st) { |
| 236 process.requestExit(); | 248 process.requestExit(); |
| 237 if (!_isWebSocketDisconnect(e)) { | 249 if (!_isWebSocketDisconnect(e)) { |
| 238 print('Unexpected exception in service tests: $e $st'); | 250 print('Unexpected exception in service tests: $e $st'); |
| 239 throw e; | 251 throw e; |
| 240 } | 252 } |
| 241 }); | 253 }); |
| 242 }); | 254 }); |
| 243 } | 255 } |
| 244 } | 256 } |
| OLD | NEW |