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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 void dispatch(var message, SendPort replyTo) { | 162 void dispatch(var message, SendPort replyTo) { |
163 if (message.isStart) { | 163 if (message.isStart) { |
164 _server = new HttpServer(); | 164 _server = new HttpServer(); |
165 try { | 165 try { |
166 _server.listen("127.0.0.1", 0); | 166 _server.listen("127.0.0.1", 0); |
167 _server.defaultRequestHandler = (HttpRequest req, HttpResponse rsp) { | 167 _server.defaultRequestHandler = (HttpRequest req, HttpResponse rsp) { |
168 _requestReceivedHandler(req, rsp); | 168 _requestReceivedHandler(req, rsp); |
169 }; | 169 }; |
170 replyTo.send(new TestServerStatus.started(_server.port), null); | 170 replyTo.send(new TestServerStatus.started(_server.port), null); |
171 } catch (var e) { | 171 } catch (e) { |
172 replyTo.send(new TestServerStatus.error(), null); | 172 replyTo.send(new TestServerStatus.error(), null); |
173 } | 173 } |
174 } else if (message.isStop) { | 174 } else if (message.isStop) { |
175 _server.close(); | 175 _server.close(); |
176 port.close(); | 176 port.close(); |
177 replyTo.send(new TestServerStatus.stopped(), null); | 177 replyTo.send(new TestServerStatus.stopped(), null); |
178 } else if (message.isChunkedEncoding) { | 178 } else if (message.isChunkedEncoding) { |
179 _chunkedEncoding = true; | 179 _chunkedEncoding = true; |
180 } | 180 } |
181 } | 181 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 } | 306 } |
307 | 307 |
308 void main() { | 308 void main() { |
309 testStartStop(); | 309 testStartStop(); |
310 testGET(); | 310 testGET(); |
311 testPOST(true); | 311 testPOST(true); |
312 testPOST(false); | 312 testPOST(false); |
313 test404(); | 313 test404(); |
314 testReasonPhrase(); | 314 testReasonPhrase(); |
315 } | 315 } |
OLD | NEW |