Index: runtime/observatory/tests/service/pause_on_start_and_exit_test.dart |
diff --git a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart b/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart |
index b292b31d8111f8c1827935af75cedf5f5f71ab50..0ccd29df0861effbc41346ef29c9b8ce8381bda5 100644 |
--- a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart |
+++ b/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart |
@@ -14,78 +14,74 @@ 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)); |
- |
- completer = new Completer(); |
- stream = await isolate.vm.getEventStream(VM.kDebugStream); |
- subscription = stream.listen((ServiceEvent event) { |
- if (event.kind == ServiceEvent.kPauseExit) { |
- print('Received PauseExit'); |
- subscription.cancel(); |
- completer.complete(); |
- } |
- }); |
+ // 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)); |
- print('Resuming...'); |
- isolate.resume(); |
+ completer = new Completer(); |
+ stream = await isolate.vm.getEventStream(VM.kDebugStream); |
+ subscription = stream.listen((ServiceEvent event) { |
+ if (event.kind == ServiceEvent.kPauseExit) { |
+ print('Received PauseExit'); |
+ subscription.cancel(); |
+ completer.complete(); |
+ } |
+ }); |
- // Wait for the isolate to hit PauseExit. |
- await completer.future; |
+ print('Resuming...'); |
+ isolate.resume(); |
- // 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, |
- greaterThan(pausetime1.millisecondsSinceEpoch)); |
-}, |
+ // Wait for the isolate to hit PauseExit. |
+ 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)); |
+ 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']); |