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

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

Issue 37033002: dart:io | Remove uses of Options class from standalone tests. Mark Options deprecated. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove commented lines from standalone.status. 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 the bad certificate callback works in HttpClient. 5 // This test verifies that the bad certificate callback works in HttpClient.
6 6
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "package:path/path.dart"; 8 import "package:path/path.dart";
9 import "dart:async"; 9 import "dart:async";
10 import "dart:io"; 10 import "dart:io";
11 11
12 const HOST_NAME = "localhost"; 12 const HOST_NAME = "localhost";
13 const CERTIFICATE = "localhost_cert"; 13 const CERTIFICATE = "localhost_cert";
14 14
15 Future<SecureServerSocket> runServer() { 15 Future<SecureServerSocket> runServer() {
16 SecureSocket.initialize( 16 SecureSocket.initialize(
17 database: join(dirname(new Options().script), 'pkcert'), 17 database: join(dirname(Platform.script), 'pkcert'),
18 password: 'dartdart'); 18 password: 'dartdart');
19 19
20 return HttpServer.bindSecure( 20 return HttpServer.bindSecure(
21 HOST_NAME, 0, backlog: 5, certificateName: 'localhost_cert') 21 HOST_NAME, 0, backlog: 5, certificateName: 'localhost_cert')
22 .then((server) { 22 .then((server) {
23 server.listen((HttpRequest request) { 23 server.listen((HttpRequest request) {
24 request.listen((_) { }, onDone: () { request.response.close(); }); 24 request.listen((_) { }, onDone: () { request.response.close(); });
25 }, onError: (e) { if (e is! HandshakeException) throw e; }); 25 }, onError: (e) { if (e is! HandshakeException) throw e; });
26 return server; 26 return server;
27 }); 27 });
28 } 28 }
29 29
30 void main() { 30 void main() {
31 final options = new Options();
32 var clientScript = 31 var clientScript =
33 join(dirname(options.script), 'https_bad_certificate_client.dart'); 32 join(dirname(Platform.script), 'https_bad_certificate_client.dart');
34 33
35 Future clientProcess(int port, String acceptCertificate) { 34 Future clientProcess(int port, String acceptCertificate) {
36 return Process.run(options.executable, 35 return Process.run(Platform.executable,
37 [clientScript, port.toString(), acceptCertificate]) 36 [clientScript, port.toString(), acceptCertificate])
38 .then((ProcessResult result) { 37 .then((ProcessResult result) {
39 if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) { 38 if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {
40 print("Client failed, acceptCertificate: $acceptCertificate"); 39 print("Client failed, acceptCertificate: $acceptCertificate");
41 print(" stdout:"); 40 print(" stdout:");
42 print(result.stdout); 41 print(result.stdout);
43 print(" stderr:"); 42 print(" stderr:");
44 print(result.stderr); 43 print(result.stderr);
45 Expect.fail('Client subprocess exit code: ${result.exitCode}'); 44 Expect.fail('Client subprocess exit code: ${result.exitCode}');
46 } 45 }
47 }); 46 });
48 } 47 }
49 48
50 runServer().then((server) { 49 runServer().then((server) {
51 Future.wait([clientProcess(server.port, 'true'), 50 Future.wait([clientProcess(server.port, 'true'),
52 clientProcess(server.port, 'false'), 51 clientProcess(server.port, 'false'),
53 clientProcess(server.port, 'fisk'), 52 clientProcess(server.port, 'fisk'),
54 clientProcess(server.port, 'exception')]).then((_) { 53 clientProcess(server.port, 'exception')]).then((_) {
55 server.close(); 54 server.close();
56 }); 55 });
57 }); 56 });
58 } 57 }
OLDNEW
« no previous file with comments | « tests/standalone/io/https_bad_certificate_client.dart ('k') | tests/standalone/io/https_unauthorized_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698