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 'dart:developer'; | 6 import 'package:observatory/service_io.dart'; |
7 import 'dart:io'; | |
8 | |
9 import 'service_test_common.dart'; | 7 import 'service_test_common.dart'; |
10 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
| 9 import 'dart:developer'; |
| 10 |
| 11 const int LINE_A = 19; |
| 12 const int LINE_B = 20; |
| 13 const int LINE_C = 21; |
11 | 14 |
12 foo() async {} | 15 foo() async {} |
13 | 16 |
14 doAsync(stop) async { | 17 doAsync(stop) async { |
15 if (stop) debugger(); | 18 if (stop) debugger(); |
16 await foo(); // LINE_A. | 19 await foo(); // Line A. |
17 await foo(); // LINE_B. | 20 await foo(); // Line B. |
18 await foo(); // LINE_C. | 21 await foo(); // Line C. |
19 return null; | 22 return null; |
20 } | 23 } |
21 | 24 |
22 testMain() { | 25 testMain() { |
23 // With two runs of doAsync floating around, async step should only cause | 26 // With two runs of doAsync floating around, async step should only cause |
24 // us to stop in the run we started in. | 27 // us to stop in the run we started in. |
25 doAsync(false); | 28 doAsync(false); |
26 doAsync(true); | 29 doAsync(true); |
27 } | 30 } |
28 | 31 |
29 final ScriptLineParser lineParser = new ScriptLineParser(Platform.script); | |
30 | |
31 var tests = [ | 32 var tests = [ |
32 hasStoppedAtBreakpoint, | 33 hasStoppedAtBreakpoint, |
33 stoppedAtLine(lineParser.lineFor('LINE_A')), | 34 stoppedAtLine(LINE_A), |
34 stepOver, // foo() | 35 stepOver, // foo() |
35 asyncNext, | 36 asyncNext, |
36 hasStoppedAtBreakpoint, | 37 hasStoppedAtBreakpoint, |
37 stoppedAtLine(lineParser.lineFor('LINE_B')), | 38 stoppedAtLine(LINE_B), |
38 stepOver, // foo() | 39 stepOver, // foo() |
39 asyncNext, | 40 asyncNext, |
40 hasStoppedAtBreakpoint, | 41 hasStoppedAtBreakpoint, |
41 stoppedAtLine(lineParser.lineFor('LINE_C')), | 42 stoppedAtLine(LINE_C), |
42 resumeIsolate, | 43 resumeIsolate, |
43 ]; | 44 ]; |
44 | 45 |
45 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 46 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |