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

Unified Diff: tests/standalone/src/io/HttpClientTest.dart

Issue 9863031: Don't propagate http client error, when no response object is available. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/io/HttpClientTest.dart
===================================================================
--- tests/standalone/src/io/HttpClientTest.dart (revision 5866)
+++ tests/standalone/src/io/HttpClientTest.dart (working copy)
@@ -4,6 +4,7 @@
#import("dart:io");
#import("dart:uri");
+#import("dart:isolate");
void testGoogle() {
HttpClient client = new HttpClient();
@@ -62,10 +63,24 @@
() => client.getUrl(new Uri.fromString('http://usr:pwd@www.google.com')));
}
+void testBadHostName() {
+ HttpClient client = new HttpClient();
+ HttpClientConnection connection =
+ client.get("some.bad.host.name.7654321", 0, "/");
+ connection.onRequest = (HttpClientRequest request) {
+ Expect.fail("Should not open a request on bad hostname");
+ };
+ ReceivePort port = new ReceivePort();
+ connection.onError = (Exception error) {
+ port.close(); // We expect onError to be called, due to bad host name.
+ };
+}
+
void main() {
// TODO(sgjesse): Making empty www.google.com requests seems to fail
//on buildbot.
//testGoogle();
//testGoogleUrl();
testInvalidUrl();
+ testBadHostName();
}
« no previous file with comments | « runtime/bin/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698