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

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

Issue 1389633003: Fixed checked-mode error in security_context_argument_test. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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; }
11 bool argumentError(e) => e is ArgumentError; 11 bool argumentError(e) => e is ArgumentError;
12 bool argumentTypeError(e) => e is ArgumentError || e is TypeError;
Søren Gjesse 2015/10/05 13:25:36 Please call it argumentOrTypeError.
12 bool tlsException(e) => e is TlsException; 13 bool tlsException(e) => e is TlsException;
13 14
14 void testUsePrivateKeyArguments() { 15 void testUsePrivateKeyArguments() {
15 var c = new SecurityContext(); 16 var c = new SecurityContext();
16 c.useCertificateChain(localFile('certificates/server_chain.pem')); 17 c.useCertificateChain(localFile('certificates/server_chain.pem'));
17 Expect.throws(() => c.usePrivateKey( 18 Expect.throws(() => c.usePrivateKey(
18 localFile('certificates/server_key.pem'), password: "dart" * 1000), 19 localFile('certificates/server_key.pem'), password: "dart" * 1000),
19 argumentError); 20 argumentError);
20 Expect.throws(() => c.usePrivateKey( 21 Expect.throws(() => c.usePrivateKey(
21 localFile('certificates/server_key.pem')), 22 localFile('certificates/server_key.pem')),
22 tlsException); 23 tlsException);
23 Expect.throws(() => c.usePrivateKey( 24 Expect.throws(() => c.usePrivateKey(
24 localFile('certificates/server_key.pem'), password: "iHackSites"), 25 localFile('certificates/server_key.pem'), password: "iHackSites"),
25 tlsException); 26 tlsException);
26 Expect.throws(() => c.usePrivateKey( 27 Expect.throws(() => c.usePrivateKey(
27 localFile('certificates/server_key_oops.pem'), password: "dartdart"), 28 localFile('certificates/server_key_oops.pem'), password: "dartdart"),
28 tlsException); 29 tlsException);
29 Expect.throws(() => c.usePrivateKey(1), argumentError); 30 Expect.throws(() => c.usePrivateKey(1), argumentTypeError);
30 Expect.throws(() => c.usePrivateKey(null), argumentError); 31 Expect.throws(() => c.usePrivateKey(null), argumentError);
31 Expect.throws(() => c.usePrivateKey( 32 Expect.throws(() => c.usePrivateKey(
32 localFile('certificates/server_key_oops.pem'), password: 3), 33 localFile('certificates/server_key_oops.pem'), password: 3),
33 argumentError); 34 argumentTypeError);
34 c.usePrivateKey( 35 c.usePrivateKey(
35 localFile('certificates/server_key.pem'), password: "dartdart"); 36 localFile('certificates/server_key.pem'), password: "dartdart");
36 } 37 }
37 38
38 void main() { 39 void main() {
39 testUsePrivateKeyArguments(); 40 testUsePrivateKeyArguments();
40 } 41 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698