| 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 testrunner_test; | 5 library testrunner_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:uri'; | |
| 10 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 11 | 10 |
| 12 main() { | 11 main() { |
| 13 var get = (String what, int code, String text) { | 12 var get = (String what, int code, String text) { |
| 14 var c = new Completer(); | 13 var c = new Completer(); |
| 15 HttpClient client = new HttpClient(); | 14 HttpClient client = new HttpClient(); |
| 16 client.getUrl(Uri.parse("http://127.0.0.1:3456/$what")) | 15 client.getUrl(Uri.parse("http://127.0.0.1:3456/$what")) |
| 17 .then((HttpClientRequest request) { | 16 .then((HttpClientRequest request) { |
| 18 // Prepare the request then call close on it to send it. | 17 // Prepare the request then call close on it to send it. |
| 19 return request.close(); | 18 return request.close(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 33 return c.future; | 32 return c.future; |
| 34 }; | 33 }; |
| 35 test('test1', () { | 34 test('test1', () { |
| 36 return get('test.txt', 200, "Hello world!\n"); | 35 return get('test.txt', 200, "Hello world!\n"); |
| 37 }); | 36 }); |
| 38 test('test2', () { | 37 test('test2', () { |
| 39 return get('fail.txt', 404, ""); | 38 return get('fail.txt', 404, ""); |
| 40 }); | 39 }); |
| 41 } | 40 } |
| 42 | 41 |
| OLD | NEW |