| OLD | NEW |
| 1 // Copyright (c) 2012, 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 // Tests socket exceptions. | 5 // Tests socket exceptions. |
| 6 | 6 |
| 7 #import("dart:isolate"); | 7 #import("dart:isolate"); |
| 8 #import("dart:io"); | 8 #import("dart:io"); |
| 9 | 9 |
| 10 class SocketExceptionTest { | 10 class SocketExceptionTest { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } catch (SocketIOException ex) { | 80 } catch (SocketIOException ex) { |
| 81 exceptionCaught = true; | 81 exceptionCaught = true; |
| 82 } catch (Exception ex) { | 82 } catch (Exception ex) { |
| 83 wrongExceptionCaught = true; | 83 wrongExceptionCaught = true; |
| 84 } | 84 } |
| 85 Expect.equals(true, exceptionCaught); | 85 Expect.equals(true, exceptionCaught); |
| 86 Expect.equals(true, !wrongExceptionCaught); | 86 Expect.equals(true, !wrongExceptionCaught); |
| 87 exceptionCaught = false; | 87 exceptionCaught = false; |
| 88 try { | 88 try { |
| 89 List<int> buffer = new List<int>(42); | 89 List<int> buffer = new List<int>(42); |
| 90 bool readDone = input.readInto(buffer, 0, 12); | 90 input.readInto(buffer, 0, 12); |
| 91 } catch (SocketIOException ex) { | 91 } catch (SocketIOException ex) { |
| 92 exceptionCaught = true; | 92 exceptionCaught = true; |
| 93 } catch (Exception ex) { | 93 } catch (Exception ex) { |
| 94 wrongExceptionCaught = true; | 94 wrongExceptionCaught = true; |
| 95 } | 95 } |
| 96 Expect.equals(true, exceptionCaught); | 96 Expect.equals(true, exceptionCaught); |
| 97 Expect.equals(true, !wrongExceptionCaught); | 97 Expect.equals(true, !wrongExceptionCaught); |
| 98 exceptionCaught = false; | 98 exceptionCaught = false; |
| 99 try { | 99 try { |
| 100 List<int> buffer = new List<int>(42); | 100 List<int> buffer = new List<int>(42); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 indexOutOfRangeExceptionTest(); | 199 indexOutOfRangeExceptionTest(); |
| 200 unknownHostTest(); | 200 unknownHostTest(); |
| 201 // TODO(sgjesse): This test seems to fail on the buildbot. | 201 // TODO(sgjesse): This test seems to fail on the buildbot. |
| 202 //unresponsiveHostTest(); | 202 //unresponsiveHostTest(); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 main() { | 206 main() { |
| 207 SocketExceptionTest.testMain(); | 207 SocketExceptionTest.testMain(); |
| 208 } | 208 } |
| OLD | NEW |