Chromium Code Reviews

Unified Diff: net/url_request/url_request_unittest.cc

Issue 159034: Change URLRequest to return net::ERR_INVALID_URL on redirects to invalid urls. (Closed)
Patch Set: Address minor nits. Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « net/url_request/url_request.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 2aaac0a79afd4adc1065bab2ec56e2398c4884fc..167e7e4c68f5ac1d0be7abb74e12beaaed6b1823 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -1023,6 +1023,21 @@ TEST_F(URLRequestTest, RestrictRedirects) {
EXPECT_EQ(net::ERR_UNSAFE_REDIRECT, req.status().os_error());
}
+TEST_F(URLRequestTest, RedirectToInvalidURL) {
+ scoped_refptr<HTTPTestServer> server =
+ HTTPTestServer::CreateServer(L"net/data/url_request_unittest", NULL);
+ ASSERT_TRUE(NULL != server.get());
+
+ TestDelegate d;
+ TestURLRequest req(server->TestServerPage(
+ "files/redirect-to-invalid-url.html"), &d);
+ req.Start();
+ MessageLoop::current()->Run();
+
+ EXPECT_EQ(URLRequestStatus::FAILED, req.status().status());
+ EXPECT_EQ(net::ERR_INVALID_URL, req.status().os_error());
+}
+
TEST_F(URLRequestTest, NoUserPassInReferrer) {
scoped_refptr<HTTPTestServer> server =
HTTPTestServer::CreateServer(L"net/data/url_request_unittest", NULL);
« no previous file with comments | « net/url_request/url_request.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine