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

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

Issue 52723007: Revert "Change dart:io Platform.script to return a Uri." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 client certificates work, if the client and server 5 // This test verifies that client certificates work, if the client and server
6 // are in separate processes, and that connection renegotiation works, and 6 // are in separate processes, and that connection renegotiation works, and
7 // can request a client certificate to be sent. 7 // can request a client certificate to be sent.
8 8
9 import "dart:async"; 9 import "dart:async";
10 import "dart:convert"; 10 import "dart:convert";
11 import "dart:io"; 11 import "dart:io";
12 12
13 import "package:expect/expect.dart"; 13 import "package:expect/expect.dart";
14 import "package:path/path.dart"; 14 import "package:path/path.dart";
15 15
16 const HOST_NAME = "localhost"; 16 const HOST_NAME = "localhost";
17 const CERTIFICATE = "localhost_cert"; 17 const CERTIFICATE = "localhost_cert";
18 18
19 19
20 String certificateDatabase() => Platform.script.resolve('pkcert').toFilePath(); 20 String certificateDatabase() => join(dirname(Platform.script), 'pkcert');
21 21
22 22
23 Future<SecureServerSocket> runServer() { 23 Future<SecureServerSocket> runServer() {
24 SecureSocket.initialize(database: certificateDatabase(), 24 SecureSocket.initialize(database: certificateDatabase(),
25 password: 'dartdart'); 25 password: 'dartdart');
26 26
27 return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE) 27 return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE)
28 .then((SecureServerSocket server) { 28 .then((SecureServerSocket server) {
29 server.listen((SecureSocket socket) { 29 server.listen((SecureSocket socket) {
30 Expect.isNull(socket.peerCertificate); 30 Expect.isNull(socket.peerCertificate);
(...skipping 27 matching lines...) Expand all
58 }); 58 });
59 }); 59 });
60 return server; 60 return server;
61 }); 61 });
62 } 62 }
63 63
64 64
65 void main() { 65 void main() {
66 runServer() 66 runServer()
67 .then((SecureServerSocket server) { 67 .then((SecureServerSocket server) {
68 var clientScript = Platform.script 68 var clientScript =
69 .toFilePath() 69 Platform.script.replaceFirst("_test.dart", "_client.dart");
70 .replaceFirst("_test.dart", "_client.dart");
71 Expect.isTrue(clientScript.endsWith("_client.dart")); 70 Expect.isTrue(clientScript.endsWith("_client.dart"));
72 Process.run(Platform.executable, 71 Process.run(Platform.executable,
73 [clientScript, 72 [clientScript,
74 server.port.toString(), 73 server.port.toString(),
75 certificateDatabase()]) 74 certificateDatabase()])
76 .then((ProcessResult result) { 75 .then((ProcessResult result) {
77 if (result.exitCode != 0) { 76 if (result.exitCode != 0) {
78 print("Client failed, stdout:"); 77 print("Client failed, stdout:");
79 print(result.stdout); 78 print(result.stdout);
80 print(" stderr:"); 79 print(" stderr:");
81 print(result.stderr); 80 print(result.stderr);
82 Expect.fail('Client subprocess exit code: ${result.exitCode}'); 81 Expect.fail('Client subprocess exit code: ${result.exitCode}');
83 } 82 }
84 }); 83 });
85 }); 84 });
86 } 85 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_socket_bad_data_test.dart ('k') | tests/standalone/io/secure_socket_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698