| 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 "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| 11 import "package:path/path.dart"; | 11 import "package:path/path.dart"; |
| 12 import "dart:async"; | 12 import "dart:async"; |
| 13 import "dart:io"; | 13 import "dart:io"; |
| 14 import "dart:isolate"; | 14 import "dart:isolate"; |
| 15 | 15 |
| 16 const SERVER_ADDRESS = "127.0.0.1"; | 16 const SERVER_ADDRESS = "127.0.0.1"; |
| 17 const CERTIFICATE = "localhost_cert"; | 17 const CERTIFICATE = "localhost_cert"; |
| 18 | 18 |
| 19 | |
| 20 void testArguments() { | 19 void testArguments() { |
| 21 bool isArgOrTypeError(e) => e is ArgumentError || e is TypeError; | 20 bool isArgOrTypeError(e) => e is ArgumentError || e is TypeError; |
| 22 Expect.throws(() => | 21 Expect.throws(() => RawSecureServerSocket.bind(SERVER_ADDRESS, 65536, null), |
| 23 RawSecureServerSocket.bind(SERVER_ADDRESS, 65536, null), | 22 isArgOrTypeError); |
| 24 isArgOrTypeError); | 23 Expect.throws(() => RawSecureServerSocket.bind(SERVER_ADDRESS, -1, null), |
| 25 Expect.throws(() => | 24 isArgOrTypeError); |
| 26 RawSecureServerSocket.bind(SERVER_ADDRESS, -1, null), | 25 Expect.throws( |
| 27 isArgOrTypeError); | 26 () => RawSecureServerSocket.bind(SERVER_ADDRESS, 0, null, backlog: -1), |
| 28 Expect.throws(() => RawSecureServerSocket.bind(SERVER_ADDRESS, 0, | 27 isArgOrTypeError); |
| 29 null, backlog: -1), | 28 Expect.throws( |
| 30 isArgOrTypeError); | 29 () => RawSecureSocket.connect(SERVER_ADDRESS, null), isArgOrTypeError); |
| 31 Expect.throws(() => RawSecureSocket.connect(SERVER_ADDRESS, null), | 30 Expect.throws( |
| 32 isArgOrTypeError); | 31 () => RawSecureSocket.connect(SERVER_ADDRESS, -1), isArgOrTypeError); |
| 33 Expect.throws(() => RawSecureSocket.connect(SERVER_ADDRESS, -1), | 32 Expect.throws( |
| 34 isArgOrTypeError); | 33 () => RawSecureSocket.connect(SERVER_ADDRESS, 345656), isArgOrTypeError); |
| 35 Expect.throws(() => RawSecureSocket.connect(SERVER_ADDRESS, 345656), | 34 Expect.throws( |
| 36 isArgOrTypeError); | 35 () => RawSecureSocket.connect(SERVER_ADDRESS, 'hest'), isArgOrTypeError); |
| 37 Expect.throws(() => RawSecureSocket.connect(SERVER_ADDRESS, 'hest'), | 36 Expect.throws(() => RawSecureSocket.connect(null, 0), isArgOrTypeError); |
| 38 isArgOrTypeError); | 37 Expect.throws( |
| 39 Expect.throws(() => RawSecureSocket.connect(null, 0), | 38 () => |
| 40 isArgOrTypeError); | 39 RawSecureSocket.connect(SERVER_ADDRESS, 0, onBadCertificate: 'hund'), |
| 41 Expect.throws(() => RawSecureSocket.connect(SERVER_ADDRESS, 0, | 40 isArgOrTypeError); |
| 42 onBadCertificate: 'hund'), | |
| 43 isArgOrTypeError); | |
| 44 } | 41 } |
| 45 | 42 |
| 46 | |
| 47 main() { | 43 main() { |
| 48 testArguments(); | 44 testArguments(); |
| 49 } | 45 } |
| OLD | NEW |