OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // Client for secure_bad_certificate_test, that runs in a subprocess. | 5 // Client for secure_bad_certificate_test, that runs in a subprocess. |
6 // The test verifies that the client bad certificate callback works. | 6 // The test verifies that the client bad certificate callback works. |
7 | 7 |
8 import "dart:async"; | 8 import "dart:async"; |
9 import "dart:io"; | 9 import "dart:io"; |
10 | 10 |
11 String localFile(path) => Platform.script.resolve(path).toFilePath(); | 11 String localFile(path) => Platform.script.resolve(path).toFilePath(); |
12 | 12 |
13 SecurityContext clientContext = new SecurityContext() | 13 SecurityContext clientContext = new SecurityContext() |
14 ..setTrustedCertificates(file: localFile('certificates/trusted_certs.pem')); | 14 ..setTrustedCertificatesSync(localFile('certificates/trusted_certs.pem')); |
15 | 15 |
16 class ExpectException implements Exception { | 16 class ExpectException implements Exception { |
17 ExpectException(this.message); | 17 ExpectException(this.message); |
18 String toString() => "ExpectException: $message"; | 18 String toString() => "ExpectException: $message"; |
19 String message; | 19 String message; |
20 } | 20 } |
21 | 21 |
22 void expect(condition) { | 22 void expect(condition) { |
23 if (!condition) { | 23 if (!condition) { |
24 throw new ExpectException(''); | 24 throw new ExpectException(''); |
(...skipping 14 matching lines...) Expand all Loading... |
39 })); | 39 })); |
40 } | 40 } |
41 return Future.wait(testFutures); | 41 return Future.wait(testFutures); |
42 } | 42 } |
43 | 43 |
44 | 44 |
45 void main(List<String> args) { | 45 void main(List<String> args) { |
46 runClients(int.parse(args[0])) | 46 runClients(int.parse(args[0])) |
47 .then((_) => print('SUCCESS')); | 47 .then((_) => print('SUCCESS')); |
48 } | 48 } |
OLD | NEW |