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