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

Side by Side Diff: tests/standalone/src/SocketStreamCloseTest.dart

Issue 9358026: Fix SocketStreamCloseTest flakiness because of not waiting for all close events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, 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 // Test socket close events. 5 // Test socket close events.
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 8
9 final SERVERSHUTDOWN = -1; 9 final SERVERSHUTDOWN = -1;
10 final ITERATIONS = 10; 10 final ITERATIONS = 10;
11 11
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 connection.inputStream.dataHandler = dataHandler; 233 connection.inputStream.dataHandler = dataHandler;
234 connection.inputStream.closeHandler = closeHandler; 234 connection.inputStream.closeHandler = closeHandler;
235 connection.errorHandler = errorHandler; 235 connection.errorHandler = errorHandler;
236 } 236 }
237 237
238 void errorHandlerServer() { 238 void errorHandlerServer() {
239 Expect.fail("Server socket error"); 239 Expect.fail("Server socket error");
240 } 240 }
241 241
242 waitForResult(Timer timer) { 242 waitForResult(Timer timer) {
243 // Make sure all iterations have been run. For mode 0 and 1 the 243 // Make sure all iterations have been run. In multiple of these
244 // client just closes the socket and after the last iteration 244 // scenarios it is possible to get the SERVERSHUTDOWN message
245 // signals the server. The server might now be finished just 245 // before we have received the last close event on the
246 // because iterations have reached the limit as this number is 246 // server. We therefore always wait for the correct number of
247 // incremented just after accept. In that case wait for the last 247 // close events.
248 // close event. 248 if (_iterations == ITERATIONS && _closeEvents == ITERATIONS) {
249 if (_iterations == ITERATIONS &&
250 (_mode > 1 || _closeEvents == ITERATIONS)) {
251 switch (_mode) { 249 switch (_mode) {
252 case 0: 250 case 0:
253 Expect.equals(0, _dataEvents); 251 Expect.equals(0, _dataEvents);
254 Expect.equals(ITERATIONS, _closeEvents); 252 Expect.equals(ITERATIONS, _closeEvents);
255 break; 253 break;
256 case 1: 254 case 1:
257 Expect.equals(ITERATIONS, _dataEvents); 255 Expect.equals(ITERATIONS, _dataEvents);
258 Expect.equals(ITERATIONS, _closeEvents); 256 Expect.equals(ITERATIONS, _closeEvents);
259 break; 257 break;
260 case 2: 258 case 2:
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // 5: Client sends. Server responds and half closes. 314 // 5: Client sends. Server responds and half closes.
317 // 6: Client sends and half-closes. Server responds and half closes. 315 // 6: Client sends and half-closes. Server responds and half closes.
318 new SocketClose.start(0); 316 new SocketClose.start(0);
319 new SocketClose.start(1); 317 new SocketClose.start(1);
320 new SocketClose.start(2); 318 new SocketClose.start(2);
321 new SocketClose.start(3); 319 new SocketClose.start(3);
322 new SocketClose.start(4); 320 new SocketClose.start(4);
323 new SocketClose.start(5); 321 new SocketClose.start(5);
324 new SocketClose.start(6); 322 new SocketClose.start(6);
325 } 323 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698