| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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:isolate"; | 10 import "dart:isolate"; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 }); | 282 }); |
| 283 testServerMain.start(); | 283 testServerMain.start(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void testReasonPhrase() { | 286 void testReasonPhrase() { |
| 287 TestServerMain testServerMain = new TestServerMain(); | 287 TestServerMain testServerMain = new TestServerMain(); |
| 288 testServerMain.setServerStartedHandler((int port) { | 288 testServerMain.setServerStartedHandler((int port) { |
| 289 HttpClient httpClient = new HttpClient(); | 289 HttpClient httpClient = new HttpClient(); |
| 290 httpClient.get("127.0.0.1", port, "/reasonformoving") | 290 httpClient.get("127.0.0.1", port, "/reasonformoving") |
| 291 .then((request) { | 291 .then((request) { |
| 292 // request.followRedirects = false; | 292 request.followRedirects = false; |
| 293 return request.close(); | 293 return request.close(); |
| 294 }) | 294 }) |
| 295 .then((response) { | 295 .then((response) { |
| 296 Expect.equals(HttpStatus.MOVED_PERMANENTLY, response.statusCode); | 296 Expect.equals(HttpStatus.MOVED_PERMANENTLY, response.statusCode); |
| 297 Expect.equals("Don't come looking here any more", | 297 Expect.equals("Don't come looking here any more", |
| 298 response.reasonPhrase); | 298 response.reasonPhrase); |
| 299 response.listen( | 299 response.listen( |
| 300 (data) => Expect.fail("No data expected"), | 300 (data) => Expect.fail("No data expected"), |
| 301 onDone: () { | 301 onDone: () { |
| 302 httpClient.close(); | 302 httpClient.close(); |
| 303 testServerMain.close(); | 303 testServerMain.close(); |
| 304 }); | 304 }); |
| 305 }); | 305 }); |
| 306 }); | 306 }); |
| 307 testServerMain.start(); | 307 testServerMain.start(); |
| 308 } | 308 } |
| 309 | 309 |
| 310 void main() { | 310 void main() { |
| 311 testStartStop(); | 311 testStartStop(); |
| 312 testGET(); | 312 testGET(); |
| 313 testPOST(true); | 313 testPOST(true); |
| 314 testPOST(false); | 314 testPOST(false); |
| 315 test404(); | 315 test404(); |
| 316 testReasonPhrase(); | 316 testReasonPhrase(); |
| 317 } | 317 } |
| OLD | NEW |