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 | |
44 (Isolate isolate) async { | 43 (Isolate isolate) async { |
45 ServiceMap stack = await isolate.getStack(); | 44 ServiceMap stack = await isolate.getStack(); |
46 // Has causal frames (we are inside an async function) | 45 // Has causal frames (we are inside an async function) |
47 expect(stack['asyncCausalFrames'], isNotNull); | 46 expect(stack['asyncCausalFrames'], isNotNull); |
48 }, | 47 }, |
49 | |
50 resumeIsolate, | 48 resumeIsolate, |
51 hasStoppedAtBreakpoint, | 49 hasStoppedAtBreakpoint, |
52 stoppedAtLine(LINE_C), | 50 stoppedAtLine(LINE_C), |
53 | |
54 (Isolate isolate) async { | 51 (Isolate isolate) async { |
55 ServiceMap stack = await isolate.getStack(); | 52 ServiceMap stack = await isolate.getStack(); |
56 // Has causal frames (we are inside a function called by an async function) | 53 // Has causal frames (we are inside a function called by an async function) |
57 expect(stack['asyncCausalFrames'], isNotNull); | 54 expect(stack['asyncCausalFrames'], isNotNull); |
58 }, | 55 }, |
59 ]; | 56 ]; |
60 | 57 |
61 main(args) => runIsolateTestsSynchronous(args, | 58 main(args) => |
62 tests, | 59 runIsolateTestsSynchronous(args, tests, testeeConcurrent: testMain); |
63 testeeConcurrent: testMain); | |
OLD | NEW |