| 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 11 matching lines...) Expand all Loading... |
| 22 Expect.equals(-1, request.contentLength); | 22 Expect.equals(-1, request.contentLength); |
| 23 var response = request.response; | 23 var response = request.response; |
| 24 response.contentLength = 1; | 24 response.contentLength = 1; |
| 25 Expect.equals("1.0", request.protocolVersion); | 25 Expect.equals("1.0", request.protocolVersion); |
| 26 response.done | 26 response.done |
| 27 .then((_) => Expect.fail("Unexpected response completion")) | 27 .then((_) => Expect.fail("Unexpected response completion")) |
| 28 .catchError((error) => Expect.isTrue(error is HttpException)); | 28 .catchError((error) => Expect.isTrue(error is HttpException)); |
| 29 response.write("Z"); | 29 response.write("Z"); |
| 30 response.write("Z"); | 30 response.write("Z"); |
| 31 response.close(); | 31 response.close(); |
| 32 response.write("x"); | 32 Expect.throws(() { |
| 33 response.write("x"); |
| 34 }, (e) => e is StateError); |
| 33 }, onError: (e, trace) { | 35 }, onError: (e, trace) { |
| 34 String msg = "Unexpected error $e"; | 36 String msg = "Unexpected error $e"; |
| 35 if (trace != null) msg += "\nStackTrace: $trace"; | 37 if (trace != null) msg += "\nStackTrace: $trace"; |
| 36 Expect.fail(msg); | 38 Expect.fail(msg); |
| 37 }); | 39 }); |
| 38 | 40 |
| 39 int count = 0; | 41 int count = 0; |
| 40 makeRequest() { | 42 makeRequest() { |
| 41 Socket.connect("127.0.0.1", server.port).then((socket) { | 43 Socket.connect("127.0.0.1", server.port).then((socket) { |
| 42 socket.write("GET / HTTP/1.0\r\n\r\n"); | 44 socket.write("GET / HTTP/1.0\r\n\r\n"); |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 makeRequest(); | 206 makeRequest(); |
| 205 }); | 207 }); |
| 206 } | 208 } |
| 207 | 209 |
| 208 void main() { | 210 void main() { |
| 209 testHttp10NoKeepAlive(); | 211 testHttp10NoKeepAlive(); |
| 210 testHttp10ServerClose(); | 212 testHttp10ServerClose(); |
| 211 testHttp10KeepAlive(); | 213 testHttp10KeepAlive(); |
| 212 testHttp10KeepAliveServerCloses(); | 214 testHttp10KeepAliveServerCloses(); |
| 213 } | 215 } |
| OLD | NEW |