OLD | NEW |
---|---|
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 'dart:async'; | 10 import 'dart:async'; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
114 .catchError((error) => asyncEnd(), | 114 .catchError((error) => asyncEnd(), |
115 test: (error) => error is HttpException); | 115 test: (error) => error is HttpException); |
116 }); | 116 }); |
117 } | 117 } |
118 | 118 |
119 void testGetDataServerForceClose() { | 119 void testGetDataServerForceClose() { |
120 asyncStart(); | 120 asyncStart(); |
121 var completer = new Completer(); | 121 var completer = new Completer(); |
122 HttpServer.bind("127.0.0.1", 0).then((server) { | 122 HttpServer.bind("127.0.0.1", 0).then((server) { |
123 server.listen((request) { | 123 server.listen((request) { |
124 request.response.bufferOutput = false; | |
124 request.response.contentLength = 100; | 125 request.response.contentLength = 100; |
125 request.response.write("data"); | 126 request.response.write("data"); |
126 request.response.write("more data"); | 127 request.response.write("more data"); |
127 completer.future.then((_) => server.close(force: true)); | 128 completer.future.then((_) => server.close(force: true)); |
128 }); | 129 }); |
129 | 130 |
130 var client = new HttpClient(); | 131 var client = new HttpClient(); |
131 client.get("127.0.0.1", server.port, "/") | 132 client.get("127.0.0.1", server.port, "/") |
132 .then((request) => request.close()) | 133 .then((request) => request.close()) |
133 .then((response) { | 134 .then((response) { |
(...skipping 22 matching lines...) Expand all Loading... | |
156 client.post("127.0.0.1", server.port, "/") | 157 client.post("127.0.0.1", server.port, "/") |
157 .then((request) => request.close()) | 158 .then((request) => request.close()) |
158 .then((response) { | 159 .then((response) { |
159 response.listen((data) {}, onDone: server.close); | 160 response.listen((data) {}, onDone: server.close); |
160 }); | 161 }); |
161 }); | 162 }); |
162 } | 163 } |
163 | 164 |
164 | 165 |
165 void main() { | 166 void main() { |
167 /* | |
Søren Gjesse
2014/04/08 11:54:25
Remove these comments.
Anders Johnsen
2014/04/08 12:40:07
Done.
| |
166 testGetEmptyRequest(); | 168 testGetEmptyRequest(); |
167 testGetDataRequest(); | 169 testGetDataRequest(); |
168 testGetInvalidHost(); | 170 testGetInvalidHost(); |
169 testGetServerClose(); | 171 testGetServerClose(); |
170 testGetServerCloseNoKeepAlive(); | 172 testGetServerCloseNoKeepAlive(); |
171 testGetServerForceClose(); | 173 testGetServerForceClose(); |
172 // TODO(14953): This test can only run, when buffering is disabled. | 174 */ |
173 // testGetDataServerForceClose(); | 175 testGetDataServerForceClose(); |
Søren Gjesse
2014/04/08 11:54:25
There should be a test where the server writes sev
Anders Johnsen
2014/04/08 12:40:07
Done.
| |
174 testPostEmptyRequest(); | 176 // testPostEmptyRequest(); |
175 } | 177 } |
OLD | NEW |