OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 // VMOptions=--error_on_bad_type --error_on_bad_override | 4 // VMOptions=--error_on_bad_type --error_on_bad_override |
5 | 5 |
6 import 'dart:developer'; | 6 import 'dart:developer'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:isolate' show ReceivePort; | 8 import 'dart:isolate' show ReceivePort; |
9 import 'package:observatory/models.dart' as M; | 9 import 'package:observatory/models.dart' as M; |
10 import 'package:observatory/service_io.dart'; | 10 import 'package:observatory/service_io.dart'; |
11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 import 'service_test_common.dart'; | 12 import 'service_test_common.dart'; |
13 import 'test_helper.dart'; | 13 import 'test_helper.dart'; |
14 | 14 |
15 var receivePort; | 15 var receivePort; |
16 | 16 |
17 void testMain() { | 17 void testMain() { |
18 receivePort = new ReceivePort(); | 18 receivePort = new ReceivePort(); |
19 debugger(); | 19 debugger(); |
20 } | 20 } |
21 | 21 |
22 var tests = [ | 22 var tests = [ |
23 hasStoppedAtBreakpoint, | |
24 (Isolate isolate) async { | |
25 print('Resuming...'); | |
26 await isolate.resume(); | |
27 | 23 |
28 // Wait for the isolate to become idle. We detect this by querying | 24 hasStoppedAtBreakpoint, |
29 // the stack until it becomes empty. | |
30 var frameCount; | |
31 do { | |
32 var stack = await isolate.getStack(); | |
33 frameCount = stack['frames'].length; | |
34 print('Frames: $frameCount'); | |
35 sleep(const Duration(milliseconds: 10)); | |
36 } while (frameCount > 0); | |
37 print('Isolate is idle.'); | |
38 await isolate.reload(); | |
39 expect(isolate.pauseEvent is M.ResumeEvent, isTrue); | |
40 | 25 |
41 // Make sure that the isolate receives an interrupt even when it is | 26 (Isolate isolate) async { |
42 // idle. (https://github.com/dart-lang/sdk/issues/24349) | 27 print('Resuming...'); |
43 var interruptFuture = hasPausedFor(isolate, ServiceEvent.kPauseInterrupted); | 28 await isolate.resume(); |
44 print('Pausing...'); | 29 |
45 await isolate.pause(); | 30 // Wait for the isolate to become idle. We detect this by querying |
46 await interruptFuture; | 31 // the stack until it becomes empty. |
47 }, | 32 var frameCount; |
| 33 do { |
| 34 var stack = await isolate.getStack(); |
| 35 frameCount = stack['frames'].length; |
| 36 print('Frames: $frameCount'); |
| 37 sleep(const Duration(milliseconds:10)); |
| 38 } while (frameCount > 0); |
| 39 print('Isolate is idle.'); |
| 40 await isolate.reload(); |
| 41 expect(isolate.pauseEvent is M.ResumeEvent, isTrue); |
| 42 |
| 43 // Make sure that the isolate receives an interrupt even when it is |
| 44 // idle. (https://github.com/dart-lang/sdk/issues/24349) |
| 45 var interruptFuture = hasPausedFor(isolate, ServiceEvent.kPauseInterrupted); |
| 46 print('Pausing...'); |
| 47 await isolate.pause(); |
| 48 await interruptFuture; |
| 49 }, |
| 50 |
48 ]; | 51 ]; |
49 | 52 |
50 main(args) => runIsolateTests(args, tests, | 53 main(args) => runIsolateTests(args, tests, |
51 testeeConcurrent: testMain, | 54 testeeConcurrent: testMain, |
52 verbose_vm: true, | 55 verbose_vm: true, |
53 extraArgs: ['--trace-service', '--trace-service-verbose']); | 56 extraArgs: [ '--trace-service', |
| 57 '--trace-service-verbose' ]); |
OLD | NEW |