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 'package:observatory/models.dart' as M; | 6 import 'package:observatory/models.dart' as M; |
7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
8 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'dart:developer'; | 10 import 'dart:developer'; |
11 import 'service_test_common.dart'; | 11 import 'service_test_common.dart'; |
12 | 12 |
13 const int LINE_A = 20; | 13 const int LINE_A = 20; |
14 | 14 |
15 foo() async {} | 15 foo() async { } |
16 bar() {} | 16 bar() { } |
17 | 17 |
18 doAsync(stop) async { | 18 doAsync(stop) async { |
19 if (stop) debugger(); | 19 if (stop) debugger(); |
20 await foo(); // Line A. | 20 await foo(); // Line A. |
21 bar(); // Line A + 1. | 21 bar(); // Line A + 1. |
22 bar(); // Line A + 2. | 22 bar(); // Line A + 2. |
23 await foo(); // Line A + 3. | 23 await foo(); // Line A + 3. |
24 await foo(); // Line A + 4. | 24 await foo(); // Line A + 4. |
25 bar(); // Line A + 5. | 25 bar(); // Line A + 5. |
26 return null; | 26 return null; |
27 } | 27 } |
28 | 28 |
29 testMain() { | 29 testMain() { |
30 // With two runs of doAsync floating around, async step should only cause | 30 // With two runs of doAsync floating around, async step should only cause |
31 // us to stop in the run we started in. | 31 // us to stop in the run we started in. |
32 doAsync(false); | 32 doAsync(false); |
33 doAsync(true); | 33 doAsync(true); |
34 } | 34 } |
35 | 35 |
(...skipping 16 matching lines...) Expand all Loading... |
52 if (M.isAtAsyncSuspension(isolate.pauseEvent)) { | 52 if (M.isAtAsyncSuspension(isolate.pauseEvent)) { |
53 print("next-async"); | 53 print("next-async"); |
54 return asyncStepOver(isolate); | 54 return asyncStepOver(isolate); |
55 } else { | 55 } else { |
56 print("next-sync"); | 56 print("next-sync"); |
57 return stepOverAwaitingResume(isolate); | 57 return stepOverAwaitingResume(isolate); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 var tests = [ | 61 var tests = [ |
62 hasStoppedAtBreakpoint, stoppedAtLine(LINE_A), // foo() | 62 hasStoppedAtBreakpoint, stoppedAtLine(LINE_A), // foo() |
63 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A), // await | 63 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A), // await |
64 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 1), // bar() | 64 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 1), // bar() |
65 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 2), // bar() | 65 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 2), // bar() |
66 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 3), // foo() | 66 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 3), // foo() |
67 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 3), // await | 67 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 3), // await |
68 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 4), // foo() | 68 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 4), // foo() |
69 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 4), // await | 69 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 4), // await |
70 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 5), // bar() | 70 smartNext, hasStoppedAtBreakpoint, stoppedAtLine(LINE_A + 5), // bar() |
71 resumeIsolate, | 71 resumeIsolate, |
72 ]; | 72 ]; |
73 | 73 |
74 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 74 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |