Chromium Code Reviews| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 _requestHandlers["/expires2"] = | 179 _requestHandlers["/expires2"] = |
| 180 (HttpRequest request, HttpResponse response) { | 180 (HttpRequest request, HttpResponse response) { |
| 181 _expires2Handler(request, response); | 181 _expires2Handler(request, response); |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 this.port.receive((var message, SendPort replyTo) { | 184 this.port.receive((var message, SendPort replyTo) { |
| 185 if (message.isStart) { | 185 if (message.isStart) { |
| 186 _server = new HttpServer(); | 186 _server = new HttpServer(); |
| 187 try { | 187 try { |
| 188 _server.listen("127.0.0.1", 0); | 188 _server.listen("127.0.0.1", 0); |
| 189 _server.onRequest = (HttpRequest req, HttpResponse rsp) { | 189 _server.defaultRequestHandler = (HttpRequest req, HttpResponse rsp) { |
| 190 _requestReceivedHandler(req, rsp); | 190 _requestReceivedHandler(req, rsp); |
| 191 }; | 191 }; |
| 192 replyTo.send(new TestServerStatus.started(_server.port), null); | 192 replyTo.send(new TestServerStatus.started(_server.port), null); |
| 193 } catch (var e) { | 193 } catch (var e) { |
| 194 replyTo.send(new TestServerStatus.error(), null); | 194 replyTo.send(new TestServerStatus.error(), null); |
| 195 } | 195 } |
| 196 } else if (message.isStop) { | 196 } else if (message.isStop) { |
| 197 _server.close(); | 197 _server.close(); |
| 198 this.port.close(); | 198 this.port.close(); |
| 199 replyTo.send(new TestServerStatus.stopped(), null); | 199 replyTo.send(new TestServerStatus.stopped(), null); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 HttpClientConnection conn2 = httpClient.get("127.0.0.1", port, "/expires2"); | 508 HttpClientConnection conn2 = httpClient.get("127.0.0.1", port, "/expires2"); |
| 509 conn2.onResponse = (HttpClientResponse response) { | 509 conn2.onResponse = (HttpClientResponse response) { |
| 510 processResponse(response); | 510 processResponse(response); |
| 511 }; | 511 }; |
| 512 }); | 512 }); |
| 513 testServerMain.start(); | 513 testServerMain.start(); |
| 514 } | 514 } |
| 515 | 515 |
| 516 | 516 |
| 517 void main() { | 517 void main() { |
| 518 //testStartStop(); | 518 testStartStop(); |
|
Mads Ager (google)
2012/04/18 12:22:08
Whoops. Good catch.
| |
| 519 testGET(); | 519 testGET(); |
| 520 testPOST(true); | 520 testPOST(true); |
| 521 testPOST(false); | 521 testPOST(false); |
| 522 testReadInto(true); | 522 testReadInto(true); |
| 523 testReadInto(false); | 523 testReadInto(false); |
| 524 testReadShort(true); | 524 testReadShort(true); |
| 525 testReadShort(false); | 525 testReadShort(false); |
| 526 test404(); | 526 test404(); |
| 527 testReasonPhrase(); | 527 testReasonPhrase(); |
| 528 testHost(); | 528 testHost(); |
| 529 testExpires(); | 529 testExpires(); |
| 530 } | 530 } |
| OLD | NEW |