Chromium Code Reviews| 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 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:async"; | 6 import "dart:async"; |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 import "dart:isolate"; | 8 import "dart:isolate"; |
| 9 | 9 |
| 10 void sendData(List<int> data, int port) { | 10 void sendData(List<int> data, int port) { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 makeRequest() { | 118 makeRequest() { |
| 119 Socket.connect("127.0.0.1", server.port).then((socket) { | 119 Socket.connect("127.0.0.1", server.port).then((socket) { |
| 120 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; | 120 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; |
| 121 socket.write(data); | 121 socket.write(data); |
| 122 socket.close(); | 122 socket.close(); |
| 123 socket.done.then((_) { | 123 socket.done.then((_) { |
| 124 socket.destroy(); | 124 socket.destroy(); |
| 125 if (++count < 10) { | 125 if (++count < 10) { |
| 126 makeRequest(); | 126 makeRequest(); |
| 127 } else { | 127 } else { |
| 128 runAsync(server.close); | |
| 129 } | |
| 130 }); | |
| 131 }); | |
| 132 } | |
| 133 makeRequest(); | |
| 134 }); | |
| 135 } | |
| 136 | |
| 137 testEarlyClose2b() { | |
|
Anders Johnsen
2013/05/06 07:44:42
Florian,
This test is already flaky. We have it t
floitsch
2013/05/06 15:14:45
Extracted it into a separate file and marked it as
| |
| 138 HttpServer.bind("127.0.0.1", 0).then((server) { | |
| 139 server.listen( | |
| 140 (request) { | |
| 141 String name = new Options().script; | |
| 142 new File(name).openRead().pipe(request.response) | |
| 143 .catchError((e) { /* ignore */ }); | |
| 144 }); | |
| 145 | |
| 146 var count = 0; | |
| 147 makeRequest() { | |
| 148 Socket.connect("127.0.0.1", server.port).then((socket) { | |
| 149 var data = "GET / HTTP/1.1\r\nContent-Length: 0\r\n\r\n"; | |
| 150 socket.write(data); | |
| 151 socket.close(); | |
| 152 socket.done.then((_) { | |
| 153 socket.destroy(); | |
| 154 if (++count < 10) { | |
| 155 makeRequest(); | |
| 156 } else { | |
| 128 server.close(); | 157 server.close(); |
| 129 } | 158 } |
| 130 }); | 159 }); |
| 131 }); | 160 }); |
| 132 } | 161 } |
| 133 makeRequest(); | 162 makeRequest(); |
| 134 }); | 163 }); |
| 135 } | 164 } |
| 136 | 165 |
| 137 void testEarlyClose3() { | 166 void testEarlyClose3() { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 155 socket.close(); | 184 socket.close(); |
| 156 socket.listen((_) {}, onError: (_) {}); | 185 socket.listen((_) {}, onError: (_) {}); |
| 157 socket.done.catchError((_) {}); | 186 socket.done.catchError((_) {}); |
| 158 }); | 187 }); |
| 159 }); | 188 }); |
| 160 } | 189 } |
| 161 | 190 |
| 162 void main() { | 191 void main() { |
| 163 testEarlyClose1(); | 192 testEarlyClose1(); |
| 164 testEarlyClose2(); | 193 testEarlyClose2(); |
| 194 // testEarlyClose2b(); | |
|
Lasse Reichstein Nielsen
2013/05/06 06:49:11
Commented code?
floitsch
2013/05/06 15:14:45
I asked Anders to look into it. This test started
| |
| 165 testEarlyClose3(); | 195 testEarlyClose3(); |
| 166 } | 196 } |
| OLD | NEW |