Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: tests/standalone/io/http_server_early_client_close_test.dart

Issue 14690009: Make Completers asynchronous. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698