| 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 // Tests socket exceptions. | 5 // Tests socket exceptions. |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import "dart:async"; | 8 import "dart:async"; |
| 9 import "dart:isolate"; | 9 import "dart:isolate"; |
| 10 import "dart:io"; | 10 import "dart:io"; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 }); | 46 }); |
| 47 }); | 47 }); |
| 48 } | 48 } |
| 49 | 49 |
| 50 static void serverSocketListenCloseTest() { | 50 static void serverSocketListenCloseTest() { |
| 51 var port = new ReceivePort(); | 51 var port = new ReceivePort(); |
| 52 ServerSocket.bind().then((server) { | 52 ServerSocket.bind().then((server) { |
| 53 Socket.connect("127.0.0.1", server.port).then((socket) { | 53 Socket.connect("127.0.0.1", server.port).then((socket) { |
| 54 server.listen( | 54 server.listen( |
| 55 (incoming) => server.close(), | 55 (incoming) => server.close(), |
| 56 onDone: port.close()); | 56 onDone: port.close); |
| 57 }); | 57 }); |
| 58 }); | 58 }); |
| 59 } | 59 } |
| 60 | 60 |
| 61 static void clientSocketExceptionTest() { | 61 static void clientSocketExceptionTest() { |
| 62 bool exceptionCaught = false; | 62 bool exceptionCaught = false; |
| 63 bool wrongExceptionCaught = false; | 63 bool wrongExceptionCaught = false; |
| 64 | 64 |
| 65 ServerSocket.bind().then((server) { | 65 ServerSocket.bind().then((server) { |
| 66 Expect.isNotNull(server); | 66 Expect.isNotNull(server); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 clientSocketAddCloseErrorTest(); | 233 clientSocketAddCloseErrorTest(); |
| 234 clientSocketAddCloseResultErrorTest(); | 234 clientSocketAddCloseResultErrorTest(); |
| 235 unknownHostTest(); | 235 unknownHostTest(); |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 main() { | 239 main() { |
| 240 SocketExceptionTest.testMain(); | 240 SocketExceptionTest.testMain(); |
| 241 } | 241 } |
| 242 | 242 |
| OLD | NEW |