Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Side by Side Diff: runtime/observatory/tests/service/evaluate_activation_test.dart

Issue 1133733005: Use words please. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: also rename service rpc Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 9
10 import 'dart:math' as math; 10 import 'dart:math' as math;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 use(innerTemp); 63 use(innerTemp);
64 breakHere(); 64 breakHere();
65 }; 65 };
66 }); 66 });
67 } 67 }
68 } 68 }
69 69
70 testMethod(Isolate isolate) async { 70 testMethod(Isolate isolate) async {
71 // silence analyzer. 71 // silence analyzer.
72 expect(math.sqrt(4), equals(2)); 72 expect(math.sqrt(4), equals(2));
73 Library rootLib = await isolate.rootLib.load(); 73 Library rootLib = await isolate.rootLibrary.load();
74 ServiceFunction function = 74 ServiceFunction function =
75 rootLib.functions.singleWhere((f) => f.name == 'breakHere'); 75 rootLib.functions.singleWhere((f) => f.name == 'breakHere');
76 Breakpoint bpt = await isolate.addBreakpointAtEntry(function); 76 Breakpoint bpt = await isolate.addBreakpointAtEntry(function);
77 print("Breakpoint: $bpt"); 77 print("Breakpoint: $bpt");
78 expect(bpt is Breakpoint, isTrue); // I.e, not null. 78 expect(bpt is Breakpoint, isTrue); // I.e, not null.
79 79
80 bool hitBreakpoint = false; 80 bool hitBreakpoint = false;
81 var sub; 81 var sub;
82 sub = isolate.vm.events.stream.listen((ServiceEvent event) async { 82 sub = isolate.vm.events.stream.listen((ServiceEvent event) async {
83 print("Event $event"); 83 print("Event $event");
(...skipping 21 matching lines...) Expand all
105 expect(r.valueAsString, equals('8')); /// instance: continued 105 expect(r.valueAsString, equals('8')); /// instance: continued
106 r = await isolate.evalFrame(frameNumber, 'math.sqrt'); /// instance: cont inued 106 r = await isolate.evalFrame(frameNumber, 'math.sqrt'); /// instance: cont inued
107 expect(r.isClosure, isTrue); /// instance: continued 107 expect(r.isClosure, isTrue); /// instance: continued
108 108
109 hitBreakpoint = true; 109 hitBreakpoint = true;
110 sub.cancel(); // Do not handle events for the other tests. 110 sub.cancel(); // Do not handle events for the other tests.
111 isolate.resume(); 111 isolate.resume();
112 } 112 }
113 }); 113 });
114 114
115 var result = await isolate.eval(rootLib, 'new C().method(3);'); 115 var result = await rootLib.evaluate('new C().method(3);');
116 print("Result $result"); 116 print("Result $result");
117 expect(hitBreakpoint, isTrue); 117 expect(hitBreakpoint, isTrue);
118 } 118 }
119 119
120 testMethod2(Isolate isolate) async { 120 testMethod2(Isolate isolate) async {
121 Library rootLib = await isolate.rootLib.load(); 121 Library rootLib = await isolate.rootLibrary.load();
122 ServiceFunction function = 122 ServiceFunction function =
123 rootLib.functions.singleWhere((f) => f.name == 'breakHere'); 123 rootLib.functions.singleWhere((f) => f.name == 'breakHere');
124 Breakpoint bpt = await isolate.addBreakpointAtEntry(function); 124 Breakpoint bpt = await isolate.addBreakpointAtEntry(function);
125 print("Breakpoint: $bpt"); 125 print("Breakpoint: $bpt");
126 expect(bpt is Breakpoint, isTrue); // I.e, not null. 126 expect(bpt is Breakpoint, isTrue); // I.e, not null.
127 127
128 bool hitBreakpoint = false; 128 bool hitBreakpoint = false;
129 var sub; 129 var sub;
130 sub = isolate.vm.events.stream.listen((ServiceEvent event) async { 130 sub = isolate.vm.events.stream.listen((ServiceEvent event) async {
131 print("Event $event"); 131 print("Event $event");
(...skipping 21 matching lines...) Expand all
153 expect(r.valueAsString, equals('8')); 153 expect(r.valueAsString, equals('8'));
154 r = await isolate.evalFrame(frameNumber, 'math.sqrt'); 154 r = await isolate.evalFrame(frameNumber, 'math.sqrt');
155 expect(r.isClosure, isTrue); 155 expect(r.isClosure, isTrue);
156 156
157 hitBreakpoint = true; 157 hitBreakpoint = true;
158 sub.cancel(); // Do not handle events for the other tests. 158 sub.cancel(); // Do not handle events for the other tests.
159 isolate.resume(); 159 isolate.resume();
160 } 160 }
161 }); 161 });
162 162
163 var result = await isolate.eval(rootLib, 'C.method2(3);'); 163 var result = await rootLib.evaluate('C.method2(3);');
164 print("Result $result"); 164 print("Result $result");
165 expect(hitBreakpoint, isTrue); 165 expect(hitBreakpoint, isTrue);
166 } 166 }
167 167
168 testMethod3(Isolate isolate) async { 168 testMethod3(Isolate isolate) async {
169 Library rootLib = await isolate.rootLib.load(); 169 Library rootLib = await isolate.rootLibrary.load();
170 ServiceFunction function = 170 ServiceFunction function =
171 rootLib.functions.singleWhere((f) => f.name == 'breakHere'); 171 rootLib.functions.singleWhere((f) => f.name == 'breakHere');
172 Breakpoint bpt = await isolate.addBreakpointAtEntry(function); 172 Breakpoint bpt = await isolate.addBreakpointAtEntry(function);
173 print("Breakpoint: $bpt"); 173 print("Breakpoint: $bpt");
174 expect(bpt is Breakpoint, isTrue); // I.e, not null. 174 expect(bpt is Breakpoint, isTrue); // I.e, not null.
175 175
176 bool hitBreakpoint = false; 176 bool hitBreakpoint = false;
177 var sub; 177 var sub;
178 sub = isolate.vm.events.stream.listen((ServiceEvent event) async { 178 sub = isolate.vm.events.stream.listen((ServiceEvent event) async {
179 print("Event $event"); 179 print("Event $event");
(...skipping 13 matching lines...) Expand all
193 expect(r.valueAsString, equals('4')); 193 expect(r.valueAsString, equals('4'));
194 r = await isolate.evalFrame(frameNumber, 'math.sqrt'); 194 r = await isolate.evalFrame(frameNumber, 'math.sqrt');
195 expect(r.isClosure, isTrue); 195 expect(r.isClosure, isTrue);
196 196
197 hitBreakpoint = true; 197 hitBreakpoint = true;
198 sub.cancel(); // Do not handle events for the other tests. 198 sub.cancel(); // Do not handle events for the other tests.
199 isolate.resume(); 199 isolate.resume();
200 } 200 }
201 }); 201 });
202 202
203 var result = await isolate.eval(rootLib, 'new C().method3(3);'); 203 var result = await rootLib.evaluate('new C().method3(3);');
204 print("Result $result"); 204 print("Result $result");
205 expect(hitBreakpoint, isTrue); 205 expect(hitBreakpoint, isTrue);
206 } 206 }
207 207
208 208
209 testMethod4(Isolate isolate) async { 209 testMethod4(Isolate isolate) async {
210 Library rootLib = await isolate.rootLib.load(); 210 Library rootLib = await isolate.rootLibrary.load();
211 ServiceFunction function = 211 ServiceFunction function =
212 rootLib.functions.singleWhere((f) => f.name == 'breakHere'); 212 rootLib.functions.singleWhere((f) => f.name == 'breakHere');
213 Breakpoint bpt = await isolate.addBreakpointAtEntry(function); 213 Breakpoint bpt = await isolate.addBreakpointAtEntry(function);
214 print("Breakpoint: $bpt"); 214 print("Breakpoint: $bpt");
215 expect(bpt is Breakpoint, isTrue); // I.e, not null. 215 expect(bpt is Breakpoint, isTrue); // I.e, not null.
216 216
217 bool hitBreakpoint = false; 217 bool hitBreakpoint = false;
218 var sub; 218 var sub;
219 sub = isolate.vm.events.stream.listen((ServiceEvent event) async { 219 sub = isolate.vm.events.stream.listen((ServiceEvent event) async {
220 print("Event $event"); 220 print("Event $event");
(...skipping 21 matching lines...) Expand all
242 expect(r.valueAsString, equals('8')); /// instance: continued 242 expect(r.valueAsString, equals('8')); /// instance: continued
243 r = await isolate.evalFrame(frameNumber, 'math.sqrt'); /// instance: cont inued 243 r = await isolate.evalFrame(frameNumber, 'math.sqrt'); /// instance: cont inued
244 expect(r.isClosure, isTrue); /// instance: continued 244 expect(r.isClosure, isTrue); /// instance: continued
245 245
246 hitBreakpoint = true; 246 hitBreakpoint = true;
247 sub.cancel(); // Do not handle events for the other tests. 247 sub.cancel(); // Do not handle events for the other tests.
248 isolate.resume(); 248 isolate.resume();
249 } 249 }
250 }); 250 });
251 251
252 var result = await isolate.eval(rootLib, 252 var result = await rootLib.evaluate(
253 '(){ new C().method4(3); C.closureWithReturnedHome(7); }()'); 253 '(){ new C().method4(3); C.closureWithReturnedHome(7); }()');
254 print("Result $result"); 254 print("Result $result");
255 expect(hitBreakpoint, isTrue); 255 expect(hitBreakpoint, isTrue);
256 } 256 }
257 257
258 var tests = [ 258 var tests = [
259 testMethod, 259 testMethod,
260 testMethod2, 260 testMethod2,
261 testMethod3, 261 testMethod3,
262 testMethod4, 262 testMethod4,
263 ]; 263 ];
264 264
265 main(args) => runIsolateTests(args, tests); 265 main(args) => runIsolateTests(args, tests);
OLDNEW
« no previous file with comments | « runtime/observatory/tests/service/eval_test.dart ('k') | runtime/observatory/tests/service/get_instances_rpc_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698