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

Unified Diff: tests/standalone/io/secure_socket_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_socket_test.dart
diff --git a/tests/standalone/io/secure_socket_test.dart b/tests/standalone/io/secure_socket_test.dart
index 143b73d13d8dbe4455988b315db5e249cdc21777..897bd84bea1234bc50a09e947e83c596f1b3127c 100644
--- a/tests/standalone/io/secure_socket_test.dart
+++ b/tests/standalone/io/secure_socket_test.dart
@@ -12,12 +12,22 @@ import "package:path/path.dart";
import "dart:async";
import "dart:io";
+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<HttpServer> startServer() {
return HttpServer.bindSecure(
"localhost",
0,
- backlog: 5,
- certificateName: 'localhost_cert').then((server) {
+ serverContext,
+ backlog: 5).then((server) {
server.listen((HttpRequest request) {
request.listen(
(_) { },
@@ -33,17 +43,11 @@ Future<HttpServer> startServer() {
});
}
-void InitializeSSL() {
- var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
- SecureSocket.initialize(database: testPkcertDatabase,
- password: 'dartdart');
-}
-
void main() {
- InitializeSSL();
List<int> body = <int>[];
startServer().then((server) {
- SecureSocket.connect("localhost", server.port).then((socket) {
+ SecureSocket.connect("localhost", server.port, context: clientContext)
+ .then((socket) {
socket.write("GET / HTTP/1.0\r\nHost: localhost\r\n\r\n");
socket.close();
socket.listen(
« no previous file with comments | « tests/standalone/io/secure_socket_renegotiate_test.dart ('k') | tests/standalone/io/secure_unauthorized_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698