OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 // This test is mostly interesting for DBC, which needs to patch two bytecodes | 6 // This test is mostly interesting for DBC, which needs to patch two bytecodes |
7 // to create a breakpoint for fast Smi ops. | 7 // to create a breakpoint for fast Smi ops. |
8 | 8 |
9 import 'package:observatory/service_io.dart'; | 9 import 'package:observatory/service_io.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 import 'service_test_common.dart'; | 11 import 'service_test_common.dart'; |
12 import 'test_helper.dart'; | 12 import 'test_helper.dart'; |
13 import 'dart:developer'; | 13 import 'dart:developer'; |
14 | 14 |
15 const int LINE_A = 26; | 15 const int LINE_A = 26; |
16 const int LINE_B = 27; | 16 const int LINE_B = 27; |
17 const int LINE_C = 28; | 17 const int LINE_C = 28; |
18 | 18 |
19 class NotGeneric {} | 19 class NotGeneric { } |
20 | 20 |
21 testeeMain() { | 21 testeeMain() { |
22 var x = new List(1); | 22 var x = new List(1); |
23 var y = 7; | 23 var y = 7; |
24 debugger(); | 24 debugger(); |
25 print("Statement"); | 25 print("Statement"); |
26 x[0] = 3; // Line A. | 26 x[0] = 3; // Line A. |
27 x is NotGeneric; // Line B. | 27 x is NotGeneric; // Line B. |
28 y & 4; // Line C. | 28 y & 4; // Line C. |
29 } | 29 } |
30 | 30 |
31 var tests = [ | 31 var tests = [ |
32 hasStoppedAtBreakpoint, | 32 |
| 33 hasStoppedAtBreakpoint, |
33 | 34 |
34 // Add breakpoints. | 35 // Add breakpoints. |
35 (Isolate isolate) async { | 36 (Isolate isolate) async { |
36 var rootLib = await isolate.rootLibrary.load(); | 37 var rootLib = await isolate.rootLibrary.load(); |
37 var script = rootLib.scripts[0]; | 38 var script = rootLib.scripts[0]; |
38 | 39 |
39 var bpt1 = await isolate.addBreakpoint(script, LINE_A); | 40 var bpt1 = await isolate.addBreakpoint(script, LINE_A); |
40 print(bpt1); | 41 print(bpt1); |
41 expect(bpt1.resolved, isTrue); | 42 expect(bpt1.resolved, isTrue); |
42 expect(await bpt1.location.getLine(), equals(LINE_A)); | 43 expect(await bpt1.location.getLine(), equals(LINE_A)); |
43 | 44 |
44 var bpt2 = await isolate.addBreakpoint(script, LINE_B); | 45 var bpt2 = await isolate.addBreakpoint(script, LINE_B); |
45 print(bpt2); | 46 print(bpt2); |
46 expect(bpt2.resolved, isTrue); | 47 expect(bpt2.resolved, isTrue); |
47 expect(await bpt2.location.getLine(), equals(LINE_B)); | 48 expect(await bpt2.location.getLine(), equals(LINE_B)); |
48 | 49 |
49 var bpt3 = await isolate.addBreakpoint(script, LINE_C); | 50 var bpt3 = await isolate.addBreakpoint(script, LINE_C); |
50 print(bpt3); | 51 print(bpt3); |
51 expect(bpt3.resolved, isTrue); | 52 expect(bpt3.resolved, isTrue); |
52 expect(await bpt3.location.getLine(), equals(LINE_C)); | 53 expect(await bpt3.location.getLine(), equals(LINE_C)); |
53 }, | 54 }, |
54 | 55 |
55 resumeIsolate, | 56 resumeIsolate, |
56 | 57 |
57 hasStoppedAtBreakpoint, | 58 hasStoppedAtBreakpoint, |
58 stoppedAtLine(LINE_A), | 59 stoppedAtLine(LINE_A), |
59 resumeIsolate, | 60 resumeIsolate, |
60 | 61 |
61 hasStoppedAtBreakpoint, | 62 hasStoppedAtBreakpoint, |
62 stoppedAtLine(LINE_B), | 63 stoppedAtLine(LINE_B), |
63 resumeIsolate, | 64 resumeIsolate, |
64 | 65 |
65 hasStoppedAtBreakpoint, | 66 hasStoppedAtBreakpoint, |
66 stoppedAtLine(LINE_C), | 67 stoppedAtLine(LINE_C), |
67 resumeIsolate, | 68 resumeIsolate, |
| 69 |
68 ]; | 70 ]; |
69 | 71 |
70 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeMain); | 72 main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeMain); |
OLD | NEW |