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

Side by Side Diff: utils/tests/testrunner/http_client_tests/http_client_test.dart

Issue 14753005: Enable parsing of IPv6 form addresse (see rfc2373 and rfc2732). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix tets. Created 7 years, 7 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/io/web_socket_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 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'; 9 import 'dart:uri';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
11 11
12 main() { 12 main() {
13 var get = (String what, int code, String text) { 13 var get = (String what, int code, String text) {
14 var c = new Completer(); 14 var c = new Completer();
15 HttpClient client = new HttpClient(); 15 HttpClient client = new HttpClient();
16 client.getUrl(new Uri.fromString("http://127.0.0.1:3456/$what")) 16 client.getUrl(Uri.parse("http://127.0.0.1:3456/$what"))
17 .then((HttpClientRequest request) { 17 .then((HttpClientRequest request) {
18 // Prepare the request then call close on it to send it. 18 // Prepare the request then call close on it to send it.
19 return request.close(); 19 return request.close();
20 }) 20 })
21 .then((HttpClientResponse response) { 21 .then((HttpClientResponse response) {
22 // Process the response. 22 // Process the response.
23 expect(response.statusCode, code); 23 expect(response.statusCode, code);
24 var sb = new StringBuffer(); 24 var sb = new StringBuffer();
25 response.transform(new StringDecoder()) 25 response.transform(new StringDecoder())
26 .listen((data) { 26 .listen((data) {
27 sb.write(data); 27 sb.write(data);
28 }, onDone: () { 28 }, onDone: () {
29 expect(sb.toString(), text); 29 expect(sb.toString(), text);
30 c.complete(); 30 c.complete();
31 }); 31 });
32 }); 32 });
33 return c.future; 33 return c.future;
34 }; 34 };
35 test('test1', () { 35 test('test1', () {
36 return get('test.txt', 200, "Hello world!\n"); 36 return get('test.txt', 200, "Hello world!\n");
37 }); 37 });
38 test('test2', () { 38 test('test2', () {
39 return get('fail.txt', 404, ""); 39 return get('fail.txt', 404, "");
40 }); 40 });
41 } 41 }
42 42
OLDNEW
« no previous file with comments | « tests/standalone/io/web_socket_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698