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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 }); | 111 }); |
112 } | 112 } |
113 } | 113 } |
114 runTest(tests.iterator); | 114 runTest(tests.iterator); |
115 } | 115 } |
116 | 116 |
117 testEarlyClose2() { | 117 testEarlyClose2() { |
118 HttpServer.bind("127.0.0.1", 0).then((server) { | 118 HttpServer.bind("127.0.0.1", 0).then((server) { |
119 server.listen( | 119 server.listen( |
120 (request) { | 120 (request) { |
121 String name = new Options().script; | 121 String name = Platform.script; |
122 new File(name).openRead().pipe(request.response) | 122 new File(name).openRead().pipe(request.response) |
123 .catchError((e) { /* ignore */ }); | 123 .catchError((e) { /* ignore */ }); |
124 }); | 124 }); |
125 | 125 |
126 var count = 0; | 126 var count = 0; |
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(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |