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

Unified Diff: content/browser/renderer_host/resource_dispatcher_host_unittest.cc

Issue 8117003: Return a specific error code for unknown URL schemes. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rebase Created 9 years, 1 month 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 | « content/browser/renderer_host/resource_dispatcher_host.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/resource_dispatcher_host_unittest.cc
diff --git a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
index 1b5770362e2bf836ac3cbfa4731a6278f18aff09..887a5657e341c93ae85ddf3d9fd2d32092b9e0e9 100644
--- a/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -1222,3 +1222,36 @@ TEST_F(ResourceDispatcherHostTest, CancelRequestsForContext) {
host_.CancelRequestsForContext(&filter_->resource_context());
EXPECT_EQ(0, host_.pending_requests());
}
+
+TEST_F(ResourceDispatcherHostTest, UnknownURLScheme) {
+ EXPECT_EQ(0, host_.pending_requests());
+
+ SetResourceType(ResourceType::MAIN_FRAME);
+ HandleScheme("http");
+
+ MakeTestRequest(0, 1, GURL("foo://bar"));
+
+ // Flush all pending requests.
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
+
+ // Sorts out all the messages we saw by request.
+ ResourceIPCAccumulator::ClassifiedMessages msgs;
+ accum_.GetClassifiedMessages(&msgs);
+
+ // We should have gotten one RequestComplete message.
+ ASSERT_EQ(1U, msgs[0].size());
+ EXPECT_EQ(ResourceMsg_RequestComplete::ID, msgs[0][0].type());
+
+ // The RequestComplete message should have had status
+ // (FAILED, ERR_UNKNOWN_URL_SCHEME).
+ int request_id;
+ net::URLRequestStatus status;
+
+ void* iter = NULL;
+ EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id));
+ EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status));
+
+ EXPECT_EQ(1, request_id);
+ EXPECT_EQ(net::URLRequestStatus::FAILED, status.status());
+ EXPECT_EQ(net::ERR_UNKNOWN_URL_SCHEME, status.error());
+}
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698