Chromium Code Reviews| Index: tests/standalone/io/http_detach_socket_test.dart |
| diff --git a/tests/standalone/io/http_detach_socket_test.dart b/tests/standalone/io/http_detach_socket_test.dart |
| index e5669d659b0bafb0b1e4956d517a81a2764c2eed..53c8fc4f2c7bbbc0a336c1a88007e9bf4f3024ea 100644 |
| --- a/tests/standalone/io/http_detach_socket_test.dart |
| +++ b/tests/standalone/io/http_detach_socket_test.dart |
| @@ -145,9 +145,42 @@ void testClientDetachSocket() { |
| }); |
| } |
| +void testUpgradedConnection() { |
| + HttpServer.bind("127.0.0.1", 0).then((server) { |
| + server.listen((request) { |
| + request.response.headers.set('connection', 'upgrade'); |
|
Søren Gjesse
2014/06/02 07:30:52
Should this test also detach the socket on this si
Anders Johnsen
2014/06/02 08:00:35
Done.
|
| + request.response.close(); |
| + }); |
| + |
| + var client = new HttpClient(); |
| + client.userAgent = null; |
| + client.get("127.0.0.1", server.port, "/") |
| + .then((request) { |
| + request.headers.set('upgrade', 'mine'); |
| + return request.close(); |
| + }) |
| + .then((response) { |
| + client.get("127.0.0.1", server.port, "/") |
| + .then((request) { |
| + response.detachSocket().then((socket) { |
| + // We are testing that we can detach the socket, even though |
| + // we made a new connection (testing it was not reused). |
| + request.close().then((response) { |
| + response.drain().then((_) { |
| + server.close(); |
| + }); |
| + socket.destroy(); |
| + }); |
| + }); |
| + }); |
| + }); |
| + }); |
| +} |
| + |
| void main() { |
| testServerDetachSocket(); |
| testServerDetachSocketNoWriteHeaders(); |
| testBadServerDetachSocket(); |
| testClientDetachSocket(); |
| + testUpgradedConnection(); |
| } |