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

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

Issue 19804007: Response may fail earlier than after headers are received, in http_response_deadline_test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « no previous file | 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 // 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 25 matching lines...) Expand all
36 request.response.deadline = const Duration(milliseconds: 100); 36 request.response.deadline = const Duration(milliseconds: 100);
37 request.response.contentLength = 10000; 37 request.response.contentLength = 10000;
38 request.response.write("stuff"); 38 request.response.write("stuff");
39 }); 39 });
40 40
41 var futures = []; 41 var futures = [];
42 var client = new HttpClient(); 42 var client = new HttpClient();
43 for (int i = 0; i < connections; i++) { 43 for (int i = 0; i < connections; i++) {
44 futures.add(client.get('localhost', server.port, '/') 44 futures.add(client.get('localhost', server.port, '/')
45 .then((request) => request.close()) 45 .then((request) => request.close())
46 .then((response) { 46 .then((response) => response.drain())
47 return response.drain().then((_) { 47 .then((_) {
48 Expect.fail("Expected error"); 48 Expect.fail("Expected error");
49 }, onError: (e) { 49 }, onError: (e) {
50 // Expect error. 50 // Expect error.
51 });
52 })); 51 }));
53 } 52 }
54 Future.wait(futures).then((_) => server.close()); 53 Future.wait(futures).then((_) => server.close());
55 }); 54 });
56 } 55 }
57 56
58 void testDeadlineAndDetach(int connections) { 57 void testDeadlineAndDetach(int connections) {
59 HttpServer.bind('localhost', 0).then((server) { 58 HttpServer.bind('localhost', 0).then((server) {
60 server.listen((request) { 59 server.listen((request) {
61 request.response.deadline = const Duration(milliseconds: 0); 60 request.response.deadline = const Duration(milliseconds: 0);
(...skipping 22 matching lines...) Expand all
84 Future.wait(futures).then((_) => server.close()); 83 Future.wait(futures).then((_) => server.close());
85 }); 84 });
86 } 85 }
87 86
88 void main() { 87 void main() {
89 testSimpleDeadline(10); 88 testSimpleDeadline(10);
90 testExceedDeadline(10); 89 testExceedDeadline(10);
91 testDeadlineAndDetach(10); 90 testDeadlineAndDetach(10);
92 } 91 }
93 92
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698