| Index: tests/standalone/io/https_bad_certificate_test.dart
|
| diff --git a/tests/standalone/io/secure_bad_certificate_test.dart b/tests/standalone/io/https_bad_certificate_test.dart
|
| similarity index 58%
|
| copy from tests/standalone/io/secure_bad_certificate_test.dart
|
| copy to tests/standalone/io/https_bad_certificate_test.dart
|
| index ccdbf324b9d589dd6b1792bd8c28077e2550179e..90236809de01c5a9988505d4b53dfccfd9cf96fb 100644
|
| --- a/tests/standalone/io/secure_bad_certificate_test.dart
|
| +++ b/tests/standalone/io/https_bad_certificate_test.dart
|
| @@ -2,7 +2,7 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -// This test verifies that the bad certificate callback works.
|
| +// This test verifies that the bad certificate callback works in HttpClient.
|
|
|
| import "package:expect/expect.dart";
|
| import "package:path/path.dart";
|
| @@ -12,38 +12,33 @@ import "dart:io";
|
| const HOST_NAME = "localhost";
|
| const CERTIFICATE = "localhost_cert";
|
|
|
| -
|
| -String certificateDatabase() =>
|
| - join(dirname(new Options().script), 'pkcert');
|
| -
|
| Future<SecureServerSocket> runServer() {
|
| - SecureSocket.initialize(database: certificateDatabase(),
|
| - password: 'dartdart');
|
| -
|
| - return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE)
|
| - .then((SecureServerSocket server) {
|
| - server.listen((SecureSocket socket) {
|
| - socket.listen((_) { },
|
| - onDone: () {
|
| - socket.close();
|
| - });
|
| - }, onError: (e) => Expect.isTrue(e is HandshakeException));
|
| + SecureSocket.initialize(
|
| + database: join(dirname(new Options().script), 'pkcert'),
|
| + password: 'dartdart');
|
| +
|
| + return HttpServer.bindSecure(
|
| + HOST_NAME, 0, backlog: 5, certificateName: 'localhost_cert')
|
| + .then((server) {
|
| + server.listen((HttpRequest request) {
|
| + request.listen((_) { }, onDone: () { request.response.close(); });
|
| + }, onError: (e) { if (e is! HandshakeException) throw e; });
|
| return server;
|
| });
|
| }
|
|
|
| -
|
| void main() {
|
| final options = new Options();
|
| - var clientScript = join(dirname(options.script),
|
| - 'secure_bad_certificate_client.dart');
|
| + var clientScript =
|
| + join(dirname(options.script), 'https_bad_certificate_client.dart');
|
|
|
| Future clientProcess(int port, String acceptCertificate) {
|
| return Process.run(options.executable,
|
| [clientScript, port.toString(), acceptCertificate])
|
| - .then((ProcessResult result) {
|
| - if (result.exitCode != 0) {
|
| - print("Client failed, stdout:");
|
| + .then((ProcessResult result) {
|
| + if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {
|
| + print("Client failed, acceptCertificate: $acceptCertificate");
|
| + print(" stdout:");
|
| print(result.stdout);
|
| print(" stderr:");
|
| print(result.stderr);
|
|
|