| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 vm.getEventStream(streamId).then((stream) { | 148 vm.getEventStream(streamId).then((stream) { |
| 149 var subscription; | 149 var subscription; |
| 150 subscription = stream.listen((ServiceEvent event) { | 150 subscription = stream.listen((ServiceEvent event) { |
| 151 handler(event, subscription, completer); | 151 handler(event, subscription, completer); |
| 152 }); | 152 }); |
| 153 }); | 153 }); |
| 154 return completer.future; | 154 return completer.future; |
| 155 } | 155 } |
| 156 | 156 |
| 157 | 157 |
| 158 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) { | 158 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) async { |
| 159 await isolate.reload(); // Might have missed pauseEvent. |
| 160 |
| 159 if ((isolate.pauseEvent != null) && | 161 if ((isolate.pauseEvent != null) && |
| 160 (isolate.pauseEvent.kind == ServiceEvent.kPauseBreakpoint)) { | 162 (isolate.pauseEvent.kind == ServiceEvent.kPauseBreakpoint)) { |
| 161 // Already waiting at a breakpoint. | 163 // Already waiting at a breakpoint. |
| 162 print('Breakpoint reached'); | 164 print('Breakpoint reached'); |
| 163 return new Future.value(isolate); | 165 return new Future.value(isolate); |
| 164 } | 166 } |
| 165 | 167 |
| 166 // Set up a listener to wait for breakpoint events. | 168 // Set up a listener to wait for breakpoint events. |
| 167 Completer completer = new Completer(); | 169 Completer completer = new Completer(); |
| 168 isolate.vm.getEventStream(VM.kDebugStream).then((stream) { | 170 isolate.vm.getEventStream(VM.kDebugStream).then((stream) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 }, onError: (e, st) { | 237 }, onError: (e, st) { |
| 236 process.requestExit(); | 238 process.requestExit(); |
| 237 if (!_isWebSocketDisconnect(e)) { | 239 if (!_isWebSocketDisconnect(e)) { |
| 238 print('Unexpected exception in service tests: $e $st'); | 240 print('Unexpected exception in service tests: $e $st'); |
| 239 throw e; | 241 throw e; |
| 240 } | 242 } |
| 241 }); | 243 }); |
| 242 }); | 244 }); |
| 243 } | 245 } |
| 244 } | 246 } |
| OLD | NEW |