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

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

Issue 10578055: Rewrite guts of ResourceLoader and BufferedResourceHandler to suck less. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
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));
« no previous file with comments | « content/browser/renderer_host/redirect_to_file_resource_handler.cc ('k') | content/browser/renderer_host/resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698