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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 var subscription; | 146 var subscription; |
147 subscription = vm.events.stream.listen((ServiceEvent event) { | 147 subscription = vm.events.stream.listen((ServiceEvent event) { |
148 handler(event, subscription, completer); | 148 handler(event, subscription, completer); |
149 }); | 149 }); |
150 return completer.future; | 150 return completer.future; |
151 } | 151 } |
152 | 152 |
153 | 153 |
154 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) { | 154 Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) { |
155 if ((isolate.pauseEvent != null) && | 155 if ((isolate.pauseEvent != null) && |
156 (isolate.pauseEvent.eventType == ServiceEvent.kPauseBreakpoint)) { | 156 (isolate.pauseEvent.kind == ServiceEvent.kPauseBreakpoint)) { |
157 // Already waiting at a breakpoint. | 157 // Already waiting at a breakpoint. |
158 print('Breakpoint reached'); | 158 print('Breakpoint reached'); |
159 return new Future.value(isolate); | 159 return new Future.value(isolate); |
160 } | 160 } |
161 | 161 |
162 // Set up a listener to wait for breakpoint events. | 162 // Set up a listener to wait for breakpoint events. |
163 Completer completer = new Completer(); | 163 Completer completer = new Completer(); |
164 var subscription; | 164 var subscription; |
165 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { | 165 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { |
166 if (event.eventType == 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 /// Runs [tests] in sequence, each of which should take an [Isolate] and | 176 /// Runs [tests] in sequence, each of which should take an [Isolate] and |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 }, onError: (e, st) { | 212 }, onError: (e, st) { |
213 process.requestExit(); | 213 process.requestExit(); |
214 if (!_isWebSocketDisconnect(e)) { | 214 if (!_isWebSocketDisconnect(e)) { |
215 print('Unexpected exception in service tests: $e $st'); | 215 print('Unexpected exception in service tests: $e $st'); |
216 throw e; | 216 throw e; |
217 } | 217 } |
218 }); | 218 }); |
219 }); | 219 }); |
220 } | 220 } |
221 } | 221 } |
OLD | NEW |