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

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

Issue 12655003: Buffer the entire http header to one packet, and buffer other data in chunks of 4-16 kb. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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
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:isolate"; 5 import "dart:isolate";
6 import "dart:io"; 6 import "dart:io";
7 7
8 void testNoBody(int totalConnections, bool explicitContentLength) { 8 void testNoBody(int totalConnections, bool explicitContentLength) {
9 var errors = 0; 9 var errors = 0;
10 HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) { 10 HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 }) 123 })
124 .then((response) { 124 .then((response) {
125 Expect.equals("2", response.headers.value('content-length')); 125 Expect.equals("2", response.headers.value('content-length'));
126 Expect.equals(2, response.contentLength); 126 Expect.equals(2, response.contentLength);
127 response.listen( 127 response.listen(
128 (d) {}, 128 (d) {},
129 onDone: () { 129 onDone: () {
130 if (++clientCount == totalConnections) { 130 if (++clientCount == totalConnections) {
131 client.close(); 131 client.close();
132 } 132 }
133 },
134 onError: (error) {
135 // Undefined what server response sends.
133 }); 136 });
134 }); 137 });
135 } 138 }
136 }); 139 });
137 } 140 }
138 141
139 void testBodyChunked(int totalConnections, bool useHeader) { 142 void testBodyChunked(int totalConnections, bool useHeader) {
140 HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) { 143 HttpServer.bind("127.0.0.1", 0, totalConnections).then((server) {
141 server.listen( 144 server.listen(
142 (HttpRequest request) { 145 (HttpRequest request) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 235
233 void main() { 236 void main() {
234 testNoBody(5, false); 237 testNoBody(5, false);
235 testNoBody(5, true); 238 testNoBody(5, true);
236 testBody(5, false); 239 testBody(5, false);
237 testBody(5, true); 240 testBody(5, true);
238 testBodyChunked(5, false); 241 testBodyChunked(5, false);
239 testBodyChunked(5, true); 242 testBodyChunked(5, true);
240 testSetContentLength(); 243 testSetContentLength();
241 } 244 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_connection_close_test.dart ('k') | tests/standalone/io/http_server_response_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698