Chromium Code Reviews| Index: tests/standalone/io/http_content_length_test.dart |
| diff --git a/tests/standalone/io/http_content_length_test.dart b/tests/standalone/io/http_content_length_test.dart |
| index cf2614588f647c6def0d187187f3c253d8ca7087..978fa3f783460a8b884b46859c6e88fd54695dc2 100644 |
| --- a/tests/standalone/io/http_content_length_test.dart |
| +++ b/tests/standalone/io/http_content_length_test.dart |
| @@ -79,7 +79,32 @@ void testBody(int totalConnections) { |
| } |
| } |
| +void testHttp10() { |
| + HttpServer server = new HttpServer(); |
| + server.onError = (e) => Expect.fail("Unexpected error $e"); |
| + server.listen("127.0.0.1", 0, 5); |
| + server.defaultRequestHandler = (HttpRequest request, HttpResponse response) { |
| + OutputStream stream = response.outputStream; |
| + Expect.equals("1.0", request.protocolVersion); |
| + Expect.throws(() => stream.writeString("x"), (e) => e is HttpException); |
| + response.contentLength = 0; |
| + stream.close(); |
| + }; |
| + |
| + Socket socket = new Socket("127.0.0.1", server.port); |
| + socket.onConnect = () { |
| + List<int> buffer = new List<int>(1024); |
| + socket.outputStream.writeString("GET / HTTP/1.0\r\n\r\n"); |
| + socket.onData = () => socket.readList(buffer, 0, buffer.length); |
| + socket.onClosed = () { |
|
Mads Ager (google)
2012/05/09 07:42:14
Indentation is off.
Søren Gjesse
2012/05/09 08:57:02
Done.
|
| + socket.close(true); |
| + server.close(); |
| + }; |
| + }; |
| +} |
| + |
| void main() { |
| testNoBody(5); |
| testBody(5); |
| + testHttp10(); |
| } |