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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "content/public/common/process_type.h" | 26 #include "content/public/common/process_type.h" |
27 #include "content/public/common/resource_response.h" | 27 #include "content/public/common/resource_response.h" |
28 #include "content/public/test/test_browser_context.h" | 28 #include "content/public/test/test_browser_context.h" |
29 #include "content/test/test_content_browser_client.h" | 29 #include "content/test/test_content_browser_client.h" |
30 #include "net/base/net_errors.h" | 30 #include "net/base/net_errors.h" |
31 #include "net/base/upload_bytes_element_reader.h" | 31 #include "net/base/upload_bytes_element_reader.h" |
32 #include "net/base/upload_data_stream.h" | 32 #include "net/base/upload_data_stream.h" |
33 #include "net/http/http_util.h" | 33 #include "net/http/http_util.h" |
34 #include "net/url_request/url_request.h" | 34 #include "net/url_request/url_request.h" |
35 #include "net/url_request/url_request_context.h" | 35 #include "net/url_request/url_request_context.h" |
| 36 #include "net/url_request/url_request_context_getter.h" |
36 #include "net/url_request/url_request_job.h" | 37 #include "net/url_request/url_request_job.h" |
37 #include "net/url_request/url_request_simple_job.h" | 38 #include "net/url_request/url_request_simple_job.h" |
38 #include "net/url_request/url_request_test_job.h" | 39 #include "net/url_request/url_request_test_job.h" |
39 #include "testing/gtest/include/gtest/gtest.h" | 40 #include "testing/gtest/include/gtest/gtest.h" |
40 #include "webkit/common/appcache/appcache_interfaces.h" | 41 #include "webkit/common/appcache/appcache_interfaces.h" |
41 | 42 |
42 // TODO(eroman): Write unit tests for SafeBrowsing that exercise | 43 // TODO(eroman): Write unit tests for SafeBrowsing that exercise |
43 // SafeBrowsingResourceHandler. | 44 // SafeBrowsingResourceHandler. |
44 | 45 |
45 namespace content { | 46 namespace content { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 net::URLRequestContext* const request_context_; | 176 net::URLRequestContext* const request_context_; |
176 }; | 177 }; |
177 | 178 |
178 // This class forwards the incoming messages to the ResourceDispatcherHostTest. | 179 // This class forwards the incoming messages to the ResourceDispatcherHostTest. |
179 // This is used to emulate different sub-processes, since this filter will | 180 // This is used to emulate different sub-processes, since this filter will |
180 // have a different ID than the original. For the test, we want all the incoming | 181 // have a different ID than the original. For the test, we want all the incoming |
181 // messages to go to the same place, which is why this forwards. | 182 // messages to go to the same place, which is why this forwards. |
182 class ForwardingFilter : public ResourceMessageFilter { | 183 class ForwardingFilter : public ResourceMessageFilter { |
183 public: | 184 public: |
184 explicit ForwardingFilter(IPC::Sender* dest, | 185 explicit ForwardingFilter(IPC::Sender* dest, |
185 ResourceContext* resource_context) | 186 ResourceContext* resource_context, |
| 187 net::URLRequestContextGetter* request_context) |
186 : ResourceMessageFilter( | 188 : ResourceMessageFilter( |
187 ChildProcessHostImpl::GenerateChildProcessUniqueId(), | 189 ChildProcessHostImpl::GenerateChildProcessUniqueId(), |
188 PROCESS_TYPE_RENDERER, | 190 PROCESS_TYPE_RENDERER, |
189 resource_context, NULL, NULL, NULL, | 191 resource_context, NULL, NULL, NULL, |
190 new MockURLRequestContextSelector( | 192 new MockURLRequestContextSelector( |
191 resource_context->GetRequestContext())), | 193 request_context->GetURLRequestContext())), |
192 dest_(dest) { | 194 dest_(dest) { |
193 OnChannelConnected(base::GetCurrentProcId()); | 195 OnChannelConnected(base::GetCurrentProcId()); |
194 } | 196 } |
195 | 197 |
196 // ResourceMessageFilter override | 198 // ResourceMessageFilter override |
197 virtual bool Send(IPC::Message* msg) OVERRIDE { | 199 virtual bool Send(IPC::Message* msg) OVERRIDE { |
198 if (!dest_) | 200 if (!dest_) |
199 return false; | 201 return false; |
200 return dest_->Send(msg); | 202 return dest_->Send(msg); |
201 } | 203 } |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 file_thread_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), | 528 file_thread_(BrowserThread::FILE_USER_BLOCKING, &message_loop_), |
527 cache_thread_(BrowserThread::CACHE, &message_loop_), | 529 cache_thread_(BrowserThread::CACHE, &message_loop_), |
528 io_thread_(BrowserThread::IO, &message_loop_), | 530 io_thread_(BrowserThread::IO, &message_loop_), |
529 old_factory_(NULL), | 531 old_factory_(NULL), |
530 resource_type_(ResourceType::SUB_RESOURCE), | 532 resource_type_(ResourceType::SUB_RESOURCE), |
531 send_data_received_acks_(false) { | 533 send_data_received_acks_(false) { |
532 browser_context_.reset(new TestBrowserContext()); | 534 browser_context_.reset(new TestBrowserContext()); |
533 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); | 535 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); |
534 message_loop_.RunUntilIdle(); | 536 message_loop_.RunUntilIdle(); |
535 filter_ = new ForwardingFilter( | 537 filter_ = new ForwardingFilter( |
536 this, browser_context_->GetResourceContext()); | 538 this, browser_context_->GetResourceContext(), |
| 539 browser_context_->GetRequestContext()); |
537 } | 540 } |
538 | 541 |
539 virtual ~ResourceDispatcherHostTest() { | 542 virtual ~ResourceDispatcherHostTest() { |
540 for (std::set<int>::iterator it = child_ids_.begin(); | 543 for (std::set<int>::iterator it = child_ids_.begin(); |
541 it != child_ids_.end(); ++it) { | 544 it != child_ids_.end(); ++it) { |
542 host_.CancelRequestsForProcess(*it); | 545 host_.CancelRequestsForProcess(*it); |
543 } | 546 } |
544 } | 547 } |
545 | 548 |
546 // IPC::Sender implementation | 549 // IPC::Sender implementation |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1043 ASSERT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id)); | 1046 ASSERT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id)); |
1044 ASSERT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &error_code)); | 1047 ASSERT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &error_code)); |
1045 | 1048 |
1046 EXPECT_EQ(net::ERR_ACCESS_DENIED, error_code); | 1049 EXPECT_EQ(net::ERR_ACCESS_DENIED, error_code); |
1047 } | 1050 } |
1048 | 1051 |
1049 // The host delegate acts as a second one so we can have some requests | 1052 // The host delegate acts as a second one so we can have some requests |
1050 // pending and some canceled. | 1053 // pending and some canceled. |
1051 class TestFilter : public ForwardingFilter { | 1054 class TestFilter : public ForwardingFilter { |
1052 public: | 1055 public: |
1053 explicit TestFilter(ResourceContext* resource_context) | 1056 explicit TestFilter(ResourceContext* resource_context, |
1054 : ForwardingFilter(NULL, resource_context), | 1057 net::URLRequestContextGetter* url_request_context) |
| 1058 : ForwardingFilter(NULL, resource_context, url_request_context), |
1055 has_canceled_(false), | 1059 has_canceled_(false), |
1056 received_after_canceled_(0) { | 1060 received_after_canceled_(0) { |
1057 } | 1061 } |
1058 | 1062 |
1059 // ForwardingFilter override | 1063 // ForwardingFilter override |
1060 virtual bool Send(IPC::Message* msg) OVERRIDE { | 1064 virtual bool Send(IPC::Message* msg) OVERRIDE { |
1061 // no messages should be received when the process has been canceled | 1065 // no messages should be received when the process has been canceled |
1062 if (has_canceled_) | 1066 if (has_canceled_) |
1063 received_after_canceled_++; | 1067 received_after_canceled_++; |
1064 delete msg; | 1068 delete msg; |
1065 return true; | 1069 return true; |
1066 } | 1070 } |
1067 | 1071 |
1068 bool has_canceled_; | 1072 bool has_canceled_; |
1069 int received_after_canceled_; | 1073 int received_after_canceled_; |
1070 | 1074 |
1071 private: | 1075 private: |
1072 virtual ~TestFilter() {} | 1076 virtual ~TestFilter() {} |
1073 }; | 1077 }; |
1074 | 1078 |
1075 // Tests CancelRequestsForProcess | 1079 // Tests CancelRequestsForProcess |
1076 TEST_F(ResourceDispatcherHostTest, TestProcessCancel) { | 1080 TEST_F(ResourceDispatcherHostTest, TestProcessCancel) { |
1077 scoped_refptr<TestFilter> test_filter = new TestFilter( | 1081 scoped_refptr<TestFilter> test_filter = new TestFilter( |
1078 browser_context_->GetResourceContext()); | 1082 browser_context_->GetResourceContext(), |
| 1083 browser_context_->GetRequestContext()); |
1079 | 1084 |
1080 // request 1 goes to the test delegate | 1085 // request 1 goes to the test delegate |
1081 ResourceHostMsg_Request request = CreateResourceRequest( | 1086 ResourceHostMsg_Request request = CreateResourceRequest( |
1082 "GET", ResourceType::SUB_RESOURCE, net::URLRequestTestJob::test_url_1()); | 1087 "GET", ResourceType::SUB_RESOURCE, net::URLRequestTestJob::test_url_1()); |
1083 | 1088 |
1084 MakeTestRequest(test_filter.get(), 0, 1, | 1089 MakeTestRequest(test_filter.get(), 0, 1, |
1085 net::URLRequestTestJob::test_url_1()); | 1090 net::URLRequestTestJob::test_url_1()); |
1086 | 1091 |
1087 // request 2 goes to us | 1092 // request 2 goes to us |
1088 MakeTestRequest(0, 2, net::URLRequestTestJob::test_url_2()); | 1093 MakeTestRequest(0, 2, net::URLRequestTestJob::test_url_2()); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 | 1216 |
1212 msgs.clear(); | 1217 msgs.clear(); |
1213 accum_.GetClassifiedMessages(&msgs); | 1218 accum_.GetClassifiedMessages(&msgs); |
1214 ASSERT_EQ(0U, msgs.size()); | 1219 ASSERT_EQ(0U, msgs.size()); |
1215 } | 1220 } |
1216 | 1221 |
1217 // Tests that blocked requests are canceled if their associated process dies. | 1222 // Tests that blocked requests are canceled if their associated process dies. |
1218 TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies) { | 1223 TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies) { |
1219 // This second filter is used to emulate a second process. | 1224 // This second filter is used to emulate a second process. |
1220 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( | 1225 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
1221 this, browser_context_->GetResourceContext()); | 1226 this, browser_context_->GetResourceContext(), |
| 1227 browser_context_->GetRequestContext()); |
1222 | 1228 |
1223 host_.BlockRequestsForRoute(second_filter->child_id(), 0); | 1229 host_.BlockRequestsForRoute(second_filter->child_id(), 0); |
1224 | 1230 |
1225 MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1()); | 1231 MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1()); |
1226 MakeTestRequest(second_filter.get(), 0, 2, | 1232 MakeTestRequest(second_filter.get(), 0, 2, |
1227 net::URLRequestTestJob::test_url_2()); | 1233 net::URLRequestTestJob::test_url_2()); |
1228 MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3()); | 1234 MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3()); |
1229 MakeTestRequest(second_filter.get(), 0, 4, | 1235 MakeTestRequest(second_filter.get(), 0, 4, |
1230 net::URLRequestTestJob::test_url_1()); | 1236 net::URLRequestTestJob::test_url_1()); |
1231 | 1237 |
(...skipping 16 matching lines...) Expand all Loading... |
1248 EXPECT_TRUE(host_.blocked_loaders_map_.empty()); | 1254 EXPECT_TRUE(host_.blocked_loaders_map_.empty()); |
1249 } | 1255 } |
1250 | 1256 |
1251 // Tests that blocked requests don't leak when the ResourceDispatcherHost goes | 1257 // Tests that blocked requests don't leak when the ResourceDispatcherHost goes |
1252 // away. Note that we rely on Purify for finding the leaks if any. | 1258 // away. Note that we rely on Purify for finding the leaks if any. |
1253 // If this test turns the Purify bot red, check the ResourceDispatcherHost | 1259 // If this test turns the Purify bot red, check the ResourceDispatcherHost |
1254 // destructor to make sure the blocked requests are deleted. | 1260 // destructor to make sure the blocked requests are deleted. |
1255 TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsDontLeak) { | 1261 TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsDontLeak) { |
1256 // This second filter is used to emulate a second process. | 1262 // This second filter is used to emulate a second process. |
1257 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( | 1263 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
1258 this, browser_context_->GetResourceContext()); | 1264 this, browser_context_->GetResourceContext(), |
| 1265 browser_context_->GetRequestContext()); |
1259 | 1266 |
1260 host_.BlockRequestsForRoute(filter_->child_id(), 1); | 1267 host_.BlockRequestsForRoute(filter_->child_id(), 1); |
1261 host_.BlockRequestsForRoute(filter_->child_id(), 2); | 1268 host_.BlockRequestsForRoute(filter_->child_id(), 2); |
1262 host_.BlockRequestsForRoute(second_filter->child_id(), 1); | 1269 host_.BlockRequestsForRoute(second_filter->child_id(), 1); |
1263 | 1270 |
1264 MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1()); | 1271 MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1()); |
1265 MakeTestRequest(filter_.get(), 1, 2, net::URLRequestTestJob::test_url_2()); | 1272 MakeTestRequest(filter_.get(), 1, 2, net::URLRequestTestJob::test_url_2()); |
1266 MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3()); | 1273 MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3()); |
1267 MakeTestRequest(second_filter.get(), 1, 4, | 1274 MakeTestRequest(second_filter.get(), 1, 4, |
1268 net::URLRequestTestJob::test_url_1()); | 1275 net::URLRequestTestJob::test_url_1()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1315 // Tighten the bound on the ResourceDispatcherHost, to speed things up. | 1322 // Tighten the bound on the ResourceDispatcherHost, to speed things up. |
1316 int kMaxCostPerProcess = 440000; | 1323 int kMaxCostPerProcess = 440000; |
1317 host_.set_max_outstanding_requests_cost_per_process(kMaxCostPerProcess); | 1324 host_.set_max_outstanding_requests_cost_per_process(kMaxCostPerProcess); |
1318 | 1325 |
1319 // Determine how many instance of test_url_2() we can request before | 1326 // Determine how many instance of test_url_2() we can request before |
1320 // throttling kicks in. | 1327 // throttling kicks in. |
1321 size_t kMaxRequests = kMaxCostPerProcess / kMemoryCostOfTest2Req; | 1328 size_t kMaxRequests = kMaxCostPerProcess / kMemoryCostOfTest2Req; |
1322 | 1329 |
1323 // This second filter is used to emulate a second process. | 1330 // This second filter is used to emulate a second process. |
1324 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( | 1331 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
1325 this, browser_context_->GetResourceContext()); | 1332 this, browser_context_->GetResourceContext(), |
| 1333 browser_context_->GetRequestContext()); |
1326 | 1334 |
1327 // Saturate the number of outstanding requests for our process. | 1335 // Saturate the number of outstanding requests for our process. |
1328 for (size_t i = 0; i < kMaxRequests; ++i) { | 1336 for (size_t i = 0; i < kMaxRequests; ++i) { |
1329 MakeTestRequest(filter_.get(), 0, i + 1, | 1337 MakeTestRequest(filter_.get(), 0, i + 1, |
1330 net::URLRequestTestJob::test_url_2()); | 1338 net::URLRequestTestJob::test_url_2()); |
1331 } | 1339 } |
1332 | 1340 |
1333 // Issue two more requests for our process -- these should fail immediately. | 1341 // Issue two more requests for our process -- these should fail immediately. |
1334 MakeTestRequest(filter_.get(), 0, kMaxRequests + 1, | 1342 MakeTestRequest(filter_.get(), 0, kMaxRequests + 1, |
1335 net::URLRequestTestJob::test_url_2()); | 1343 net::URLRequestTestJob::test_url_2()); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 // that the global limit is honored. | 1387 // that the global limit is honored. |
1380 TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) { | 1388 TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) { |
1381 // Tighten the bound on the ResourceDispatcherHost, to speed things up. | 1389 // Tighten the bound on the ResourceDispatcherHost, to speed things up. |
1382 const size_t kMaxRequestsPerProcess = 2; | 1390 const size_t kMaxRequestsPerProcess = 2; |
1383 host_.set_max_num_in_flight_requests_per_process(kMaxRequestsPerProcess); | 1391 host_.set_max_num_in_flight_requests_per_process(kMaxRequestsPerProcess); |
1384 const size_t kMaxRequests = 3; | 1392 const size_t kMaxRequests = 3; |
1385 host_.set_max_num_in_flight_requests(kMaxRequests); | 1393 host_.set_max_num_in_flight_requests(kMaxRequests); |
1386 | 1394 |
1387 // Needed to emulate additional processes. | 1395 // Needed to emulate additional processes. |
1388 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( | 1396 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
1389 this, browser_context_->GetResourceContext()); | 1397 this, browser_context_->GetResourceContext(), |
| 1398 browser_context_->GetRequestContext()); |
1390 scoped_refptr<ForwardingFilter> third_filter = new ForwardingFilter( | 1399 scoped_refptr<ForwardingFilter> third_filter = new ForwardingFilter( |
1391 this, browser_context_->GetResourceContext()); | 1400 this, browser_context_->GetResourceContext(), |
| 1401 browser_context_->GetRequestContext()); |
1392 | 1402 |
1393 // Saturate the number of outstanding requests for our process. | 1403 // Saturate the number of outstanding requests for our process. |
1394 for (size_t i = 0; i < kMaxRequestsPerProcess; ++i) { | 1404 for (size_t i = 0; i < kMaxRequestsPerProcess; ++i) { |
1395 MakeTestRequest(filter_.get(), 0, i + 1, | 1405 MakeTestRequest(filter_.get(), 0, i + 1, |
1396 net::URLRequestTestJob::test_url_2()); | 1406 net::URLRequestTestJob::test_url_2()); |
1397 } | 1407 } |
1398 | 1408 |
1399 // Issue another request for our process -- this should fail immediately. | 1409 // Issue another request for our process -- this should fail immediately. |
1400 MakeTestRequest(filter_.get(), 0, kMaxRequestsPerProcess + 1, | 1410 MakeTestRequest(filter_.get(), 0, kMaxRequestsPerProcess + 1, |
1401 net::URLRequestTestJob::test_url_2()); | 1411 net::URLRequestTestJob::test_url_2()); |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 TransfersAllNavigationsContentBrowserClient new_client; | 1731 TransfersAllNavigationsContentBrowserClient new_client; |
1722 ContentBrowserClient* old_client = SetBrowserClientForTesting(&new_client); | 1732 ContentBrowserClient* old_client = SetBrowserClientForTesting(&new_client); |
1723 | 1733 |
1724 MakeTestRequest(render_view_id, request_id, GURL("http://example.com/blah")); | 1734 MakeTestRequest(render_view_id, request_id, GURL("http://example.com/blah")); |
1725 | 1735 |
1726 // Restore. | 1736 // Restore. |
1727 SetBrowserClientForTesting(old_client); | 1737 SetBrowserClientForTesting(old_client); |
1728 | 1738 |
1729 // This second filter is used to emulate a second process. | 1739 // This second filter is used to emulate a second process. |
1730 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( | 1740 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
1731 this, browser_context_->GetResourceContext()); | 1741 this, browser_context_->GetResourceContext(), |
| 1742 browser_context_->GetRequestContext()); |
1732 | 1743 |
1733 int new_render_view_id = 1; | 1744 int new_render_view_id = 1; |
1734 int new_request_id = 2; | 1745 int new_request_id = 2; |
1735 | 1746 |
1736 const std::string kResponseBody = "hello world"; | 1747 const std::string kResponseBody = "hello world"; |
1737 SetResponse("HTTP/1.1 200 OK\n" | 1748 SetResponse("HTTP/1.1 200 OK\n" |
1738 "Content-Type: text/plain\n\n", | 1749 "Content-Type: text/plain\n\n", |
1739 kResponseBody); | 1750 kResponseBody); |
1740 | 1751 |
1741 ResourceHostMsg_Request request = | 1752 ResourceHostMsg_Request request = |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1782 TransfersAllNavigationsContentBrowserClient new_client; | 1793 TransfersAllNavigationsContentBrowserClient new_client; |
1783 ContentBrowserClient* old_client = SetBrowserClientForTesting(&new_client); | 1794 ContentBrowserClient* old_client = SetBrowserClientForTesting(&new_client); |
1784 | 1795 |
1785 MakeTestRequest(render_view_id, request_id, GURL("http://example.com/blah")); | 1796 MakeTestRequest(render_view_id, request_id, GURL("http://example.com/blah")); |
1786 | 1797 |
1787 // Restore. | 1798 // Restore. |
1788 SetBrowserClientForTesting(old_client); | 1799 SetBrowserClientForTesting(old_client); |
1789 | 1800 |
1790 // This second filter is used to emulate a second process. | 1801 // This second filter is used to emulate a second process. |
1791 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( | 1802 scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter( |
1792 this, browser_context_->GetResourceContext()); | 1803 this, browser_context_->GetResourceContext(), |
| 1804 browser_context_->GetRequestContext()); |
1793 | 1805 |
1794 int new_render_view_id = 1; | 1806 int new_render_view_id = 1; |
1795 int new_request_id = 2; | 1807 int new_request_id = 2; |
1796 | 1808 |
1797 // Delay the start of the next request so that we can setup the response for | 1809 // Delay the start of the next request so that we can setup the response for |
1798 // the next URL. | 1810 // the next URL. |
1799 SetDelayedStartJobGeneration(true); | 1811 SetDelayedStartJobGeneration(true); |
1800 | 1812 |
1801 SetResponse("HTTP/1.1 302 Found\n" | 1813 SetResponse("HTTP/1.1 302 Found\n" |
1802 "Location: http://other.com/blerg\n\n"); | 1814 "Location: http://other.com/blerg\n\n"); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 } | 2010 } |
1999 | 2011 |
2000 base::MessageLoop::current()->RunUntilIdle(); | 2012 base::MessageLoop::current()->RunUntilIdle(); |
2001 | 2013 |
2002 msgs.clear(); | 2014 msgs.clear(); |
2003 accum_.GetClassifiedMessages(&msgs); | 2015 accum_.GetClassifiedMessages(&msgs); |
2004 } | 2016 } |
2005 } | 2017 } |
2006 | 2018 |
2007 } // namespace content | 2019 } // namespace content |
OLD | NEW |