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

Unified Diff: tests/standalone/io/secure_socket_alpn_test.dart

Issue 1616073004: Adds SecurityContext.usePrivateKeyBytes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 11 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_alpn_test.dart
diff --git a/tests/standalone/io/secure_socket_alpn_test.dart b/tests/standalone/io/secure_socket_alpn_test.dart
index 3ad9112b1e2eadd9442eaf67167d4b2dff10a2d1..fc7e102963243df4ead03f94b054a356d77e5040 100644
--- a/tests/standalone/io/secure_socket_alpn_test.dart
+++ b/tests/standalone/io/secure_socket_alpn_test.dart
@@ -15,14 +15,15 @@ const String MESSAGE_LENGTH_ERROR =
'The maximum message length supported is 2^13-1';
String localFile(path) => Platform.script.resolve(path).toFilePath();
+List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
SecurityContext clientContext() => new SecurityContext()
..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem'));
SecurityContext serverContext() => new SecurityContext()
..useCertificateChain(localFile('certificates/server_chain.pem'))
- ..usePrivateKey(localFile('certificates/server_key.pem'),
- password: 'dartdart');
+ ..usePrivateKeyAsBytes(readLocalFile('certificates/server_key.pem'),
+ password: 'dartdart');
// Tests that client/server with same protocol can securely establish a
// connection, negotiate the protocol and can send data to each other.
@@ -67,7 +68,7 @@ void testInvalidArgument(List<String> protocols, String errorIncludes) {
}
void testInvalidArgumentServerContext(List<String> protocols,
- String errorIncludes) {
+ String errorIncludes) {
Expect.throws(() => serverContext().setAlpnProtocols(protocols, true), (e) {
Expect.isTrue(e is ArgumentError);
Expect.isTrue(e.toString().contains(errorIncludes));
@@ -76,7 +77,7 @@ void testInvalidArgumentServerContext(List<String> protocols,
}
void testInvalidArgumentClientContext(List<String> protocols,
- String errorIncludes) {
+ String errorIncludes) {
Expect.throws(() => clientContext().setAlpnProtocols(protocols, false), (e) {
Expect.isTrue(e is ArgumentError);
Expect.isTrue(e.toString().contains(errorIncludes));
« no previous file with comments | « tests/standalone/io/secure_session_resume_test.dart ('k') | tests/standalone/io/secure_socket_renegotiate_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698