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

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

Issue 2837163002: Fixed racey testShutdown test, where echoServer was throwing an exception after trying to write to … (Closed)
Patch Set: Created 3 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
« 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 "dart:async"; 5 import "dart:async";
6 import "dart:io"; 6 import "dart:io";
7 import "dart:isolate"; 7 import "dart:isolate";
8 import "dart:math"; 8 import "dart:math";
9 9
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 381
382 // Close from both directions. Shouldn't be able to read/write to the 382 // Close from both directions. Shouldn't be able to read/write to the
383 // socket. 383 // socket.
384 socket.shutdown(SocketDirection.BOTH); 384 socket.shutdown(SocketDirection.BOTH);
385 Expect.throws( 385 Expect.throws(
386 () => socket.writeFromSync(data), (e) => e is SocketException); 386 () => socket.writeFromSync(data), (e) => e is SocketException);
387 Expect.throws( 387 Expect.throws(
388 () => socket.readSync(data.length), (e) => e is SocketException); 388 () => socket.readSync(data.length), (e) => e is SocketException);
389 socket.closeSync(); 389 socket.closeSync();
390 390
391 // Close the socket for reading, do a write, and see if we can get any 391 // Close the socket for reading then try and perform a read. This should
392 // response from the server (we shouldn't be able to). 392 // cause a SocketException.
393 socket = RawSynchronousSocket.connectSync( 393 socket = RawSynchronousSocket.connectSync(
394 LOOPBACK_IP_V4_STRING, serverInternetPort); 394 LOOPBACK_IP_V4_STRING, serverInternetPort);
395 socket.shutdown(SocketDirection.RECEIVE); 395 socket.shutdown(SocketDirection.RECEIVE);
siva 2017/04/27 18:28:56 Instead of deleting the write which is a good test
396 socket.writeFromSync(data);
397 // Throws exception when the socket is closed for RECEIVE. 396 // Throws exception when the socket is closed for RECEIVE.
398 Expect.throws( 397 Expect.throws(
399 () => socket.readSync(data.length), (e) => e is SocketException); 398 () => socket.readSync(data.length), (e) => e is SocketException);
400 socket.closeSync(); 399 socket.closeSync();
401 400
402 // Close the socket for writing and try to do a write. This should cause an 401 // Close the socket for writing and try to do a write. This should cause an
403 // OSError to be throw as the pipe is closed for writing. 402 // OSError to be throw as the pipe is closed for writing.
404 socket = RawSynchronousSocket.connectSync( 403 socket = RawSynchronousSocket.connectSync(
405 LOOPBACK_IP_V4_STRING, serverInternetPort); 404 LOOPBACK_IP_V4_STRING, serverInternetPort);
406 socket.shutdown(SocketDirection.SEND); 405 socket.shutdown(SocketDirection.SEND);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 await testShutdown(); 480 await testShutdown();
482 testSimpleConnect(); 481 testSimpleConnect();
483 testServerListenAfterConnect(); 482 testServerListenAfterConnect();
484 await testSimpleReadWrite(); 483 await testSimpleReadWrite();
485 await testPartialRead(); 484 await testPartialRead();
486 await testPartialWrite(); 485 await testPartialWrite();
487 testInvalidReadWriteOperations(); 486 testInvalidReadWriteOperations();
488 testClosedError(); 487 testClosedError();
489 asyncEnd(); 488 asyncEnd();
490 } 489 }
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