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 } |
| 14 |
| 15 var tests = [ |
| 16 |
| 17 (Isolate isolate) async { |
| 18 Completer completer = new Completer(); |
| 19 var stream = await isolate.vm.getEventStream(VM.kDebugStream); |
| 20 var subscription; |
| 21 subscription = stream.listen((ServiceEvent event) { |
| 22 if (event.kind == ServiceEvent.kPauseStart) { |
| 23 print('Received PauseStart'); |
| 24 subscription.cancel(); |
| 25 completer.complete(); |
| 26 } |
| 27 }); |
| 28 |
| 29 if (isolate.pauseEvent != null && |
| 30 isolate.pauseEvent.kind == ServiceEvent.kPauseStart) { |
| 31 // Wait for the isolate to hit PauseStart. |
| 32 subscription.cancel(); |
| 33 } else { |
| 34 await completer.future; |
| 35 } |
| 36 |
| 37 completer = new Completer(); |
| 38 stream = await isolate.vm.getEventStream(VM.kDebugStream); |
| 39 subscription = stream.listen((ServiceEvent event) { |
| 40 if (event.kind == ServiceEvent.kPauseExit) { |
| 41 print('Received PauseExit'); |
| 42 subscription.cancel(); |
| 43 completer.complete(); |
| 44 } |
| 45 }); |
| 46 |
| 47 print('Resuming...'); |
| 48 isolate.resume(); |
| 49 |
| 50 // Wait for the isolate to hit PauseExit. |
| 51 await completer.future; |
| 52 }, |
| 53 |
| 54 ]; |
| 55 |
| 56 main(args) => runIsolateTests(args, tests, |
| 57 testeeConcurrent: testMain, |
| 58 pause_on_start: true, pause_on_exit: true); |
OLD | NEW |