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

Side by Side Diff: tests/standalone/vmservice/test_helper.dart

Issue 487023003: vmservice protocol cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: gen js Created 6 years, 4 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
« no previous file with comments | « tests/standalone/vmservice/isolate_function_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 library vmservice_test_helper; 5 library vmservice_test_helper;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'package:expect/expect.dart'; 10 import 'package:expect/expect.dart';
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 } 202 }
203 203
204 class ClassTableHelper { 204 class ClassTableHelper {
205 final Map classTable; 205 final Map classTable;
206 206
207 ClassTableHelper(this.classTable) { 207 ClassTableHelper(this.classTable) {
208 Expect.equals('ClassList', classTable['type'], 'Not a ClassTable.'); 208 Expect.equals('ClassList', classTable['type'], 'Not a ClassTable.');
209 } 209 }
210 210
211 bool classExists(String user_name) { 211 bool classExists(String name) {
212 List members = classTable['members']; 212 List members = classTable['members'];
213 for (var i = 0; i < members.length; i++) { 213 for (var i = 0; i < members.length; i++) {
214 Map klass = members[i]; 214 Map klass = members[i];
215 if (klass['user_name'] == user_name) { 215 if (klass['name'] == name) {
216 return true; 216 return true;
217 } 217 }
218 } 218 }
219 return false; 219 return false;
220 } 220 }
221 221
222 String classId(String user_name) { 222 String classId(String name) {
223 List members = classTable['members']; 223 List members = classTable['members'];
224 for (var i = 0; i < members.length; i++) { 224 for (var i = 0; i < members.length; i++) {
225 Map klass = members[i]; 225 Map klass = members[i];
226 if (klass['user_name'] == user_name) { 226 if (klass['name'] == name) {
227 return klass['id']; 227 return klass['id'];
228 } 228 }
229 } 229 }
230 return null; 230 return null;
231 } 231 }
232 } 232 }
233 233
234 class FieldRequestHelper extends VmServiceRequestHelper { 234 class FieldRequestHelper extends VmServiceRequestHelper {
235 FieldRequestHelper(port, isolate_id, field_id) : 235 FieldRequestHelper(port, isolate_id, field_id) :
236 super('http://127.0.0.1:$port/$isolate_id/$field_id'); 236 super('http://127.0.0.1:$port/$isolate_id/$field_id');
(...skipping 15 matching lines...) Expand all
252 isolate_id_ = isolate_id; 252 isolate_id_ = isolate_id;
253 } 253 }
254 final Map<String, Map> fields = new Map<String, Map>(); 254 final Map<String, Map> fields = new Map<String, Map>();
255 255
256 onRequestCompleted(Map reply) { 256 onRequestCompleted(Map reply) {
257 Expect.equals('Class', reply['type']); 257 Expect.equals('Class', reply['type']);
258 List<Map> class_fields = reply['fields']; 258 List<Map> class_fields = reply['fields'];
259 List<Future> requests = new List<Future>(); 259 List<Future> requests = new List<Future>();
260 fieldNames.forEach((fn) { 260 fieldNames.forEach((fn) {
261 class_fields.forEach((f) { 261 class_fields.forEach((f) {
262 if (f['user_name'] == fn) { 262 if (f['name'] == fn) {
263 var request = new FieldRequestHelper(port_, isolate_id_, f['id']); 263 var request = new FieldRequestHelper(port_, isolate_id_, f['id']);
264 requests.add(request.makeRequest()); 264 requests.add(request.makeRequest());
265 } 265 }
266 }); 266 });
267 }); 267 });
268 return Future.wait(requests).then((a) { 268 return Future.wait(requests).then((a) {
269 a.forEach((FieldRequestHelper field) { 269 a.forEach((FieldRequestHelper field) {
270 fields[field.field['user_name']] = field.field; 270 fields[field.field['name']] = field.field;
271 }); 271 });
272 return this; 272 return this;
273 }); 273 });
274 } 274 }
275 } 275 }
OLDNEW
« no previous file with comments | « tests/standalone/vmservice/isolate_function_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698