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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 Expect.isFalse(exceptionCaught); | 88 Expect.isFalse(exceptionCaught); |
89 Expect.isFalse(wrongExceptionCaught); | 89 Expect.isFalse(wrongExceptionCaught); |
90 try { | 90 try { |
91 List<int> buffer = new List<int>(10); | 91 List<int> buffer = new List<int>(10); |
92 client.add(buffer); | 92 client.add(buffer); |
93 } on StateError catch (ex) { | 93 } on StateError catch (ex) { |
94 exceptionCaught = true; | 94 exceptionCaught = true; |
95 } catch (ex) { | 95 } catch (ex) { |
96 wrongExceptionCaught = true; | 96 wrongExceptionCaught = true; |
97 } | 97 } |
98 Expect.isTrue(exceptionCaught); | 98 Expect.isFalse(exceptionCaught); |
99 Expect.isFalse(wrongExceptionCaught); | 99 Expect.isFalse(wrongExceptionCaught); |
100 | 100 |
101 server.close(); | 101 server.close(); |
102 }); | 102 }); |
103 }); | 103 }); |
104 } | 104 } |
105 | 105 |
106 static void clientSocketDestroyNoErrorTest() { | 106 static void clientSocketDestroyNoErrorTest() { |
107 ServerSocket.bind("127.0.0.1", 0).then((server) { | 107 ServerSocket.bind("127.0.0.1", 0).then((server) { |
108 server.listen((socket) { | 108 server.listen((socket) { |
(...skipping 124 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 |