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

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

Issue 15842004: Support auto-drain of HttpRequest data. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add documentation. 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/http_parser_test.dart ('k') | tests/standalone/io/http_session_test.dart » ('j') | 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 // VMOptions= 5 // VMOptions=
6 // VMOptions=--short_socket_read 6 // VMOptions=--short_socket_read
7 // VMOptions=--short_socket_write 7 // VMOptions=--short_socket_write
8 // VMOptions=--short_socket_read --short_socket_write 8 // VMOptions=--short_socket_read --short_socket_write
9 9
10 import "package:expect/expect.dart"; 10 import "package:expect/expect.dart";
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 request.response.contentLength = 5; 236 request.response.contentLength = 5;
237 request.response.add([0]); 237 request.response.add([0]);
238 request.response.close(); 238 request.response.close();
239 request.response.done.catchError((error) { 239 request.response.done.catchError((error) {
240 server.close(); 240 server.close();
241 }, test: (e) => e is HttpException); 241 }, test: (e) => e is HttpException);
242 }); 242 });
243 } 243 }
244 244
245 245
246 void testIgnoreRequestData() {
247 HttpServer.bind("127.0.0.1", 0)
248 .then((server) {
249 server.listen((request) {
250 // Ignore request data.
251 request.response.write("all-okay");
252 request.response.close();
253 });
254
255 var client = new HttpClient();
256 client.get("127.0.0.1", server.port, "/")
257 .then((request) {
258 request.contentLength = 1024 * 1024;
259 request.add(new Uint8List(1024 * 1024));
260 return request.close();
261 })
262 .then((response) {
263 response
264 .fold(0, (s, b) => s + b.length)
265 .then((bytes) {
266 Expect.equals(8, bytes);
267 server.close();
268 });
269 });
270 });
271 }
272
273
246 void main() { 274 void main() {
247 testResponseDone(); 275 testResponseDone();
248 testResponseAddStream(); 276 testResponseAddStream();
249 testResponseAddStreamClosed(); 277 testResponseAddStreamClosed();
250 testResponseAddClosed(); 278 testResponseAddClosed();
251 testBadResponseAdd(); 279 testBadResponseAdd();
252 testBadResponseClose(); 280 testBadResponseClose();
281 testIgnoreRequestData();
253 } 282 }
OLDNEW
« no previous file with comments | « tests/standalone/io/http_parser_test.dart ('k') | tests/standalone/io/http_session_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698