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

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

Issue 38703009: Update VM service to new isolate API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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_class_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';
11 11
12 abstract class VmServiceRequestHelper { 12 abstract class VmServiceRequestHelper {
13 final Uri uri; 13 final Uri uri;
14 final HttpClient client; 14 final HttpClient client;
15 15
16 VmServiceRequestHelper(String url) : 16 VmServiceRequestHelper(String url) :
17 uri = Uri.parse(url), 17 uri = Uri.parse(url),
18 client = new HttpClient(); 18 client = new HttpClient();
19 19
20 Future makeRequest() { 20 Future makeRequest() {
21 print('** GET: $uri');
21 return client.getUrl(uri) 22 return client.getUrl(uri)
22 .then((HttpClientRequest request) => request.close()) 23 .then((HttpClientRequest request) => request.close())
23 .then((HttpClientResponse response) { 24 .then((HttpClientResponse response) {
24 return response 25 return response
25 .fold(new BytesBuilder(), (b, d) => b..add(d)) 26 .fold(new BytesBuilder(), (b, d) => b..add(d))
26 .then((builder) { 27 .then((builder) {
27 print('** GET: $uri');
28 return _requestCompleted(builder.takeBytes(), response); 28 return _requestCompleted(builder.takeBytes(), response);
29 }); 29 });
30 }).catchError((error) { 30 }).catchError((error) {
31 onRequestFailed(error); 31 onRequestFailed(error);
32 }); 32 });
33 } 33 }
34 34
35 Future _requestCompleted(List<int> data, HttpClientResponse response) { 35 Future _requestCompleted(List<int> data, HttpClientResponse response) {
36 Expect.equals(200, response.statusCode, 'Invalid HTTP Status Code'); 36 Expect.equals(200, response.statusCode, 'Invalid HTTP Status Code');
37 var replyAsString; 37 var replyAsString;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 }); 247 });
248 }); 248 });
249 return Future.wait(requests).then((a) { 249 return Future.wait(requests).then((a) {
250 a.forEach((FieldRequestHelper field) { 250 a.forEach((FieldRequestHelper field) {
251 fields[field.field['user_name']] = field.field; 251 fields[field.field['user_name']] = field.field;
252 }); 252 });
253 return this; 253 return this;
254 }); 254 });
255 } 255 }
256 } 256 }
OLDNEW
« no previous file with comments | « tests/standalone/vmservice/isolate_class_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698