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 --verbose_debug | 4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug |
5 | 5 |
6 import 'package:observatory/service_io.dart'; | 6 import 'package:observatory/service_io.dart'; |
7 import 'service_test_common.dart'; | 7 import 'service_test_common.dart'; |
| 8 import 'dart:async'; |
8 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
9 import 'dart:developer'; | 10 import 'dart:developer'; |
10 | 11 |
11 const int LINE_A = 19; | 12 const int LINE_A = 20; |
12 const int LINE_B = 20; | 13 const int LINE_B = 23; |
13 const int LINE_C = 21; | 14 const int LINE_C = 24; |
| 15 const int LINE_D = 26; |
| 16 const int LINE_E = 27; |
14 | 17 |
15 foo() async { } | 18 testMain() async { |
| 19 debugger(); |
| 20 Future future1 = new Future.value(); // LINE_A. |
| 21 Future future2 = new Future.value(); |
16 | 22 |
17 doAsync(stop) async { | 23 await future1; // LINE_B. |
18 if (stop) debugger(); | 24 await future2; // LINE_C. |
19 await foo(); // Line A. | |
20 await foo(); // Line B. | |
21 await foo(); // Line C. | |
22 return null; | |
23 } | |
24 | 25 |
25 testMain() { | 26 print('foo1'); // LINE_D. |
26 // With two runs of doAsync floating around, async step should only cause | 27 print('foo2'); // LINE_E. |
27 // us to stop in the run we started in. | |
28 doAsync(false); | |
29 doAsync(true); | |
30 } | |
31 | |
32 asyncNext(Isolate isolate) async { | |
33 print('asyncNext'); | |
34 return asyncStepOver(isolate); | |
35 } | 28 } |
36 | 29 |
37 var tests = [ | 30 var tests = [ |
38 hasStoppedAtBreakpoint, | 31 hasStoppedAtBreakpoint, |
39 stoppedAtLine(LINE_A), | 32 stoppedAtLine(LINE_A), |
40 stepOver, // foo() | 33 smartNext, |
41 asyncNext, | |
42 hasStoppedAtBreakpoint, | 34 hasStoppedAtBreakpoint, |
| 35 smartNext, |
43 stoppedAtLine(LINE_B), | 36 stoppedAtLine(LINE_B), |
44 stepOver, // foo() | 37 smartNext, |
45 asyncNext, | |
46 hasStoppedAtBreakpoint, | 38 hasStoppedAtBreakpoint, |
47 stoppedAtLine(LINE_C), | 39 stoppedAtLine(LINE_C), |
| 40 smartNext, |
| 41 hasStoppedAtBreakpoint, |
| 42 stoppedAtLine(LINE_D), |
48 resumeIsolate, | 43 resumeIsolate, |
49 ]; | 44 ]; |
50 | 45 |
51 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 46 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |