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 | 4 |
5 library crash_dump_test; | 5 library crash_dump_test; |
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:observatory/service_io.dart'; | 10 import 'package:observatory/service_io.dart'; |
11 | 11 |
12 import 'test_helper.dart'; | 12 import 'test_helper.dart'; |
13 | 13 |
14 Future warmup() async { | 14 Future warmup() async { |
15 print('hi'); | 15 print('hi'); |
16 } | 16 } |
17 | 17 |
18 var tests = [ | 18 var tests = [ |
19 (VM vm) async { | 19 (VM vm) async { |
20 HttpClient client = new HttpClient(); | 20 HttpClient client = new HttpClient(); |
| 21 print('Requesting uri ${serviceHttpAddress}/_getCrashDump'); |
21 var request = | 22 var request = |
22 await client.getUrl(Uri.parse('$serviceHttpAddress/_getCrashDump')); | 23 await client.getUrl(Uri.parse('$serviceHttpAddress/_getCrashDump')); |
23 var response = await request.close(); | 24 var response = await request.close(); |
| 25 print('Received response'); |
24 Completer completer = new Completer(); | 26 Completer completer = new Completer(); |
25 StringBuffer sb = new StringBuffer(); | 27 StringBuffer sb = new StringBuffer(); |
26 response.transform(UTF8.decoder).listen((chunk) { | 28 response.transform(UTF8.decoder).listen((chunk) { |
27 sb.write(chunk); | 29 sb.write(chunk); |
28 }, onDone: () => completer.complete(sb.toString())); | 30 }, onDone: () => completer.complete(sb.toString())); |
29 var responseString = await completer.future; | 31 var responseString = await completer.future; |
30 JSON.decode(responseString); | 32 JSON.decode(responseString); |
31 } | 33 } |
32 ]; | 34 ]; |
33 | 35 |
34 main(args) async => runVMTests(args, tests, testeeBefore:warmup); | 36 main(args) async => runVMTests(args, tests, testeeBefore:warmup); |
OLD | NEW |