Chromium Code Reviews| 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 "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 body.toString()); | 138 body.toString()); |
| 139 client.close(); | 139 client.close(); |
| 140 }); | 140 }); |
| 141 socket.write("Some data"); | 141 socket.write("Some data"); |
| 142 socket.close(); | 142 socket.close(); |
| 143 }); | 143 }); |
| 144 }); | 144 }); |
| 145 }); | 145 }); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void testUpgradedConnection() { | |
| 149 HttpServer.bind("127.0.0.1", 0).then((server) { | |
| 150 server.listen((request) { | |
| 151 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.
| |
| 152 request.response.close(); | |
| 153 }); | |
| 154 | |
| 155 var client = new HttpClient(); | |
| 156 client.userAgent = null; | |
| 157 client.get("127.0.0.1", server.port, "/") | |
| 158 .then((request) { | |
| 159 request.headers.set('upgrade', 'mine'); | |
| 160 return request.close(); | |
| 161 }) | |
| 162 .then((response) { | |
| 163 client.get("127.0.0.1", server.port, "/") | |
| 164 .then((request) { | |
| 165 response.detachSocket().then((socket) { | |
| 166 // We are testing that we can detach the socket, even though | |
| 167 // we made a new connection (testing it was not reused). | |
| 168 request.close().then((response) { | |
| 169 response.drain().then((_) { | |
| 170 server.close(); | |
| 171 }); | |
| 172 socket.destroy(); | |
| 173 }); | |
| 174 }); | |
| 175 }); | |
| 176 }); | |
| 177 }); | |
| 178 } | |
| 179 | |
| 148 void main() { | 180 void main() { |
| 149 testServerDetachSocket(); | 181 testServerDetachSocket(); |
| 150 testServerDetachSocketNoWriteHeaders(); | 182 testServerDetachSocketNoWriteHeaders(); |
| 151 testBadServerDetachSocket(); | 183 testBadServerDetachSocket(); |
| 152 testClientDetachSocket(); | 184 testClientDetachSocket(); |
| 185 testUpgradedConnection(); | |
| 153 } | 186 } |
| OLD | NEW |