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

Unified Diff: test/utils.dart

Issue 1432143003: Update the tests to run with Dart 1.13. (Closed) Base URL: git@github.com:dart-lang/http_server.git@master
Patch Set: Addressed review comments Created 5 years, 1 month 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
« no previous file with comments | « test/certificates/trusted_certs.pem ('k') | test/virtual_host_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/utils.dart
diff --git a/test/utils.dart b/test/utils.dart
index 80c16ca20020cf591444c110df9416cf9288e09b..128cb28bb11f37e31ef187699710b8c5ef92c398 100644
--- a/test/utils.dart
+++ b/test/utils.dart
@@ -13,6 +13,9 @@ import 'package:http_server/http_server.dart';
import 'http_mock.dart';
+SecurityContext serverContext;
+SecurityContext clientContext;
+
/**
* Used to flag a given test case as being a mock or not.
*/
@@ -85,7 +88,12 @@ Future<int> getStatusCode(int port,
int to}) {
var uri = _getUri(port, path, secure: secure, rawPath: rawPath);
- var client = new HttpClient();
+ var client;
+ if (secure) {
+ client = new HttpClient(context: clientContext);
+ } else {
+ client = new HttpClient();
+ }
return client.getUrl(uri)
.then((request) {
if (!followRedirects) request.followRedirects = false;
@@ -294,7 +302,13 @@ const CERTIFICATE = "localhost_cert";
void setupSecure() {
- String certificateDatabase = Platform.script.resolve('pkcert').toFilePath();
- SecureSocket.initialize(database: certificateDatabase,
- password: 'dartdart');
+ String localFile(path) => Platform.script.resolve(path).toFilePath();
+
+ serverContext = new SecurityContext()
+ ..useCertificateChain(localFile('certificates/server_chain.pem'))
+ ..usePrivateKey(localFile('certificates/server_key.pem'),
+ password: 'dartdart');
+
+ clientContext = new SecurityContext()
+ ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'));
}
« no previous file with comments | « test/certificates/trusted_certs.pem ('k') | test/virtual_host_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698