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

Unified Diff: tests/standalone/io/secure_client_server_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
Index: tests/standalone/io/secure_client_server_test.dart
diff --git a/tests/standalone/io/secure_client_server_test.dart b/tests/standalone/io/secure_client_server_test.dart
index 3c412668f5d7373f6c2c51876e0cc1b0321e7ccf..b4f3db147440e2d87a0fb3d8e67225c8582c0b57 100644
--- a/tests/standalone/io/secure_client_server_test.dart
+++ b/tests/standalone/io/secure_client_server_test.dart
@@ -14,11 +14,22 @@ import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
InternetAddress HOST;
-const CERTIFICATE = "localhost_cert";
+
+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<SecureServerSocket> startEchoServer() {
return SecureServerSocket.bind(HOST,
0,
- CERTIFICATE).then((server) {
+ serverContext).then((server) {
server.listen((SecureSocket client) {
client.fold(<int>[], (message, data) => message..addAll(data))
.then((message) {
@@ -31,7 +42,8 @@ Future<SecureServerSocket> startEchoServer() {
}
Future testClient(server) {
- return SecureSocket.connect(HOST, server.port).then((socket) {
+ return SecureSocket.connect(HOST, server.port, context: clientContext)
+ .then((socket) {
socket.write("Hello server.");
socket.close();
return socket.fold(<int>[], (message, data) => message..addAll(data))
@@ -44,9 +56,6 @@ Future testClient(server) {
void main() {
asyncStart();
- String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
- SecureSocket.initialize(database: certificateDatabase,
- password: 'dartdart');
InternetAddress.lookup("localhost").then((hosts) => HOST = hosts.first )
.then((_) => startEchoServer())
.then(testClient)
« no previous file with comments | « tests/standalone/io/secure_client_raw_server_test.dart ('k') | tests/standalone/io/secure_multiple_client_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698