Index: runtime/observatory/tests/service/test_helper.dart |
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart |
index 6c6c223bdfacbd4e46e1ce522c49cfb4a4c032f4..fa453df163b618b13e2626caaab1aec650633e94 100644 |
--- a/runtime/observatory/tests/service/test_helper.dart |
+++ b/runtime/observatory/tests/service/test_helper.dart |
@@ -164,7 +164,6 @@ Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) { |
isolate.vm.getEventStream(VM.kDebugStream).then((stream) { |
var subscription; |
subscription = stream.listen((ServiceEvent event) { |
- print("Event: $event"); |
if (event.kind == ServiceEvent.kPauseBreakpoint) { |
print('Breakpoint reached'); |
subscription.cancel(); |
@@ -195,6 +194,41 @@ Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) { |
} |
+Future<Isolate> hasPausedAtStart(Isolate isolate) { |
+ // Set up a listener to wait for breakpoint events. |
+ Completer completer = new Completer(); |
+ isolate.vm.getEventStream(VM.kDebugStream).then((stream) { |
+ var subscription; |
+ subscription = stream.listen((ServiceEvent event) { |
+ if (event.kind == ServiceEvent.kPauseStart) { |
+ print('Paused at isolate start'); |
+ subscription.cancel(); |
+ if (completer != null) { |
+ // Reload to update isolate.pauseEvent. |
+ completer.complete(isolate.reload()); |
+ completer = null; |
+ } |
+ } |
+ }); |
+ |
+ // Pause may have happened before we subscribed. |
+ isolate.reload().then((_) { |
+ if ((isolate.pauseEvent != null) && |
+ (isolate.pauseEvent.kind == ServiceEvent.kPauseStart)) { |
+ print('Paused at isolate start'); |
+ subscription.cancel(); |
+ if (completer != null) { |
+ completer.complete(isolate); |
+ completer = null; |
+ } |
+ } |
+ }); |
+ }); |
+ |
+ return completer.future; |
+} |
+ |
+ |
// Currying is your friend. |
IsolateTest setBreakpointAtLine(int line) { |
return (Isolate isolate) async { |