| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 if (event.kind == ServiceEvent.kPauseBreakpoint) { | 166 if (event.kind == ServiceEvent.kPauseBreakpoint) { |
| 167 print('Breakpoint reached'); | 167 print('Breakpoint reached'); |
| 168 subscription.cancel(); | 168 subscription.cancel(); |
| 169 completer.complete(isolate); | 169 completer.complete(isolate); |
| 170 } | 170 } |
| 171 }); | 171 }); |
| 172 | 172 |
| 173 return completer.future; // Will complete when breakpoint hit. | 173 return completer.future; // Will complete when breakpoint hit. |
| 174 } | 174 } |
| 175 | 175 |
| 176 |
| 177 Future<Isolate> resumeIsolate(Isolate isolate) { |
| 178 Completer completer = new Completer(); |
| 179 var subscription; |
| 180 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { |
| 181 if (event.kind == ServiceEvent.kResume) { |
| 182 subscription.cancel(); |
| 183 completer.complete(); |
| 184 } |
| 185 }); |
| 186 isolate.resume(); |
| 187 return completer.future; |
| 188 } |
| 189 |
| 190 |
| 176 /// Runs [tests] in sequence, each of which should take an [Isolate] and | 191 /// Runs [tests] in sequence, each of which should take an [Isolate] and |
| 177 /// return a [Future]. Code for setting up state can run before and/or | 192 /// return a [Future]. Code for setting up state can run before and/or |
| 178 /// concurrently with the tests. Uses [mainArgs] to determine whether | 193 /// concurrently with the tests. Uses [mainArgs] to determine whether |
| 179 /// to run tests or testee in this invokation of the script. | 194 /// to run tests or testee in this invokation of the script. |
| 180 Future runVMTests(List<String> mainArgs, | 195 Future runVMTests(List<String> mainArgs, |
| 181 List<VMTest> tests, | 196 List<VMTest> tests, |
| 182 {Future testeeBefore(), | 197 {Future testeeBefore(), |
| 183 Future testeeConcurrent(), | 198 Future testeeConcurrent(), |
| 184 bool pause_on_exit}) async { | 199 bool pause_on_exit}) async { |
| 185 if (mainArgs.contains(_TESTEE_MODE_FLAG)) { | 200 if (mainArgs.contains(_TESTEE_MODE_FLAG)) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 212 }, onError: (e, st) { | 227 }, onError: (e, st) { |
| 213 process.requestExit(); | 228 process.requestExit(); |
| 214 if (!_isWebSocketDisconnect(e)) { | 229 if (!_isWebSocketDisconnect(e)) { |
| 215 print('Unexpected exception in service tests: $e $st'); | 230 print('Unexpected exception in service tests: $e $st'); |
| 216 throw e; | 231 throw e; |
| 217 } | 232 } |
| 218 }); | 233 }); |
| 219 }); | 234 }); |
| 220 } | 235 } |
| 221 } | 236 } |
| OLD | NEW |