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 // VMOptions= | 5 // VMOptions= |
| 6 // VMOptions=--short_socket_read | 6 // VMOptions=--short_socket_read |
| 7 // VMOptions=--short_socket_write | 7 // VMOptions=--short_socket_write |
| 8 // VMOptions=--short_socket_read --short_socket_write | 8 // VMOptions=--short_socket_read --short_socket_write |
| 9 | 9 |
| 10 import "dart:async"; | 10 import "dart:async"; |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 }); | 435 }); |
| 436 RawSocket.connect("127.0.0.1", server.port).then((socket) { | 436 RawSocket.connect("127.0.0.1", server.port).then((socket) { |
| 437 socket.close(); | 437 socket.close(); |
| 438 }); | 438 }); |
| 439 }); | 439 }); |
| 440 }, onError: (e) { | 440 }, onError: (e) { |
| 441 asyncEnd(); | 441 asyncEnd(); |
| 442 }); | 442 }); |
| 443 } | 443 } |
| 444 | 444 |
| 445 void testClosedError() { | |
| 446 asyncStart(); | |
| 447 RawServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) { | |
| 448 server.listen((socket) { socket.close(); }); | |
| 449 RawSocket.connect("127.0.0.1", server.port).then((socket) { | |
| 450 server.close(); | |
| 451 socket.close(); | |
| 452 try { | |
| 453 socket.port; | |
|
Anders Johnsen
2015/03/09 12:00:45
use Expect.throws instead?
Søren Gjesse
2015/03/09 13:33:46
Done.
| |
| 454 throw 'Getter succeeded'; | |
| 455 } on SocketException catch (e) { | |
| 456 } | |
| 457 try { | |
| 458 socket.remotePort; | |
| 459 throw 'Getter succeeded'; | |
| 460 } on SocketException catch (e) { | |
| 461 } | |
| 462 try { | |
| 463 socket.address; | |
| 464 throw 'Getter succeeded'; | |
| 465 } on SocketException catch (e) { | |
| 466 } | |
| 467 try { | |
| 468 socket.remoteAddress; | |
| 469 throw 'Getter succeeded'; | |
| 470 } on SocketException catch (e) { | |
| 471 } | |
| 472 asyncEnd(); | |
| 473 }); | |
| 474 }); | |
| 475 } | |
| 476 | |
| 445 main() { | 477 main() { |
| 446 asyncStart(); | 478 asyncStart(); |
| 447 testArguments(); | 479 testArguments(); |
| 448 testSimpleBind(); | 480 testSimpleBind(); |
| 449 testCloseOneEnd("client"); | 481 testCloseOneEnd("client"); |
| 450 testCloseOneEnd("server"); | 482 testCloseOneEnd("server"); |
| 451 testInvalidBind(); | 483 testInvalidBind(); |
| 452 testSimpleConnect(); | 484 testSimpleConnect(); |
| 453 testServerListenAfterConnect(); | 485 testServerListenAfterConnect(); |
| 454 testSimpleReadWrite(dropReads: false); | 486 testSimpleReadWrite(dropReads: false); |
| 455 testSimpleReadWrite(dropReads: true); | 487 testSimpleReadWrite(dropReads: true); |
| 456 testPauseServerSocket(); | 488 testPauseServerSocket(); |
| 457 testPauseSocket(); | 489 testPauseSocket(); |
| 458 testSocketZone(); | 490 testSocketZone(); |
| 459 testSocketZoneError(); | 491 testSocketZoneError(); |
| 492 testClosedError(); | |
| 460 asyncEnd(); | 493 asyncEnd(); |
| 461 } | 494 } |
| OLD | NEW |