OLD | NEW |
1 // (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // (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 12 matching lines...) Expand all Loading... |
23 Expect.equals(-1, request.contentLength); | 23 Expect.equals(-1, request.contentLength); |
24 var response = request.response; | 24 var response = request.response; |
25 response.contentLength = 1; | 25 response.contentLength = 1; |
26 Expect.equals("1.0", request.protocolVersion); | 26 Expect.equals("1.0", request.protocolVersion); |
27 response.done | 27 response.done |
28 .then((_) => Expect.fail("Unexpected response completion")) | 28 .then((_) => Expect.fail("Unexpected response completion")) |
29 .catchError((error) => Expect.isTrue(error is HttpException)); | 29 .catchError((error) => Expect.isTrue(error is HttpException)); |
30 response.write("Z"); | 30 response.write("Z"); |
31 response.write("Z"); | 31 response.write("Z"); |
32 response.close(); | 32 response.close(); |
33 Expect.throws(() => response.write("x"), | 33 response.write("x"); |
34 (e) => e is StateError); | |
35 }, | 34 }, |
36 onError: (e) { | 35 onError: (e) { |
37 String msg = "Unexpected error $e"; | 36 String msg = "Unexpected error $e"; |
38 var trace = getAttachedStackTrace(e); | 37 var trace = getAttachedStackTrace(e); |
39 if (trace != null) msg += "\nStackTrace: $trace"; | 38 if (trace != null) msg += "\nStackTrace: $trace"; |
40 Expect.fail(msg); | 39 Expect.fail(msg); |
41 }); | 40 }); |
42 | 41 |
43 int count = 0; | 42 int count = 0; |
44 makeRequest() { | 43 makeRequest() { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 }); | 224 }); |
226 } | 225 } |
227 | 226 |
228 | 227 |
229 void main() { | 228 void main() { |
230 testHttp10NoKeepAlive(); | 229 testHttp10NoKeepAlive(); |
231 testHttp10ServerClose(); | 230 testHttp10ServerClose(); |
232 testHttp10KeepAlive(); | 231 testHttp10KeepAlive(); |
233 testHttp10KeepAliveServerCloses(); | 232 testHttp10KeepAliveServerCloses(); |
234 } | 233 } |
OLD | NEW |