Index: runtime/observatory/tests/service/pause_on_start_then_step_test.dart |
diff --git a/runtime/observatory/tests/service/pause_on_start_then_step_test.dart b/runtime/observatory/tests/service/pause_on_start_then_step_test.dart |
index 480d984688189734e70534fff5fa41cc52a48c36..a51112341438e2aa3fbe743a6be990889e9a42d3 100644 |
--- a/runtime/observatory/tests/service/pause_on_start_then_step_test.dart |
+++ b/runtime/observatory/tests/service/pause_on_start_then_step_test.dart |
@@ -14,81 +14,77 @@ void testMain() { |
} |
var tests = [ |
+ (Isolate isolate) async { |
+ print('Getting stream...'); |
+ Completer completer = new Completer(); |
+ var stream = await isolate.vm.getEventStream(VM.kDebugStream); |
+ print('Subscribing...'); |
+ var subscription; |
+ subscription = stream.listen((ServiceEvent event) { |
+ if (event.kind == ServiceEvent.kPauseStart) { |
+ print('Received $event'); |
+ subscription.cancel(); |
+ completer.complete(); |
+ } else { |
+ print('Ignoring event $event'); |
+ } |
+ }); |
+ print('Subscribed. Pause event is ${isolate.pauseEvent}'); |
-(Isolate isolate) async { |
- print('Getting stream...'); |
- Completer completer = new Completer(); |
- var stream = await isolate.vm.getEventStream(VM.kDebugStream); |
- print('Subscribing...'); |
- var subscription; |
- subscription = stream.listen((ServiceEvent event) { |
- if (event.kind == ServiceEvent.kPauseStart) { |
- print('Received $event'); |
+ if (isolate.pauseEvent != null && isolate.pauseEvent is M.PauseStartEvent) { |
+ // Wait for the isolate to hit PauseStart. |
subscription.cancel(); |
- completer.complete(); |
+ print('Subscription cancelled.'); |
} else { |
- print('Ignoring event $event'); |
+ print('Waiting for pause start event.'); |
+ await completer.future; |
} |
- }); |
- print('Subscribed. Pause event is ${isolate.pauseEvent}'); |
+ print('Done waiting for pause event.'); |
- if (isolate.pauseEvent != null && |
- isolate.pauseEvent is M.PauseStartEvent) { |
- // Wait for the isolate to hit PauseStart. |
- subscription.cancel(); |
- print('Subscription cancelled.'); |
- } else { |
- print('Waiting for pause start event.'); |
- await completer.future; |
- } |
- print('Done waiting for pause event.'); |
- |
- // Grab the timestamp. |
- var pausetime1 = isolate.pauseEvent.timestamp; |
- expect(pausetime1, isNotNull); |
- // Reload the isolate. |
- await isolate.reload(); |
- // Verify that it is the same. |
- expect(pausetime1.millisecondsSinceEpoch, |
- equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch)); |
+ // Grab the timestamp. |
+ var pausetime1 = isolate.pauseEvent.timestamp; |
+ expect(pausetime1, isNotNull); |
+ // Reload the isolate. |
+ await isolate.reload(); |
+ // Verify that it is the same. |
+ expect(pausetime1.millisecondsSinceEpoch, |
+ equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch)); |
- completer = new Completer(); |
- stream = await isolate.vm.getEventStream(VM.kDebugStream); |
- subscription = stream.listen((ServiceEvent event) { |
- if (event.kind == ServiceEvent.kPauseBreakpoint) { |
- print('Received PauseBreakpoint'); |
- subscription.cancel(); |
- completer.complete(); |
- } |
- print('Got ${event.kind}'); |
- }); |
+ completer = new Completer(); |
+ stream = await isolate.vm.getEventStream(VM.kDebugStream); |
+ subscription = stream.listen((ServiceEvent event) { |
+ if (event.kind == ServiceEvent.kPauseBreakpoint) { |
+ print('Received PauseBreakpoint'); |
+ subscription.cancel(); |
+ completer.complete(); |
+ } |
+ print('Got ${event.kind}'); |
+ }); |
- print('Stepping...'); |
- isolate.stepInto(); |
+ print('Stepping...'); |
+ isolate.stepInto(); |
- // Wait for the isolate to hit PauseBreakpoint. |
- print('Waiting for PauseBreakpoint'); |
- await completer.future; |
+ // Wait for the isolate to hit PauseBreakpoint. |
+ print('Waiting for PauseBreakpoint'); |
+ await completer.future; |
- // Grab the timestamp. |
- var pausetime2 = isolate.pauseEvent.timestamp; |
- expect(pausetime2, isNotNull); |
- // Reload the isolate. |
- await isolate.reload(); |
- // Verify that it is the same. |
- expect(pausetime2.millisecondsSinceEpoch, |
- equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch)); |
+ // Grab the timestamp. |
+ var pausetime2 = isolate.pauseEvent.timestamp; |
+ expect(pausetime2, isNotNull); |
+ // Reload the isolate. |
+ await isolate.reload(); |
+ // Verify that it is the same. |
+ expect(pausetime2.millisecondsSinceEpoch, |
+ equals(isolate.pauseEvent.timestamp.millisecondsSinceEpoch)); |
- expect(pausetime2.millisecondsSinceEpoch, |
+ expect(pausetime2.millisecondsSinceEpoch, |
greaterThan(pausetime1.millisecondsSinceEpoch)); |
-}, |
- |
+ }, |
]; |
main(args) => runIsolateTests(args, tests, |
- testeeConcurrent: testMain, |
- pause_on_start: true, |
- pause_on_exit: true, |
- verbose_vm: true, |
- extraArgs: [ '--trace-service', |
- '--trace-service-verbose' ]); |
+ testeeConcurrent: testMain, |
+ pause_on_start: true, |
+ pause_on_exit: true, |
+ verbose_vm: true, |
+ extraArgs: ['--trace-service', '--trace-service-verbose']); |