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

Side by Side Diff: tests/standalone/io/http_body_test.dart

Issue 13950015: Fix bugs in HttpBody detected by the analyzer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « sdk/lib/io/http_body_impl.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 import 'dart:io'; 5 import 'dart:io';
6 import 'dart:utf'; 6 import 'dart:utf';
7 7
8 import 'package:expect/expect.dart'; 8 import 'package:expect/expect.dart';
9 9
10 void testHttpClientResponseBody() { 10 void testHttpClientResponseBody() {
(...skipping 14 matching lines...) Expand all
25 }); 25 });
26 }); 26 });
27 27
28 var client = new HttpClient(); 28 var client = new HttpClient();
29 client.get("127.0.0.1", server.port, "/") 29 client.get("127.0.0.1", server.port, "/")
30 .then((request) => request.close()) 30 .then((request) => request.close())
31 .then(HttpBodyHandler.processResponse) 31 .then(HttpBodyHandler.processResponse)
32 .then((body) { 32 .then((body) {
33 if (shouldFail) Expect.fail("Error expected"); 33 if (shouldFail) Expect.fail("Error expected");
34 Expect.equals(type, body.type); 34 Expect.equals(type, body.type);
35 Expect.isNotNull(body.response);
35 switch (type) { 36 switch (type) {
36 case "text": 37 case "text":
37 Expect.equals(expectedBody, body.body); 38 Expect.equals(expectedBody, body.body);
38 break; 39 break;
39 40
40 case "json": 41 case "json":
41 Expect.mapEquals(expectedBody, body.body); 42 Expect.mapEquals(expectedBody, body.body);
42 break; 43 break;
43 44
44 default: 45 default:
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 "json", 162 "json",
162 true); 163 true);
163 164
164 test(null, "body".codeUnits, "body".codeUnits, "binary"); 165 test(null, "body".codeUnits, "body".codeUnits, "binary");
165 } 166 }
166 167
167 void main() { 168 void main() {
168 testHttpClientResponseBody(); 169 testHttpClientResponseBody();
169 testHttpServerRequestBody(); 170 testHttpServerRequestBody();
170 } 171 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_body_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698