| Index: tests/standalone/io/security_context_argument_test.dart
|
| diff --git a/tests/standalone/io/security_context_argument_test.dart b/tests/standalone/io/security_context_argument_test.dart
|
| index 5e263f63e6ede29617a18c8c82d2e214f1cb1b77..675fcc547e96b4b939131d0add88da6ecdb1de70 100644
|
| --- a/tests/standalone/io/security_context_argument_test.dart
|
| +++ b/tests/standalone/io/security_context_argument_test.dart
|
| @@ -6,35 +6,39 @@ import "package:expect/expect.dart";
|
| import "dart:io";
|
|
|
| String localFile(path) => Platform.script.resolve(path).toFilePath();
|
| +List<int> readLocalFile(path) => (new File(localFile(path))).readAsBytesSync();
|
|
|
| bool printException(e) { print(e); return true; }
|
| bool argumentError(e) => e is ArgumentError;
|
| bool argumentOrTypeError(e) => e is ArgumentError || e is TypeError;
|
| +bool fileSystemException(e) => e is FileSystemException;
|
| bool tlsException(e) => e is TlsException;
|
|
|
| void testUsePrivateKeyArguments() {
|
| var c = new SecurityContext();
|
| c.useCertificateChain(localFile('certificates/server_chain.pem'));
|
| - Expect.throws(() => c.usePrivateKey(
|
| - localFile('certificates/server_key.pem'), password: "dart" * 1000),
|
| + Expect.throws(() => c.usePrivateKeyBytes(
|
| + readLocalFile('certificates/server_key.pem'),
|
| + password: "dart" * 1000),
|
| argumentError);
|
| - Expect.throws(() => c.usePrivateKey(
|
| - localFile('certificates/server_key.pem')),
|
| + Expect.throws(() => c.usePrivateKeyBytes(
|
| + readLocalFile('certificates/server_key.pem')),
|
| tlsException);
|
| - Expect.throws(() => c.usePrivateKey(
|
| - localFile('certificates/server_key.pem'), password: "iHackSites"),
|
| + Expect.throws(() => c.usePrivateKeyBytes(
|
| + readLocalFile('certificates/server_key.pem'), password: "iHackSites"),
|
| tlsException);
|
| - Expect.throws(() => c.usePrivateKey(
|
| - localFile('certificates/server_key_oops.pem'), password: "dartdart"),
|
| - tlsException);
|
| - Expect.throws(() => c.usePrivateKey(1), argumentOrTypeError);
|
| - Expect.throws(() => c.usePrivateKey(null), argumentError);
|
| - Expect.throws(() => c.usePrivateKey(
|
| - localFile('certificates/server_key_oops.pem'), password: 3),
|
| - argumentOrTypeError);
|
| - c.usePrivateKey(
|
| - localFile('certificates/server_key.pem'), password: "dartdart");
|
| -}
|
| + Expect.throws(() => c.usePrivateKeyBytes(
|
| + readLocalFile('certificates/server_key_oops.pem'),
|
| + password: "dartdart"),
|
| + fileSystemException);
|
| + Expect.throws(() => c.usePrivateKeyBytes(1), argumentOrTypeError);
|
| + Expect.throws(() => c.usePrivateKeyBytes(null), argumentError);
|
| + Expect.throws(() => c.usePrivateKeyBytes(
|
| + readLocalFile('certificates/server_key_oops.pem'), password: 3),
|
| + fileSystemException);
|
| + c.usePrivateKeyBytes(
|
| + readLocalFile('certificates/server_key.pem'), password: "dartdart");
|
| +}
|
|
|
| void main() {
|
| testUsePrivateKeyArguments();
|
|
|