Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: tests/standalone/io/secure_server_client_no_certificate_test.dart

Issue 1416843003: Add support for client certificates to Secure[Server]Socket (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comment Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/io/secure_server_client_certificate_test.dart ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/secure_server_client_no_certificate_test.dart
diff --git a/tests/standalone/io/secure_server_client_no_certificate_test.dart b/tests/standalone/io/secure_server_client_no_certificate_test.dart
deleted file mode 100644
index 97a422b5f2cf5bbbd040dde650c4c7f86204f2b9..0000000000000000000000000000000000000000
--- a/tests/standalone/io/secure_server_client_no_certificate_test.dart
+++ /dev/null
@@ -1,75 +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.
-
-import "dart:async";
-import "dart:io";
-
-import "package:async_helper/async_helper.dart";
-import "package:expect/expect.dart";
-
-InternetAddress HOST;
-String localFile(path) => Platform.script.resolve(path).toFilePath();
-
-SecurityContext serverContext = new SecurityContext()
- ..useCertificateChain(localFile('certificates/server_chain.pem'))
- ..usePrivateKey(localFile('certificates/server_key.pem'),
- password: 'dartdart');
-
-SecurityContext clientContext = new SecurityContext()
- ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'));
-
-Future testNoClientCertificate() {
- var completer = new Completer();
- SecureServerSocket.bind(HOST,
- 0,
- serverContext,
- requestClientCertificate: true).then((server) {
- var clientEndFuture = SecureSocket.connect(HOST,
- server.port,
- context: clientContext);
- server.listen((serverEnd) {
- X509Certificate certificate = serverEnd.peerCertificate;
- Expect.isNull(certificate);
- clientEndFuture.then((clientEnd) {
- clientEnd.close();
- serverEnd.close();
- server.close();
- completer.complete();
- });
- });
- });
- return completer.future;
-}
-
-Future testNoRequiredClientCertificate() {
- var completer = new Completer();
- bool clientError = false;
- SecureServerSocket.bind(HOST,
- 0,
- serverContext,
- requireClientCertificate: true).then((server) {
- Future clientDone =
- SecureSocket.connect(HOST, server.port, context: clientContext)
- .catchError((e) { clientError = true; });
- server.listen((serverEnd) {
- Expect.fail("Got a unverifiable connection");
- },
- onError: (e) {
- clientDone.then((_) {
- Expect.isTrue(clientError);
- server.close();
- completer.complete();
- });
- });
- });
- return completer.future;
-}
-
-void main() {
- asyncStart();
- InternetAddress.lookup("localhost").then((hosts) => HOST = hosts.first)
- .then((_) => testNoRequiredClientCertificate())
- .then((_) => testNoClientCertificate())
- .then((_) => asyncEnd());
-}
« no previous file with comments | « tests/standalone/io/secure_server_client_certificate_test.dart ('k') | tests/standalone/standalone.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698