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 c4c35c6bd1407d16744848c90e5877ce11c8bbde..e65506afe9c284aa0866d3b960491aa99dcab3a0 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")); |
wtc
2011/10/04 18:45:37
mkosiba: I don't understand why the network stack
wtc
2011/10/04 21:34:55
I did the experiment in gdb. I found that
net::UR
|
+ |
+ // 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()); |
+} |