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

Side by Side Diff: tests/standalone/io/secure_session_resume_test.dart

Issue 1648793005: Adds SecurityContext.useCertificateChainBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: *AsBytes -> *Bytes Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 // This test tests TLS session resume, by making multiple client connections 5 // This test tests TLS session resume, by making multiple client connections
6 // on the same port to the same server, with a delay of 200 ms between them. 6 // on the same port to the same server, with a delay of 200 ms between them.
7 // The unmodified secure_server_test creates all sessions simultaneously, 7 // The unmodified secure_server_test creates all sessions simultaneously,
8 // which means that no handshake completes and caches its keys in the session 8 // which means that no handshake completes and caches its keys in the session
9 // cache in time for other connections to use it. 9 // cache in time for other connections to use it.
10 // 10 //
(...skipping 11 matching lines...) Expand all
22 22
23 import "package:expect/expect.dart"; 23 import "package:expect/expect.dart";
24 import "package:async_helper/async_helper.dart"; 24 import "package:async_helper/async_helper.dart";
25 25
26 InternetAddress HOST; 26 InternetAddress HOST;
27 27
28 String localFile(path) => Platform.script.resolve(path).toFilePath(); 28 String localFile(path) => Platform.script.resolve(path).toFilePath();
29 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync(); 29 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
30 30
31 SecurityContext serverContext = new SecurityContext() 31 SecurityContext serverContext = new SecurityContext()
32 ..useCertificateChain(localFile('certificates/server_chain.pem')) 32 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem'))
33 ..usePrivateKeyAsBytes(readLocalFile('certificates/server_key.pem'), 33 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'),
34 password: 'dartdart'); 34 password: 'dartdart');
35 35
36 SecurityContext clientContext = new SecurityContext() 36 SecurityContext clientContext = new SecurityContext()
37 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); 37 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'));
38 38
39 Future<SecureServerSocket> startServer() { 39 Future<SecureServerSocket> startServer() {
40 return SecureServerSocket.bind(HOST, 40 return SecureServerSocket.bind(HOST,
41 0, 41 0,
42 serverContext).then((server) { 42 serverContext).then((server) {
43 server.listen((SecureSocket client) { 43 server.listen((SecureSocket client) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 return startServer() 81 return startServer()
82 .then((server) => Future.wait( 82 .then((server) => Future.wait(
83 ['able', 'baker', 'charlie', 'dozen', 'elapse'] 83 ['able', 'baker', 'charlie', 'dozen', 'elapse']
84 .map((name) { 84 .map((name) {
85 delay += delay_between_connections; 85 delay += delay_between_connections;
86 return new Future.delayed(delay, () => server) 86 return new Future.delayed(delay, () => server)
87 .then((server) => testClient(server, name)); 87 .then((server) => testClient(server, name));
88 }))) 88 })))
89 .then((servers) => servers.first.close()); 89 .then((servers) => servers.first.close());
90 } 90 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_server_socket_test.dart ('k') | tests/standalone/io/secure_socket_alpn_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698