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

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

Issue 19668012: Make secure_socket_bad_certificate_test more robust. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/secure_socket_bad_certificate_test.dart
diff --git a/tests/standalone/io/secure_socket_bad_certificate_test.dart b/tests/standalone/io/secure_socket_bad_certificate_test.dart
index dbd13d1ebe48f51a94e6be963d70120e13f9fcd8..5edba315f38835fe8cd3dd680b8c7c6d87a675cf 100644
--- a/tests/standalone/io/secure_socket_bad_certificate_test.dart
+++ b/tests/standalone/io/secure_socket_bad_certificate_test.dart
@@ -18,16 +18,13 @@ import "dart:io";
void main() {
ReceivePort keepAlive = new ReceivePort();
SecureSocket.initialize(useBuiltinRoots: false);
- testCertificateCallback(host: "www.google.dk",
- acceptCertificate: false).then((_) {
- testCertificateCallback(host: "www.google.dk",
- acceptCertificate: true).then((_) {
- keepAlive.close();
- // TODO(7153): Open a receive port, and close it when we get here.
- // Currently, it can happen that neither onClosed or onError is called.
- // So we never reach this point. Diagnose this and fix.
- });
- });
+ testCertificateCallback(host: "www.google.com",
+ acceptCertificate: false)
+ .then((_) =>
+ testCertificateCallback(host: "www.google.com",
+ acceptCertificate: true))
+ .then((_) =>
+ keepAlive.close());
}
Future testCertificateCallback({String host, bool acceptCertificate}) {
@@ -52,9 +49,13 @@ Future testCertificateCallback({String host, bool acceptCertificate}) {
return socket.fold(<int>[], (message, data) => message..addAll(data))
.then((message) {
String received = new String.fromCharCodes(message);
- Expect.isTrue(received.contains('</body></html>'));
+ Expect.isTrue(received.startsWith('HTTP/1.0 '));
});
}).catchError((e) {
- Expect.isFalse(acceptCertificate);
+ if (e is HandshakeException) {
+ Expect.isFalse(acceptCertificate);
+ } else {
+ Expect.isTrue(e is SocketException);
+ }
});
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698