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

Side by Side Diff: tests/standalone/io/https_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
« no previous file with comments | « tests/standalone/io/https_server_test.dart ('k') | tests/standalone/io/platform_test.dart » ('j') | 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) 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 secure connections that fail due to 5 // This test verifies that secure connections that fail due to
6 // unauthenticated certificates throw exceptions in HttpClient. 6 // unauthenticated certificates throw exceptions in HttpClient.
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 HttpServer.bindSecure( 21 return HttpServer.bindSecure(
22 HOST_NAME, 0, backlog: 5, certificateName: 'localhost_cert') 22 HOST_NAME, 0, backlog: 5, certificateName: 'localhost_cert')
23 .then((server) { 23 .then((server) {
24 server.listen((HttpRequest request) { 24 server.listen((HttpRequest request) {
25 request.listen((_) { }, onDone: () { request.response.close(); }); 25 request.listen((_) { }, onDone: () { request.response.close(); });
26 }, onError: (e) { if (e is! HandshakeException) throw e; }); 26 }, onError: (e) { if (e is! HandshakeException) throw e; });
27 return server; 27 return server;
28 }); 28 });
29 } 29 }
30 30
31 void main() { 31 void main() {
32 var clientScript = Platform.script 32 var clientScript = join(dirname(Platform.script),
33 .resolve('https_unauthorized_client.dart') 33 'https_unauthorized_client.dart');
34 .toFilePath(); 34
35 Future clientProcess(int port) { 35 Future clientProcess(int port) {
36 return Process.run(Platform.executable, 36 return Process.run(Platform.executable,
37 [clientScript, port.toString()]) 37 [clientScript, port.toString()])
38 .then((ProcessResult result) { 38 .then((ProcessResult result) {
39 if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) { 39 if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {
40 print("Client failed"); 40 print("Client failed");
41 print(" stdout:"); 41 print(" stdout:");
42 print(result.stdout); 42 print(result.stdout);
43 print(" stderr:"); 43 print(" stderr:");
44 print(result.stderr); 44 print(result.stderr);
45 Expect.fail('Client subprocess exit code: ${result.exitCode}'); 45 Expect.fail('Client subprocess exit code: ${result.exitCode}');
46 } 46 }
47 }); 47 });
48 } 48 }
49 49
50 runServer().then((server) { 50 runServer().then((server) {
51 clientProcess(server.port).then((_) { 51 clientProcess(server.port).then((_) {
52 server.close(); 52 server.close();
53 }); 53 });
54 }); 54 });
55 } 55 }
OLDNEW
« no previous file with comments | « tests/standalone/io/https_server_test.dart ('k') | tests/standalone/io/platform_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698