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

Unified Diff: tests/standalone/io/secure_client_raw_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_raw_server_test.dart
diff --git a/tests/standalone/io/secure_client_raw_server_test.dart b/tests/standalone/io/secure_client_raw_server_test.dart
index e380f753d0494c74ccdb5aed1277549a097d146a..318edebf570274898888869759270e3caef60978 100644
--- a/tests/standalone/io/secure_client_raw_server_test.dart
+++ b/tests/standalone/io/secure_client_raw_server_test.dart
@@ -13,12 +13,21 @@ import "dart:io";
import "package:async_helper/async_helper.dart";
import "package:expect/expect.dart";
+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'));
+
InternetAddress HOST;
-const CERTIFICATE = "localhost_cert";
Future<RawSecureServerSocket> startEchoServer() {
return RawSecureServerSocket.bind(HOST,
0,
- CERTIFICATE).then((server) {
+ serverContext).then((server) {
server.listen((RawSecureSocket client) {
List<List<int>> readChunks = <List<int>>[];
List<int> dataToWrite = null;
@@ -60,7 +69,8 @@ Future<RawSecureServerSocket> startEchoServer() {
Future testClient(server) {
Completer success = new Completer();
List<String> chunks = <String>[];
- SecureSocket.connect(HOST, server.port).then((socket) {
+ SecureSocket.connect(HOST, server.port, context: clientContext)
+ .then((socket) {
socket.write("Hello server.");
socket.close();
socket.listen(
@@ -79,9 +89,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_builtin_roots_test.dart ('k') | tests/standalone/io/secure_client_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698