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

Unified Diff: tests/standalone/io/https_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/https_server_test.dart
diff --git a/tests/standalone/io/https_server_test.dart b/tests/standalone/io/https_server_test.dart
index cdba0642167086a57cd17f0d42115b1f1cdf2848..88a8b2a9214893c3b3875867dfacdc5639edfdcc 100644
--- a/tests/standalone/io/https_server_test.dart
+++ b/tests/standalone/io/https_server_test.dart
@@ -9,14 +9,23 @@ import "dart:isolate";
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'));
void testListenOn() {
void test(void onDone()) {
HttpServer.bindSecure(HOST,
0,
- backlog: 5,
- certificateName: CERTIFICATE).then((server) {
+ serverContext,
+ backlog: 5).then((server) {
ReceivePort serverPort = new ReceivePort();
server.listen((HttpRequest request) {
request.listen(
@@ -27,7 +36,7 @@ void testListenOn() {
});
});
- HttpClient client = new HttpClient();
+ HttpClient client = new HttpClient(context: clientContext);
ReceivePort clientPort = new ReceivePort();
client.getUrl(Uri.parse("https://${HOST.host}:${server.port}/"))
.then((HttpClientRequest request) {
@@ -58,16 +67,10 @@ void testListenOn() {
});
}
-void InitializeSSL() {
- var testPkcertDatabase = Platform.script.resolve('pkcert').toFilePath();
- SecureSocket.initialize(database: testPkcertDatabase,
- password: 'dartdart');
-}
-
void testEarlyClientClose() {
HttpServer.bindSecure(HOST,
0,
- certificateName: 'localhost_cert').then((server) {
+ serverContext).then((server) {
server.listen(
(request) {
String name = Platform.script.toFilePath();
@@ -96,7 +99,6 @@ void testEarlyClientClose() {
}
void main() {
- InitializeSSL();
InternetAddress.lookup("localhost").then((hosts) {
HOST = hosts.first;
testListenOn();
« no previous file with comments | « tests/standalone/io/https_client_certificate_test.dart ('k') | tests/standalone/io/https_unauthorized_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698