| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 makeRequest() { | 127 makeRequest() { |
| 128 Socket.connect("127.0.0.1", server.port).then((socket) { | 128 Socket.connect("127.0.0.1", server.port).then((socket) { |
| 129 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; | 129 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; |
| 130 socket.write(data); | 130 socket.write(data); |
| 131 socket.close(); | 131 socket.close(); |
| 132 socket.done.then((_) { | 132 socket.done.then((_) { |
| 133 socket.destroy(); | 133 socket.destroy(); |
| 134 if (++count < 10) { | 134 if (++count < 10) { |
| 135 makeRequest(); | 135 makeRequest(); |
| 136 } else { | 136 } else { |
| 137 runAsync(server.close); | 137 scheduleMicrotask(server.close); |
| 138 } | 138 } |
| 139 }); | 139 }); |
| 140 }); | 140 }); |
| 141 } | 141 } |
| 142 makeRequest(); | 142 makeRequest(); |
| 143 }); | 143 }); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void testEarlyClose3() { | 146 void testEarlyClose3() { |
| 147 HttpServer.bind("127.0.0.1", 0).then((server) { | 147 HttpServer.bind("127.0.0.1", 0).then((server) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 166 socket.done.catchError((_) {}); | 166 socket.done.catchError((_) {}); |
| 167 }); | 167 }); |
| 168 }); | 168 }); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void main() { | 171 void main() { |
| 172 testEarlyClose1(); | 172 testEarlyClose1(); |
| 173 testEarlyClose2(); | 173 testEarlyClose2(); |
| 174 testEarlyClose3(); | 174 testEarlyClose3(); |
| 175 } | 175 } |
| OLD | NEW |