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