| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class SocketExceptionTest { | 7 class SocketExceptionTest { |
| 8 | 8 |
| 9 static final PORT = 0; | 9 static final PORT = 0; |
| 10 static final HOST = "127.0.0.1"; | 10 static final HOST = "127.0.0.1"; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } catch (SocketIOException ex) { | 86 } catch (SocketIOException ex) { |
| 87 exceptionCaught = true; | 87 exceptionCaught = true; |
| 88 } catch (Exception ex) { | 88 } catch (Exception ex) { |
| 89 wrongExceptionCaught = true; | 89 wrongExceptionCaught = true; |
| 90 } | 90 } |
| 91 Expect.equals(true, exceptionCaught); | 91 Expect.equals(true, exceptionCaught); |
| 92 Expect.equals(true, !wrongExceptionCaught); | 92 Expect.equals(true, !wrongExceptionCaught); |
| 93 exceptionCaught = false; | 93 exceptionCaught = false; |
| 94 try { | 94 try { |
| 95 List<int> buffer = new List<int>(42); | 95 List<int> buffer = new List<int>(42); |
| 96 bool readDone = input.read(buffer, 0, 12, null); | 96 bool readDone = input.readInto(buffer, 0, 12); |
| 97 } catch (SocketIOException ex) { | 97 } catch (SocketIOException ex) { |
| 98 exceptionCaught = true; | 98 exceptionCaught = true; |
| 99 } catch (Exception ex) { | 99 } catch (Exception ex) { |
| 100 wrongExceptionCaught = true; | 100 wrongExceptionCaught = true; |
| 101 } | 101 } |
| 102 Expect.equals(true, exceptionCaught); | 102 Expect.equals(true, exceptionCaught); |
| 103 Expect.equals(true, !wrongExceptionCaught); | 103 Expect.equals(true, !wrongExceptionCaught); |
| 104 exceptionCaught = false; | 104 exceptionCaught = false; |
| 105 try { | 105 try { |
| 106 List<int> buffer = new List<int>(42); | 106 List<int> buffer = new List<int>(42); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 static void testMain() { | 179 static void testMain() { |
| 180 serverSocketExceptionTest(); | 180 serverSocketExceptionTest(); |
| 181 clientSocketExceptionTest(); | 181 clientSocketExceptionTest(); |
| 182 indexOutOfRangeExceptionTest(); | 182 indexOutOfRangeExceptionTest(); |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 main() { | 186 main() { |
| 187 SocketExceptionTest.testMain(); | 187 SocketExceptionTest.testMain(); |
| 188 } | 188 } |
| OLD | NEW |