| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 } | 841 } |
| 842 | 842 |
| 843 class ResourceDispatcherHostTest : public testing::Test, public IPC::Sender { | 843 class ResourceDispatcherHostTest : public testing::Test, public IPC::Sender { |
| 844 public: | 844 public: |
| 845 typedef ResourceDispatcherHostImpl::LoadInfo LoadInfo; | 845 typedef ResourceDispatcherHostImpl::LoadInfo LoadInfo; |
| 846 typedef ResourceDispatcherHostImpl::LoadInfoList LoadInfoList; | 846 typedef ResourceDispatcherHostImpl::LoadInfoList LoadInfoList; |
| 847 typedef ResourceDispatcherHostImpl::LoadInfoMap LoadInfoMap; | 847 typedef ResourceDispatcherHostImpl::LoadInfoMap LoadInfoMap; |
| 848 | 848 |
| 849 ResourceDispatcherHostTest() | 849 ResourceDispatcherHostTest() |
| 850 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 850 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
| 851 host_(base::Bind(&DownloadResourceHandler::Create)), | 851 host_(base::Bind(&DownloadResourceHandler::Create), |
| 852 base::ThreadTaskRunnerHandle::Get(), |
| 853 base::ThreadTaskRunnerHandle::Get()), |
| 852 use_test_ssl_certificate_(false), | 854 use_test_ssl_certificate_(false), |
| 853 send_data_received_acks_(false), | 855 send_data_received_acks_(false), |
| 854 auto_advance_(false) { | 856 auto_advance_(false) { |
| 855 host_.SetLoaderDelegate(&loader_delegate_); | 857 host_.SetLoaderDelegate(&loader_delegate_); |
| 856 browser_context_.reset(new TestBrowserContext()); | 858 browser_context_.reset(new TestBrowserContext()); |
| 857 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); | 859 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); |
| 858 base::RunLoop().RunUntilIdle(); | 860 base::RunLoop().RunUntilIdle(); |
| 859 filter_ = MakeForwardingFilter(); | 861 filter_ = MakeForwardingFilter(); |
| 860 // TODO(cbentzel): Better way to get URLRequestContext? | 862 // TODO(cbentzel): Better way to get URLRequestContext? |
| 861 net::URLRequestContext* request_context = | 863 net::URLRequestContext* request_context = |
| 862 browser_context_->GetResourceContext()->GetRequestContext(); | 864 browser_context_->GetResourceContext()->GetRequestContext(); |
| 863 job_factory_.reset(new TestURLRequestJobFactory(this)); | 865 job_factory_.reset(new TestURLRequestJobFactory(this)); |
| 864 request_context->set_job_factory(job_factory_.get()); | 866 request_context->set_job_factory(job_factory_.get()); |
| 865 request_context->set_network_delegate(&network_delegate_); | 867 request_context->set_network_delegate(&network_delegate_); |
| 866 } | 868 } |
| 867 | 869 |
| 868 ~ResourceDispatcherHostTest() override { | 870 ~ResourceDispatcherHostTest() override { |
| 869 filter_->OnChannelClosing(); | 871 filter_->OnChannelClosing(); |
| 872 filter_ = nullptr; |
| 873 web_contents_filter_ = nullptr; |
| 870 } | 874 } |
| 871 | 875 |
| 872 // IPC::Sender implementation | 876 // IPC::Sender implementation |
| 873 bool Send(IPC::Message* msg) override { | 877 bool Send(IPC::Message* msg) override { |
| 874 accum_.AddMessage(*msg); | 878 accum_.AddMessage(*msg); |
| 875 | 879 |
| 876 if (send_data_received_acks_ && | 880 if (send_data_received_acks_ && |
| 877 msg->type() == ResourceMsg_DataReceived::ID) { | 881 msg->type() == ResourceMsg_DataReceived::ID) { |
| 878 GenerateDataReceivedACK(*msg); | 882 GenerateDataReceivedACK(*msg); |
| 879 } | 883 } |
| (...skipping 3044 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3924 return nullptr; | 3928 return nullptr; |
| 3925 } | 3929 } |
| 3926 | 3930 |
| 3927 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( | 3931 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( |
| 3928 net::URLRequest* request, | 3932 net::URLRequest* request, |
| 3929 net::NetworkDelegate* network_delegate) const { | 3933 net::NetworkDelegate* network_delegate) const { |
| 3930 return nullptr; | 3934 return nullptr; |
| 3931 } | 3935 } |
| 3932 | 3936 |
| 3933 } // namespace content | 3937 } // namespace content |
| OLD | NEW |