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

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

Issue 9325062: Fix flakiness of SocketCloseTest by 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 connection.dataHandler = dataHandler; 254 connection.dataHandler = dataHandler;
255 connection.closeHandler = closeHandler; 255 connection.closeHandler = closeHandler;
256 connection.errorHandler = errorHandler; 256 connection.errorHandler = errorHandler;
257 } 257 }
258 258
259 void errorHandlerServer() { 259 void errorHandlerServer() {
260 Expect.fail("Server socket error"); 260 Expect.fail("Server socket error");
261 } 261 }
262 262
263 waitForResult(Timer timer) { 263 waitForResult(Timer timer) {
264 // Make sure all iterations have been run. For mode 0 and 1 the 264 // Make sure all iterations have been run. In multiple of these
265 // client just closes the socket and after the last iteration 265 // scenarios it is possible to get the SERVERSHUTDOWN message
266 // signals the server. The server might now be finished just 266 // before we have received the last close event on the
267 // because iterations have reached the limit as this number is 267 // server. We therefore always wait for the correct number of
268 // incremented just after accept. In that case wait for the last 268 // close events.
269 // close event. 269 if (_iterations == ITERATIONS && _closeEvents == ITERATIONS) {
270 if (_iterations == ITERATIONS &&
271 (_mode > 1 || _closeEvents == ITERATIONS)) {
272 switch (_mode) { 270 switch (_mode) {
273 case 0: 271 case 0:
274 Expect.equals(0, _dataEvents); 272 Expect.equals(0, _dataEvents);
275 Expect.equals(ITERATIONS, _closeEvents); 273 Expect.equals(ITERATIONS, _closeEvents);
276 break; 274 break;
277 case 1: 275 case 1:
278 Expect.equals(ITERATIONS, _dataEvents); 276 Expect.equals(ITERATIONS, _dataEvents);
279 Expect.equals(ITERATIONS, _closeEvents); 277 Expect.equals(ITERATIONS, _closeEvents);
280 break; 278 break;
281 case 2: 279 case 2:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 // 5: Client sends. Server responds and half closes. 337 // 5: Client sends. Server responds and half closes.
340 // 6: Client sends and half-closes. Server responds and half closes. 338 // 6: Client sends and half-closes. Server responds and half closes.
341 new SocketClose.start(0); 339 new SocketClose.start(0);
342 new SocketClose.start(1); 340 new SocketClose.start(1);
343 new SocketClose.start(2); 341 new SocketClose.start(2);
344 new SocketClose.start(3); 342 new SocketClose.start(3);
345 new SocketClose.start(4); 343 new SocketClose.start(4);
346 new SocketClose.start(5); 344 new SocketClose.start(5);
347 new SocketClose.start(6); 345 new SocketClose.start(6);
348 } 346 }
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