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

Side by Side Diff: tests/standalone/io/security_context_argument_test.dart

Issue 1699163002: More SecurityContext calls accept a password. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import "dart:io"; 6 import "dart:io";
7 7
8 String localFile(path) => Platform.script.resolve(path).toFilePath(); 8 String localFile(path) => Platform.script.resolve(path).toFilePath();
9 9
10 bool printException(e) { print(e); return true; } 10 bool printException(e) { print(e); return true; }
(...skipping 13 matching lines...) Expand all
24 tlsException); 24 tlsException);
25 Expect.throws(() => c.usePrivateKeySync( 25 Expect.throws(() => c.usePrivateKeySync(
26 localFile('certificates/server_key.pem'), password: "iHackSites"), 26 localFile('certificates/server_key.pem'), password: "iHackSites"),
27 tlsException); 27 tlsException);
28 Expect.throws(() => c.usePrivateKeySync( 28 Expect.throws(() => c.usePrivateKeySync(
29 localFile('certificates/server_key_oops.pem'), 29 localFile('certificates/server_key_oops.pem'),
30 password: "dartdart"), 30 password: "dartdart"),
31 fileSystemException); 31 fileSystemException);
32 Expect.throws(() => c.usePrivateKeySync(1), argumentOrTypeError); 32 Expect.throws(() => c.usePrivateKeySync(1), argumentOrTypeError);
33 Expect.throws(() => c.usePrivateKeySync(null), argumentError); 33 Expect.throws(() => c.usePrivateKeySync(null), argumentError);
34
35 // Bad password type.
34 Expect.throws(() => c.usePrivateKeySync( 36 Expect.throws(() => c.usePrivateKeySync(
35 localFile('certificates/server_key.pem'), password: 3), 37 localFile('certificates/server_key.pem'), password: 3),
36 argumentOrTypeError); 38 argumentOrTypeError);
39 Expect.throws(() => c.setTrustedCertificatesBytes(
40 localFile('certificates/server_key.pem'), password: 3),
41 argumentOrTypeError);
42 Expect.throws(() => c.useCertificateChainBytes(
Bill Hesse 2016/02/16 20:33:05 We could do more tests - Null, and a really long s
zra 2016/02/17 18:42:44 Done.
43 localFile('certificates/server_key.pem'), password: 3),
44 argumentOrTypeError);
45 Expect.throws(() => c.setClientAuthoritiesBytes(
46 localFile('certificates/server_key.pem'), password: 3),
47 argumentOrTypeError);
37 48
38 // Empty data. 49 // Empty data.
39 Expect.throws(() => c.usePrivateKeyBytes([], password: 'dartdart'), 50 Expect.throws(() => c.usePrivateKeyBytes([], password: 'dartdart'),
40 tlsException); 51 tlsException);
41 Expect.throws(() => c.setTrustedCertificatesBytes([]), tlsException); 52 Expect.throws(() => c.setTrustedCertificatesBytes([]), tlsException);
42 Expect.throws(() => c.useCertificateChainBytes([]), tlsException); 53 Expect.throws(() => c.useCertificateChainBytes([]), tlsException);
43 Expect.throws(() => c.setClientAuthoritiesBytes([]), argumentError); 54 Expect.throws(() => c.setClientAuthoritiesBytes([]), argumentError);
44 55
45 // Malformed PEM certs. 56 // Malformed PEM certs.
46 Expect.throws(() => c.usePrivateKeySync( 57 Expect.throws(() => c.usePrivateKeySync(
(...skipping 13 matching lines...) Expand all
60 localFile('certificates/client_authority_malformed.pem')), 71 localFile('certificates/client_authority_malformed.pem')),
61 argumentError); 72 argumentError);
62 73
63 c.usePrivateKeySync( 74 c.usePrivateKeySync(
64 localFile('certificates/server_key.pem'), password: "dartdart"); 75 localFile('certificates/server_key.pem'), password: "dartdart");
65 } 76 }
66 77
67 void main() { 78 void main() {
68 testUsePrivateKeyArguments(); 79 testUsePrivateKeyArguments();
69 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698