Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_unittest.cc

Issue 2251643003: Remove the BeginSaveFile and BeginDownload methods from ResourceDispatcherHostImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address next round of review comments and keep the download test in resource_dispatcher_host_unitteā€¦ Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/feature_list.h" 12 #include "base/feature_list.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/files/file_util.h" 14 #include "base/files/file_util.h"
15 #include "base/location.h" 15 #include "base/location.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/scoped_vector.h" 17 #include "base/memory/scoped_vector.h"
18 #include "base/memory/shared_memory.h" 18 #include "base/memory/shared_memory.h"
19 #include "base/pickle.h" 19 #include "base/pickle.h"
20 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "base/single_thread_task_runner.h" 21 #include "base/single_thread_task_runner.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_split.h" 23 #include "base/strings/string_split.h"
24 #include "base/threading/thread_task_runner_handle.h" 24 #include "base/threading/thread_task_runner_handle.h"
25 #include "content/browser/browser_thread_impl.h" 25 #include "content/browser/browser_thread_impl.h"
26 #include "content/browser/cert_store_impl.h" 26 #include "content/browser/cert_store_impl.h"
27 #include "content/browser/child_process_security_policy_impl.h" 27 #include "content/browser/child_process_security_policy_impl.h"
28 #include "content/browser/download/download_manager_impl.h"
29 #include "content/browser/download/download_resource_handler.h"
28 #include "content/browser/frame_host/navigation_request_info.h" 30 #include "content/browser/frame_host/navigation_request_info.h"
29 #include "content/browser/loader/cross_site_resource_handler.h" 31 #include "content/browser/loader/cross_site_resource_handler.h"
30 #include "content/browser/loader/detachable_resource_handler.h" 32 #include "content/browser/loader/detachable_resource_handler.h"
31 #include "content/browser/loader/navigation_url_loader.h" 33 #include "content/browser/loader/navigation_url_loader.h"
32 #include "content/browser/loader/resource_dispatcher_host_impl.h" 34 #include "content/browser/loader/resource_dispatcher_host_impl.h"
33 #include "content/browser/loader/resource_loader.h" 35 #include "content/browser/loader/resource_loader.h"
34 #include "content/browser/loader/resource_message_filter.h" 36 #include "content/browser/loader/resource_message_filter.h"
35 #include "content/browser/loader/resource_request_info_impl.h" 37 #include "content/browser/loader/resource_request_info_impl.h"
36 #include "content/browser/loader_delegate_impl.h" 38 #include "content/browser/loader_delegate_impl.h"
37 #include "content/common/appcache_interfaces.h" 39 #include "content/common/appcache_interfaces.h"
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 } 849 }
848 850
849 class ResourceDispatcherHostTest : public testing::TestWithParam<TestConfig>, 851 class ResourceDispatcherHostTest : public testing::TestWithParam<TestConfig>,
850 public IPC::Sender { 852 public IPC::Sender {
851 public: 853 public:
852 typedef ResourceDispatcherHostImpl::LoadInfo LoadInfo; 854 typedef ResourceDispatcherHostImpl::LoadInfo LoadInfo;
853 typedef ResourceDispatcherHostImpl::LoadInfoMap LoadInfoMap; 855 typedef ResourceDispatcherHostImpl::LoadInfoMap LoadInfoMap;
854 856
855 ResourceDispatcherHostTest() 857 ResourceDispatcherHostTest()
856 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), 858 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
859 host_(base::Bind(base::Bind(&DownloadResourceHandler::Create))),
857 use_test_ssl_certificate_(false), 860 use_test_ssl_certificate_(false),
858 send_data_received_acks_(false), 861 send_data_received_acks_(false),
859 auto_advance_(false) { 862 auto_advance_(false) {
860 host_.SetLoaderDelegate(&loader_delegate_); 863 host_.SetLoaderDelegate(&loader_delegate_);
861 browser_context_.reset(new TestBrowserContext()); 864 browser_context_.reset(new TestBrowserContext());
862 BrowserContext::EnsureResourceContextInitialized(browser_context_.get()); 865 BrowserContext::EnsureResourceContextInitialized(browser_context_.get());
863 base::RunLoop().RunUntilIdle(); 866 base::RunLoop().RunUntilIdle();
864 filter_ = MakeForwardingFilter(); 867 filter_ = MakeForwardingFilter();
865 // TODO(cbentzel): Better way to get URLRequestContext? 868 // TODO(cbentzel): Better way to get URLRequestContext?
866 net::URLRequestContext* request_context = 869 net::URLRequestContext* request_context =
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 host_.OnMessageReceived(msg, filter_.get()); 1238 host_.OnMessageReceived(msg, filter_.get());
1236 } 1239 }
1237 1240
1238 void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest( 1241 void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest(
1239 int request_id, 1242 int request_id,
1240 const GURL& url) { 1243 const GURL& url) {
1241 net::URLRequestContext* request_context = 1244 net::URLRequestContext* request_context =
1242 browser_context_->GetResourceContext()->GetRequestContext(); 1245 browser_context_->GetResourceContext()->GetRequestContext();
1243 std::unique_ptr<net::URLRequest> request( 1246 std::unique_ptr<net::URLRequest> request(
1244 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); 1247 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
1245 host_.BeginDownload(std::move(request), Referrer(), 1248 DownloadManagerImpl::BeginDownloadRequest(
1246 false, // is_content_initiated 1249 std::move(request), Referrer(), browser_context_->GetResourceContext(),
1247 browser_context_->GetResourceContext(), 1250 false, // is_content_initiated
1248 web_contents_->GetRenderProcessHost()->GetID(), 1251 web_contents_->GetRenderProcessHost()->GetID(),
1249 web_contents_->GetRoutingID(), 1252 web_contents_->GetRoutingID(),
1250 web_contents_->GetMainFrame()->GetRoutingID(), false); 1253 web_contents_->GetMainFrame()->GetRoutingID(), false);
1251 } 1254 }
1252 1255
1253 void ResourceDispatcherHostTest::CancelRequest(int request_id) { 1256 void ResourceDispatcherHostTest::CancelRequest(int request_id) {
1254 host_.CancelRequest(filter_->child_id(), request_id); 1257 host_.CancelRequest(filter_->child_id(), request_id);
1255 } 1258 }
1256 1259
1257 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) { 1260 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) {
1258 CompleteStartRequest(filter_.get(), request_id); 1261 CompleteStartRequest(filter_.get(), request_id);
1259 } 1262 }
1260 1263
(...skipping 2562 matching lines...) Expand 10 before | Expand all | Expand 10 after
3823 return nullptr; 3826 return nullptr;
3824 } 3827 }
3825 3828
3826 INSTANTIATE_TEST_CASE_P( 3829 INSTANTIATE_TEST_CASE_P(
3827 ResourceDispatcherHostTests, 3830 ResourceDispatcherHostTests,
3828 ResourceDispatcherHostTest, 3831 ResourceDispatcherHostTest,
3829 testing::Values(TestConfig::kDefault, 3832 testing::Values(TestConfig::kDefault,
3830 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3833 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3831 3834
3832 } // namespace content 3835 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698