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

Side by Side Diff: tests/standalone/io/secure_unauthorized_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 failing secure connection attempts always complete 5 // This test verifies that failing secure connection attempts always complete
6 // their returned future. 6 // their returned future.
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import "package:path/path.dart"; 9 import "package:path/path.dart";
10 import "dart:async"; 10 import "dart:async";
11 import "dart:io"; 11 import "dart:io";
12 12
13 const HOST_NAME = "localhost"; 13 const HOST_NAME = "localhost";
14 const CERTIFICATE = "localhost_cert"; 14 const CERTIFICATE = "localhost_cert";
15 15
16 Future<SecureServerSocket> runServer() { 16 Future<SecureServerSocket> runServer() {
17 SecureSocket.initialize( 17 SecureSocket.initialize(
18 database: Platform.script.resolve('pkcert').toFilePath(), 18 database: join(dirname(Platform.script), 'pkcert'),
19 password: 'dartdart'); 19 password: 'dartdart');
20 20
21 return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE) 21 return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE)
22 .then((SecureServerSocket server) { 22 .then((SecureServerSocket server) {
23 server.listen((SecureSocket socket) { 23 server.listen((SecureSocket socket) {
24 socket.listen((_) { }, 24 socket.listen((_) { },
25 onDone: () { 25 onDone: () {
26 socket.close(); 26 socket.close();
27 }); 27 });
28 }, onError: (e) => Expect.isTrue(e is HandshakeException)); 28 }, onError: (e) => Expect.isTrue(e is HandshakeException));
29 return server; 29 return server;
30 }); 30 });
31 } 31 }
32 32
33 void main() { 33 void main() {
34 var clientScript = Platform.script 34 var clientScript = join(dirname(Platform.script),
35 .resolve('secure_unauthorized_client.dart') 35 'secure_unauthorized_client.dart');
36 .toFilePath();
37 36
38 Future clientProcess(int port) { 37 Future clientProcess(int port) {
39 return Process.run(Platform.executable, 38 return Process.run(Platform.executable,
40 [clientScript, port.toString()]) 39 [clientScript, port.toString()])
41 .then((ProcessResult result) { 40 .then((ProcessResult result) {
42 if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) { 41 if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {
43 print("Client failed"); 42 print("Client failed");
44 print(" stdout:"); 43 print(" stdout:");
45 print(result.stdout); 44 print(result.stdout);
46 print(" stderr:"); 45 print(" stderr:");
47 print(result.stderr); 46 print(result.stderr);
48 Expect.fail('Client subprocess exit code: ${result.exitCode}'); 47 Expect.fail('Client subprocess exit code: ${result.exitCode}');
49 } 48 }
50 }); 49 });
51 } 50 }
52 51
53 runServer().then((server) { 52 runServer().then((server) {
54 clientProcess(server.port).then((_) { 53 clientProcess(server.port).then((_) {
55 server.close(); 54 server.close();
56 }); 55 });
57 }); 56 });
58 } 57 }
OLDNEW
« no previous file with comments | « tests/standalone/io/secure_socket_test.dart ('k') | tests/standalone/io/skipping_dart2js_compilations_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698