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

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

Issue 21716004: dart:io | Add SecureSocket.importPrivateCertificates, that reads a PKCS#12 file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add delayed deletion of locked temp directory on Windows. Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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 // This test verifies that a server certificate can be verified by a client 5 // This test verifies that a server certificate can be verified by a client
6 // that loads the certificate authority certificate it depends on at runtime. 6 // that loads the certificate authority certificate it depends on at runtime.
7 7
8 import "package:path/path.dart"; 8 import "package:path/path.dart";
9 import "dart:io"; 9 import "dart:io";
10 import "dart:async"; 10 import "dart:async";
11 11
12 String scriptDir = dirname(new Options().script); 12 String scriptDir = dirname(new Options().script);
13 13
14 void main() { 14 void main() {
15 SecureSocket.initialize(database: join(scriptDir, 'pkcert'), 15 SecureSocket.initialize(database: join(scriptDir, 'pkcert'),
16 password: 'dartdart'); 16 password: 'dartdart');
17 runServer().then((SecureServerSocket server) { 17 runServer().then((SecureServerSocket server) {
18 return Process.run(new Options().executable, 18 return Process.run(new Options().executable,
19 ['--checked', 19 ['--checked',
20 join(scriptDir, 'certificate_test_client.dart'), 20 join(scriptDir, 'certificate_test_client.dart'),
21 server.port.toString(), 21 server.port.toString(),
22 join(scriptDir, 'pkcert', 'myauthority.pem')]); 22 join(scriptDir, 'pkcert', 'myauthority.pem')]);
23 }).then((ProcessResult result) { 23 }).then((ProcessResult result) {
24 if (result.exitCode != 0) { 24 if (result.exitCode != 0 || !result.stdout.contains("SUCCESS")) {
25 print("Client failed with exit code ${result.exitCode}"); 25 print("Client failed with exit code ${result.exitCode}");
26 print(" stdout:"); 26 print(" stdout (expects \"SUCCESS\\n\"):");
27 print(result.stdout); 27 print(result.stdout);
28 print(" stderr:"); 28 print(" stderr:");
29 print(result.stderr); 29 print(result.stderr);
30 throw new AssertionError(); 30 throw new AssertionError();
31 } 31 }
32 }); 32 });
33 } 33 }
34 34
35 Future<SecureServerSocket> runServer() => 35 Future<SecureServerSocket> runServer() =>
36 SecureServerSocket.bind("localhost", 0, "localhost_cert") 36 SecureServerSocket.bind("localhost", 0, "localhost_cert")
37 .then((server) => server..listen( 37 .then((server) => server..listen(
38 (socket) => socket.pipe(socket).then((_) => server.close()))); 38 (socket) => socket.pipe(socket).then((_) => server.close())));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698