| Index: tests/standalone/io/secure_unauthorized_test.dart
|
| diff --git a/tests/standalone/io/secure_bad_certificate_test.dart b/tests/standalone/io/secure_unauthorized_test.dart
|
| similarity index 60%
|
| copy from tests/standalone/io/secure_bad_certificate_test.dart
|
| copy to tests/standalone/io/secure_unauthorized_test.dart
|
| index ccdbf324b9d589dd6b1792bd8c28077e2550179e..a86b95c098cbfc4b4aa7d64d94d1eee570df2abd 100644
|
| --- a/tests/standalone/io/secure_bad_certificate_test.dart
|
| +++ b/tests/standalone/io/secure_unauthorized_test.dart
|
| @@ -2,7 +2,8 @@
|
| // 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 failing secure connection attempts always complete
|
| +// their returned future.
|
|
|
| import "package:expect/expect.dart";
|
| import "package:path/path.dart";
|
| @@ -12,13 +13,10 @@ 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');
|
| + SecureSocket.initialize(
|
| + database: join(dirname(new Options().script), 'pkcert'),
|
| + password: 'dartdart');
|
|
|
| return SecureServerSocket.bind(HOST_NAME, 0, CERTIFICATE)
|
| .then((SecureServerSocket server) {
|
| @@ -32,18 +30,18 @@ Future<SecureServerSocket> runServer() {
|
| });
|
| }
|
|
|
| -
|
| void main() {
|
| final options = new Options();
|
| var clientScript = join(dirname(options.script),
|
| - 'secure_bad_certificate_client.dart');
|
| + 'secure_unauthorized_client.dart');
|
|
|
| - Future clientProcess(int port, String acceptCertificate) {
|
| + Future clientProcess(int port) {
|
| return Process.run(options.executable,
|
| - [clientScript, port.toString(), acceptCertificate])
|
| - .then((ProcessResult result) {
|
| - if (result.exitCode != 0) {
|
| - print("Client failed, stdout:");
|
| + [clientScript, port.toString()])
|
| + .then((ProcessResult result) {
|
| + if (result.exitCode != 0 || !result.stdout.contains('SUCCESS')) {
|
| + print("Client failed");
|
| + print(" stdout:");
|
| print(result.stdout);
|
| print(" stderr:");
|
| print(result.stderr);
|
| @@ -53,10 +51,7 @@ void main() {
|
| }
|
|
|
| runServer().then((server) {
|
| - Future.wait([clientProcess(server.port, 'true'),
|
| - clientProcess(server.port, 'false'),
|
| - clientProcess(server.port, 'fisk'),
|
| - clientProcess(server.port, 'exception')]).then((_) {
|
| + clientProcess(server.port).then((_) {
|
| server.close();
|
| });
|
| });
|
|
|