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=--compile-all --error_on_bad_type --error_on_bad_override | 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override |
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 'test_helper.dart'; | 8 import 'test_helper.dart'; |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 | 51 |
52 var tests = [ | 52 var tests = [ |
53 (Isolate isolate) async { | 53 (Isolate isolate) async { |
54 var rootLib = await isolate.rootLibrary.load(); | 54 var rootLib = await isolate.rootLibrary.load(); |
55 | 55 |
56 var breaksHit = 0; | 56 var breaksHit = 0; |
57 | 57 |
58 var subscription; | 58 var subscription; |
59 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { | 59 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { |
60 if (event.eventType == ServiceEvent.kPauseBreakpoint) { | 60 if (event.kind == ServiceEvent.kPauseBreakpoint) { |
61 print("Hit breakpoint ${event.breakpoint}"); | 61 print("Hit breakpoint ${event.breakpoint}"); |
62 breaksHit++; | 62 breaksHit++; |
63 isolate.resume(); | 63 isolate.resume(); |
64 } | 64 } |
65 }); | 65 }); |
66 | 66 |
67 valueOfField(String name) async { | 67 valueOfField(String name) async { |
68 var field = rootLib.variables.singleWhere((v) => v.name == name); | 68 var field = rootLib.variables.singleWhere((v) => v.name == name); |
69 await field.load(); | 69 await field.load(); |
70 return field.staticValue; | 70 return field.staticValue; |
(...skipping 22 matching lines...) Expand all Loading... |
93 await subscription.cancel(); | 93 await subscription.cancel(); |
94 }, | 94 }, |
95 | 95 |
96 (Isolate isolate) async { | 96 (Isolate isolate) async { |
97 var rootLib = await isolate.rootLibrary.load(); | 97 var rootLib = await isolate.rootLibrary.load(); |
98 | 98 |
99 var breaksHit = 0; | 99 var breaksHit = 0; |
100 | 100 |
101 var subscription; | 101 var subscription; |
102 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { | 102 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { |
103 if (event.eventType == ServiceEvent.kPauseBreakpoint) { | 103 if (event.kind == ServiceEvent.kPauseBreakpoint) { |
104 print("Hit breakpoint ${event.breakpoint}"); | 104 print("Hit breakpoint ${event.breakpoint}"); |
105 breaksHit++; | 105 breaksHit++; |
106 isolate.resume(); | 106 isolate.resume(); |
107 } | 107 } |
108 }); | 108 }); |
109 | 109 |
110 valueOfField(String name) async { | 110 valueOfField(String name) async { |
111 var field = rootLib.variables.singleWhere((v) => v.name == name); | 111 var field = rootLib.variables.singleWhere((v) => v.name == name); |
112 await field.load(); | 112 await field.load(); |
113 return field.staticValue; | 113 return field.staticValue; |
(...skipping 21 matching lines...) Expand all Loading... |
135 await subscription.cancel(); | 135 await subscription.cancel(); |
136 }, | 136 }, |
137 | 137 |
138 (Isolate isolate) async { | 138 (Isolate isolate) async { |
139 var rootLib = await isolate.rootLibrary.load(); | 139 var rootLib = await isolate.rootLibrary.load(); |
140 | 140 |
141 var breaksHit = 0; | 141 var breaksHit = 0; |
142 | 142 |
143 var subscription; | 143 var subscription; |
144 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { | 144 subscription = isolate.vm.events.stream.listen((ServiceEvent event) { |
145 if (event.eventType == ServiceEvent.kPauseBreakpoint) { | 145 if (event.kind == ServiceEvent.kPauseBreakpoint) { |
146 print("Hit breakpoint ${event.breakpoint}"); | 146 print("Hit breakpoint ${event.breakpoint}"); |
147 breaksHit++; | 147 breaksHit++; |
148 isolate.resume(); | 148 isolate.resume(); |
149 } | 149 } |
150 }); | 150 }); |
151 | 151 |
152 valueOfField(String name) async { | 152 valueOfField(String name) async { |
153 var field = rootLib.variables.singleWhere((v) => v.name == name); | 153 var field = rootLib.variables.singleWhere((v) => v.name == name); |
154 await field.load(); | 154 await field.load(); |
155 return field.staticValue; | 155 return field.staticValue; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 res = await rootLib.evaluate("testeeDo()"); | 189 res = await rootLib.evaluate("testeeDo()"); |
190 expect(res is Instance, isTrue); // Not error. | 190 expect(res is Instance, isTrue); // Not error. |
191 expect(breaksHit, equals(4)); | 191 expect(breaksHit, equals(4)); |
192 | 192 |
193 await subscription.cancel(); | 193 await subscription.cancel(); |
194 }, | 194 }, |
195 | 195 |
196 ]; | 196 ]; |
197 | 197 |
198 main(args) => runIsolateTests(args, tests, testeeBefore: testeeSetup); | 198 main(args) => runIsolateTests(args, tests, testeeBefore: testeeSetup); |
OLD | NEW |