| Index: content/browser/renderer_host/resource_dispatcher_host_unittest.cc
|
| ===================================================================
|
| --- content/browser/renderer_host/resource_dispatcher_host_unittest.cc (revision 144275)
|
| +++ content/browser/renderer_host/resource_dispatcher_host_unittest.cc (working copy)
|
| @@ -1253,6 +1253,7 @@
|
|
|
| // Tests that we don't sniff the mime type when there is no message body.
|
| TEST_F(ResourceDispatcherHostTest, MimeNotSniffed2) {
|
| +
|
| EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
|
|
|
| std::string response("HTTP/1.1 304 Not Modified\n\n");
|
| @@ -1306,6 +1307,33 @@
|
| ASSERT_EQ("text/plain", response_head.mime_type);
|
| }
|
|
|
| +TEST_F(ResourceDispatcherHostTest, MimeSniffEmpty) {
|
| + EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
|
| +
|
| + std::string response("HTTP/1.1 200 OK\n\n");
|
| + std::string raw_headers(net::HttpUtil::AssembleRawHeaders(response.data(),
|
| + response.size()));
|
| + std::string response_data;
|
| + SetResponse(raw_headers, response_data);
|
| +
|
| + HandleScheme("http");
|
| + MakeTestRequest(0, 1, GURL("http:bla"));
|
| +
|
| + // Flush all pending requests.
|
| + while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
|
| +
|
| + EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
|
| +
|
| + // Sorts out all the messages we saw by request.
|
| + ResourceIPCAccumulator::ClassifiedMessages msgs;
|
| + accum_.GetClassifiedMessages(&msgs);
|
| + ASSERT_EQ(1U, msgs.size());
|
| +
|
| + content::ResourceResponseHead response_head;
|
| + GetResponseHead(msgs[0], &response_head);
|
| + ASSERT_EQ("text/plain", response_head.mime_type);
|
| +}
|
| +
|
| // Tests for crbug.com/31266 (Non-2xx + application/octet-stream).
|
| TEST_F(ResourceDispatcherHostTest, ForbiddenDownload) {
|
| EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
|
|
|