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

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

Issue 1319703002: Breaking Change: merge BoringSSL branch into master (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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/https_bad_certificate_test.dart ('k') | tests/standalone/io/https_server_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/https_client_certificate_test.dart
diff --git a/tests/standalone/io/https_client_certificate_test.dart b/tests/standalone/io/https_client_certificate_test.dart
index f63d383cc0ebf5c6857d133f0ff93ebc1f8d8126..24d397848d4010b518e1eba0593422e45e91dfc6 100644
--- a/tests/standalone/io/https_client_certificate_test.dart
+++ b/tests/standalone/io/https_client_certificate_test.dart
@@ -10,14 +10,27 @@ import "package:expect/expect.dart";
import "package:path/path.dart";
const HOST_NAME = "localhost";
+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');
+// TODO: Specify which client certificate roots to trust.
-Function test() {
+SecurityContext clientContext = new SecurityContext()
+ ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'))
+// TODO: Set a client certificate here.
+ ..useCertificateChain(localFile('certificates/server_chain.pem'))
+ ..usePrivateKey(localFile('certificates/server_key.pem'),
+ password: 'dartdart');
+
+void main() {
asyncStart();
HttpServer.bindSecure(HOST_NAME,
0,
+ serverContext,
backlog: 5,
- certificateName: 'localhost_cert',
requestClientCertificate: true).then((server) {
server.listen((HttpRequest request) {
Expect.isNotNull(request.certificate);
@@ -26,7 +39,7 @@ Function test() {
request.response.close();
});
- HttpClient client = new HttpClient();
+ HttpClient client = new HttpClient(context: clientContext);
client.getUrl(Uri.parse("https://$HOST_NAME:${server.port}/"))
.then((request) => request.close())
.then((response) {
@@ -44,14 +57,3 @@ Function test() {
});
});
}
-
-void InitializeSSL() {
- var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
- SecureSocket.initialize(database: testPkcertDatabase,
- password: 'dartdart');
-}
-
-void main() {
- InitializeSSL();
- test();
-}
« no previous file with comments | « tests/standalone/io/https_bad_certificate_test.dart ('k') | tests/standalone/io/https_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698