OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 --verbose_debug | 4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug |
5 | 5 |
6 import 'dart:developer'; | 6 import 'dart:developer'; |
7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
11 | 11 |
12 const LINE_C = 18; | 12 const LINE_C = 18; |
13 const LINE_A = 23; | 13 const LINE_A = 23; |
14 const LINE_B = 29; | 14 const LINE_B = 29; |
15 | 15 |
16 foobar() { | 16 foobar() { |
17 debugger(); | 17 debugger(); |
18 print('foobar'); // LINE_C. | 18 print('foobar'); // LINE_C. |
19 } | 19 } |
20 | 20 |
21 helper() async { | 21 helper() async { |
22 debugger(); | 22 debugger(); |
23 print('helper'); // LINE_A. | 23 print('helper'); // LINE_A. |
24 foobar(); | 24 foobar(); |
25 } | 25 } |
26 | 26 |
27 testMain() { | 27 testMain() { |
28 debugger(); | 28 debugger(); |
29 helper(); // LINE_B. | 29 helper(); // LINE_B. |
30 } | 30 } |
31 | 31 |
32 var tests = [ | 32 var tests = [ |
33 hasStoppedAtBreakpoint, | 33 hasStoppedAtBreakpoint, |
34 stoppedAtLine(LINE_B), | 34 stoppedAtLine(LINE_B), |
35 (Isolate isolate) async { | 35 (Isolate isolate) async { |
36 ServiceMap stack = await isolate.getStack(); | 36 ServiceMap stack = await isolate.getStack(); |
37 // No causal frames because we are in a completely synchronous stack. | 37 // No causal frames because we are in a completely synchronous stack. |
38 expect(stack['asyncCausalFrames'], isNull); | 38 expect(stack['asyncCausalFrames'], isNull); |
39 }, | 39 }, |
40 resumeIsolate, | 40 resumeIsolate, |
41 hasStoppedAtBreakpoint, | 41 hasStoppedAtBreakpoint, |
42 stoppedAtLine(LINE_A), | 42 stoppedAtLine(LINE_A), |
| 43 |
43 (Isolate isolate) async { | 44 (Isolate isolate) async { |
44 ServiceMap stack = await isolate.getStack(); | 45 ServiceMap stack = await isolate.getStack(); |
45 // Has causal frames (we are inside an async function) | 46 // Has causal frames (we are inside an async function) |
46 expect(stack['asyncCausalFrames'], isNotNull); | 47 expect(stack['asyncCausalFrames'], isNotNull); |
47 }, | 48 }, |
| 49 |
48 resumeIsolate, | 50 resumeIsolate, |
49 hasStoppedAtBreakpoint, | 51 hasStoppedAtBreakpoint, |
50 stoppedAtLine(LINE_C), | 52 stoppedAtLine(LINE_C), |
| 53 |
51 (Isolate isolate) async { | 54 (Isolate isolate) async { |
52 ServiceMap stack = await isolate.getStack(); | 55 ServiceMap stack = await isolate.getStack(); |
53 // Has causal frames (we are inside a function called by an async function) | 56 // Has causal frames (we are inside a function called by an async function) |
54 expect(stack['asyncCausalFrames'], isNotNull); | 57 expect(stack['asyncCausalFrames'], isNotNull); |
55 }, | 58 }, |
56 ]; | 59 ]; |
57 | 60 |
58 main(args) => | 61 main(args) => runIsolateTestsSynchronous(args, |
59 runIsolateTestsSynchronous(args, tests, testeeConcurrent: testMain); | 62 tests, |
| 63 testeeConcurrent: testMain); |
OLD | NEW |