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