| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
| 10 #include "chrome/browser/child_process_security_policy.h" | 10 #include "chrome/browser/child_process_security_policy.h" |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 839 | 839 |
| 840 // Sorts out all the messages we saw by request. | 840 // Sorts out all the messages we saw by request. |
| 841 ResourceIPCAccumulator::ClassifiedMessages msgs; | 841 ResourceIPCAccumulator::ClassifiedMessages msgs; |
| 842 accum_.GetClassifiedMessages(&msgs); | 842 accum_.GetClassifiedMessages(&msgs); |
| 843 ASSERT_EQ(1U, msgs.size()); | 843 ASSERT_EQ(1U, msgs.size()); |
| 844 | 844 |
| 845 ResourceResponseHead response_head; | 845 ResourceResponseHead response_head; |
| 846 GetResponseHead(msgs[0], &response_head); | 846 GetResponseHead(msgs[0], &response_head); |
| 847 ASSERT_EQ("", response_head.mime_type); | 847 ASSERT_EQ("", response_head.mime_type); |
| 848 } | 848 } |
| 849 |
| 850 TEST_F(ResourceDispatcherHostTest, MimeSniff204) { |
| 851 EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0)); |
| 852 |
| 853 std::string response("HTTP/1.1 204 No Content\n\n"); |
| 854 std::string raw_headers(net::HttpUtil::AssembleRawHeaders(response.data(), |
| 855 response.size())); |
| 856 std::string response_data; |
| 857 SetResponse(raw_headers, response_data); |
| 858 |
| 859 HandleScheme("http"); |
| 860 MakeTestRequest(0, 1, GURL("http:bla")); |
| 861 |
| 862 // Flush all pending requests. |
| 863 while (URLRequestTestJob::ProcessOnePendingMessage()); |
| 864 |
| 865 EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0)); |
| 866 |
| 867 // Sorts out all the messages we saw by request. |
| 868 ResourceIPCAccumulator::ClassifiedMessages msgs; |
| 869 accum_.GetClassifiedMessages(&msgs); |
| 870 ASSERT_EQ(1U, msgs.size()); |
| 871 |
| 872 ResourceResponseHead response_head; |
| 873 GetResponseHead(msgs[0], &response_head); |
| 874 ASSERT_EQ("text/plain", response_head.mime_type); |
| 875 } |
| OLD | NEW |