OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/renderer_host/resource_dispatcher_host_impl.h" | 5 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 host_.BlockRequestsForRoute(second_filter->child_id(), 1); | 926 host_.BlockRequestsForRoute(second_filter->child_id(), 1); |
927 | 927 |
928 MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1()); | 928 MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1()); |
929 MakeTestRequest(filter_.get(), 1, 2, net::URLRequestTestJob::test_url_2()); | 929 MakeTestRequest(filter_.get(), 1, 2, net::URLRequestTestJob::test_url_2()); |
930 MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3()); | 930 MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3()); |
931 MakeTestRequest(second_filter.get(), 1, 4, | 931 MakeTestRequest(second_filter.get(), 1, 4, |
932 net::URLRequestTestJob::test_url_1()); | 932 net::URLRequestTestJob::test_url_1()); |
933 MakeTestRequest(filter_.get(), 2, 5, net::URLRequestTestJob::test_url_2()); | 933 MakeTestRequest(filter_.get(), 2, 5, net::URLRequestTestJob::test_url_2()); |
934 MakeTestRequest(filter_.get(), 2, 6, net::URLRequestTestJob::test_url_3()); | 934 MakeTestRequest(filter_.get(), 2, 6, net::URLRequestTestJob::test_url_3()); |
935 | 935 |
| 936 host_.CancelRequestsForProcess(filter_->child_id()); |
| 937 host_.CancelRequestsForProcess(second_filter->child_id()); |
| 938 |
936 // Flush all the pending requests. | 939 // Flush all the pending requests. |
937 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} | 940 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} |
938 } | 941 } |
939 | 942 |
940 // Test the private helper method "CalculateApproximateMemoryCost()". | 943 // Test the private helper method "CalculateApproximateMemoryCost()". |
941 TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { | 944 TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { |
942 net::URLRequest req(GURL("http://www.google.com"), NULL); | 945 net::URLRequest req(GURL("http://www.google.com"), NULL); |
943 EXPECT_EQ(4427, | 946 EXPECT_EQ(4427, |
944 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); | 947 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); |
945 | 948 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 PickleIterator iter(msgs[0][0]); | 1388 PickleIterator iter(msgs[0][0]); |
1386 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id)); | 1389 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id)); |
1387 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status)); | 1390 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status)); |
1388 | 1391 |
1389 EXPECT_EQ(1, request_id); | 1392 EXPECT_EQ(1, request_id); |
1390 EXPECT_EQ(net::URLRequestStatus::FAILED, status.status()); | 1393 EXPECT_EQ(net::URLRequestStatus::FAILED, status.status()); |
1391 EXPECT_EQ(net::ERR_UNKNOWN_URL_SCHEME, status.error()); | 1394 EXPECT_EQ(net::ERR_UNKNOWN_URL_SCHEME, status.error()); |
1392 } | 1395 } |
1393 | 1396 |
1394 } // namespace content | 1397 } // namespace content |
OLD | NEW |