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

Unified Diff: tests/standalone/io/https_bad_certificate_test.dart

Issue 22816008: dart:io | Add badCertificateCallback to HttpClient. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Improve documentation comments. Created 7 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/io/https_bad_certificate_client.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « tests/standalone/io/https_bad_certificate_client.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698