Index: tests/standalone/io/secure_bad_certificate_client.dart |
diff --git a/tests/standalone/io/secure_bad_certificate_client.dart b/tests/standalone/io/secure_bad_certificate_client.dart |
deleted file mode 100644 |
index c3922aeac3f1e15335a764a2d738707d7b17e25b..0000000000000000000000000000000000000000 |
--- a/tests/standalone/io/secure_bad_certificate_client.dart |
+++ /dev/null |
@@ -1,58 +0,0 @@ |
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
-// for details. All rights reserved. Use of this source code is governed by a |
-// BSD-style license that can be found in the LICENSE file. |
- |
-// Client for secure_bad_certificate_test, that runs in a subprocess. |
-// The test verifies that the client bad certificate callback works. |
- |
-import "dart:async"; |
-import "dart:io"; |
- |
-class ExpectException implements Exception { |
- ExpectException(this.message); |
- String toString() => "ExpectException: $message"; |
- String message; |
-} |
- |
-void expect(condition) { |
- if (!condition) { |
- throw new ExpectException(''); |
- } |
-} |
- |
-const HOST_NAME = "localhost"; |
- |
-void runClient(int port, result) { |
- bool badCertificateCallback(X509Certificate certificate) { |
- expect('CN=localhost' == certificate.subject); |
- expect('CN=myauthority' == certificate.issuer); |
- expect(result != 'exception'); // Throw exception if one is requested. |
- if (result == 'true') result = true; |
- if (result == 'false') result = false; |
- return result; |
- } |
- |
- SecureSocket.connect(HOST_NAME, |
- port, |
- onBadCertificate: badCertificateCallback) |
- .then((SecureSocket socket) { |
- expect(result); |
- socket.close(); |
- }, |
- onError: (error) { |
- expect(result != true); |
- if (result == false) { |
- expect(error is HandshakeException); |
- } else if (result == 'exception') { |
- expect(error is ExpectException); |
- } else { |
- expect(error is ArgumentError); |
- } |
- }); |
-} |
- |
- |
-void main(List<String> args) { |
- SecureSocket.initialize(); |
- runClient(int.parse(args[0]), args[1]); |
-} |