| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 void complete() { | 32 void complete() { |
| 33 _completer.complete(this); | 33 _completer.complete(this); |
| 34 } | 34 } |
| 35 | 35 |
| 36 Future get completed => _completer.future; | 36 Future get completed => _completer.future; |
| 37 | 37 |
| 38 // Must call complete. | 38 // Must call complete. |
| 39 void onResponse(var seq, Map response); | 39 void onResponse(var seq, Map response); |
| 40 void runTest(); | 40 void runTest(); |
| 41 | 41 |
| 42 Future sendMessage(var seq, List<String> path) { | 42 Future sendMessage(var seq, String request) { |
| 43 var map = { | 43 var map = { |
| 44 'seq': seq, | 44 'seq': seq, |
| 45 'path': path | 45 'request': request |
| 46 }; | 46 }; |
| 47 var message = JSON.encode(map); | 47 var message = JSON.encode(map); |
| 48 _socket.add(message); | 48 _socket.add(message); |
| 49 return _completer.future; | 49 return _completer.future; |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 | 52 |
| 53 abstract class VmServiceRequestHelper { | 53 abstract class VmServiceRequestHelper { |
| 54 final Uri uri; | 54 final Uri uri; |
| 55 final HttpClient client; | 55 final HttpClient client; |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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['user_name']] = field.field; |
| 271 }); | 271 }); |
| 272 return this; | 272 return this; |
| 273 }); | 273 }); |
| 274 } | 274 } |
| 275 } | 275 } |
| OLD | NEW |