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

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

Issue 1665433002: Adds SecurityContext.setTrustedCertificatesBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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 verifies that client certificates work, if the client and server 5 // This test verifies that client certificates work, if the client and server
6 // are in separate processes, and that connection renegotiation works, and 6 // are in separate processes, and that connection renegotiation works, and
7 // can request a client certificate to be sent. 7 // can request a client certificate to be sent.
8 8
9 import "dart:async"; 9 import "dart:async";
10 import "dart:convert"; 10 import "dart:convert";
11 import "dart:io"; 11 import "dart:io";
12 12
13 import "package:expect/expect.dart"; 13 import "package:expect/expect.dart";
14 import "package:path/path.dart"; 14 import "package:path/path.dart";
15 15
16 const HOST_NAME = "localhost"; 16 const HOST_NAME = "localhost";
17 String localFile(path) => Platform.script.resolve(path).toFilePath(); 17 String localFile(path) => Platform.script.resolve(path).toFilePath();
18 List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
19 18
20 SecurityContext serverContext = new SecurityContext() 19 SecurityContext serverContext = new SecurityContext()
21 ..useCertificateChainBytes(readLocalFile('certificates/server_chain.pem')) 20 ..useCertificateChainSync(localFile('certificates/server_chain.pem'))
22 ..usePrivateKeyBytes(readLocalFile('certificates/server_key.pem'), 21 ..usePrivateKeySync(localFile('certificates/server_key.pem'),
23 password: 'dartdart'); 22 password: 'dartdart');
24 23
25 Future<SecureServerSocket> runServer() { 24 Future<SecureServerSocket> runServer() {
26 return SecureServerSocket.bind(HOST_NAME, 0, serverContext) 25 return SecureServerSocket.bind(HOST_NAME, 0, serverContext)
27 .then((SecureServerSocket server) { 26 .then((SecureServerSocket server) {
28 server.listen((SecureSocket socket) { 27 server.listen((SecureSocket socket) {
29 Expect.isNull(socket.peerCertificate); 28 Expect.isNull(socket.peerCertificate);
30 29
31 StreamIterator<String> input = 30 StreamIterator<String> input =
32 new StreamIterator(socket.transform(UTF8.decoder) 31 new StreamIterator(socket.transform(UTF8.decoder)
33 .transform(new LineSplitter())); 32 .transform(new LineSplitter()));
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (result.exitCode != 0) { 74 if (result.exitCode != 0) {
76 print("Client failed, stdout:"); 75 print("Client failed, stdout:");
77 print(result.stdout); 76 print(result.stdout);
78 print(" stderr:"); 77 print(" stderr:");
79 print(result.stderr); 78 print(result.stderr);
80 Expect.fail('Client subprocess exit code: ${result.exitCode}'); 79 Expect.fail('Client subprocess exit code: ${result.exitCode}');
81 } 80 }
82 }); 81 });
83 }); 82 });
84 } 83 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_socket_renegotiate_client.dart ('k') | tests/standalone/io/secure_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698