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 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'service_test_common.dart'; | 8 import 'service_test_common.dart'; |
9 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
10 import 'dart:developer'; | 10 import 'dart:developer'; |
11 | 11 |
12 const int LINE_A = 14; | 12 const int LINE_A = 14; |
13 | 13 |
14 testFunction(flag) { // Line A. | 14 testFunction(flag) { |
| 15 // Line A. |
15 if (flag) { | 16 if (flag) { |
16 print("Yes"); | 17 print("Yes"); |
17 } else { | 18 } else { |
18 print("No"); | 19 print("No"); |
19 } | 20 } |
20 } | 21 } |
21 | 22 |
22 testMain() { | 23 testMain() { |
23 debugger(); | 24 debugger(); |
24 testFunction(true); | 25 testFunction(true); |
25 testFunction(false); | 26 testFunction(false); |
26 print("Done"); | 27 print("Done"); |
27 } | 28 } |
28 | 29 |
29 var tests = [ | 30 var tests = [ |
30 | 31 hasStoppedAtBreakpoint, |
31 hasStoppedAtBreakpoint, | |
32 | 32 |
33 // Add breakpoint | 33 // Add breakpoint |
34 (Isolate isolate) async { | 34 (Isolate isolate) async { |
35 var rootLib = await isolate.rootLibrary.load(); | 35 var rootLib = await isolate.rootLibrary.load(); |
36 var function = rootLib.functions.singleWhere((f) => f.name == 'testFunction'); | 36 var function = |
| 37 rootLib.functions.singleWhere((f) => f.name == 'testFunction'); |
37 | 38 |
38 var bpt = await isolate.addBreakpointAtEntry(function); | 39 var bpt = await isolate.addBreakpointAtEntry(function); |
39 expect(bpt is Breakpoint, isTrue); | 40 expect(bpt is Breakpoint, isTrue); |
40 print(bpt); | 41 print(bpt); |
41 }, | 42 }, |
42 | 43 |
43 resumeIsolate, | 44 resumeIsolate, |
44 | 45 |
45 hasStoppedAtBreakpoint, | 46 hasStoppedAtBreakpoint, |
46 stoppedAtLine(LINE_A), | 47 stoppedAtLine(LINE_A), |
47 resumeIsolate, | 48 resumeIsolate, |
48 | 49 |
49 hasStoppedAtBreakpoint, | 50 hasStoppedAtBreakpoint, |
50 stoppedAtLine(LINE_A), | 51 stoppedAtLine(LINE_A), |
51 resumeIsolate, | 52 resumeIsolate, |
52 | |
53 ]; | 53 ]; |
54 | 54 |
55 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 55 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |