| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override | |
| 5 | |
| 6 import 'package:observatory/service_io.dart'; | |
| 7 import 'package:unittest/unittest.dart'; | |
| 8 import 'test_helper.dart'; | |
| 9 import 'dart:async'; | |
| 10 | |
| 11 void testMain() { | |
| 12 print('Hello'); | |
| 13 exit(0); | |
| 14 } | |
| 15 | |
| 16 var tests = [ | |
| 17 | |
| 18 (Isolate isolate) async { | |
| 19 Completer completer = new Completer(); | |
| 20 var stream = await isolate.vm.getEventStream(VM.kDebugStream); | |
| 21 var subscription; | |
| 22 subscription = stream.listen((ServiceEvent event) { | |
| 23 if (event.kind == ServiceEvent.kPauseStart) { | |
| 24 print('Received PauseStart'); | |
| 25 subscription.cancel(); | |
| 26 completer.complete(); | |
| 27 } | |
| 28 }); | |
| 29 | |
| 30 if (isolate.pauseEvent != null && | |
| 31 isolate.pauseEvent.kind == ServiceEvent.kPauseStart) { | |
| 32 // Wait for the isolate to hit PauseStart. | |
| 33 subscription.cancel(); | |
| 34 } else { | |
| 35 await completer.future; | |
| 36 } | |
| 37 | |
| 38 completer = new Completer(); | |
| 39 stream = await isolate.vm.getEventStream(VM.kDebugStream); | |
| 40 subscription = stream.listen((ServiceEvent event) { | |
| 41 if (event.kind == ServiceEvent.kPauseExit) { | |
| 42 print('Received PauseExit'); | |
| 43 subscription.cancel(); | |
| 44 completer.complete(); | |
| 45 } | |
| 46 }); | |
| 47 | |
| 48 print('Resuming...'); | |
| 49 isolate.resume(); | |
| 50 | |
| 51 // Wait for the isolate to hit PauseExit. | |
| 52 await completer.future; | |
| 53 }, | |
| 54 | |
| 55 ]; | |
| 56 | |
| 57 main(args) => runIsolateTests(args, tests, | |
| 58 testeeConcurrent: testMain, | |
| 59 pause_on_start: true, pause_on_exit: true); | |
| OLD | NEW |