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

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

Issue 148133007: [Downloads] Always call DM::StartDownload() for explicit downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typos Created 4 years, 10 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 | Annotate | Revision Log
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 #include <utility> 6 #include <utility>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/feature_list.h" 10 #include "base/feature_list.h"
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 "GET", RESOURCE_TYPE_SUB_RESOURCE, GURL("http://example.com/priority")); 1162 "GET", RESOURCE_TYPE_SUB_RESOURCE, GURL("http://example.com/priority"));
1163 request.render_frame_id = render_frame_id; 1163 request.render_frame_id = render_frame_id;
1164 request.priority = priority; 1164 request.priority = priority;
1165 ResourceHostMsg_RequestResource msg(render_view_id, request_id, request); 1165 ResourceHostMsg_RequestResource msg(render_view_id, request_id, request);
1166 host_.OnMessageReceived(msg, filter_.get()); 1166 host_.OnMessageReceived(msg, filter_.get());
1167 } 1167 }
1168 1168
1169 void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest( 1169 void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest(
1170 int request_id, 1170 int request_id,
1171 const GURL& url) { 1171 const GURL& url) {
1172 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
1173 save_info->prompt_for_save_location = false;
1174 net::URLRequestContext* request_context = 1172 net::URLRequestContext* request_context =
1175 browser_context_->GetResourceContext()->GetRequestContext(); 1173 browser_context_->GetResourceContext()->GetRequestContext();
1176 scoped_ptr<net::URLRequest> request( 1174 scoped_ptr<net::URLRequest> request(
1177 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); 1175 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
1178 host_.BeginDownload(std::move(request), Referrer(), 1176 host_.BeginDownload(std::move(request), Referrer(),
1179 false, // is_content_initiated 1177 false, // is_content_initiated
1180 browser_context_->GetResourceContext(), 1178 browser_context_->GetResourceContext(),
1181 web_contents_->GetRenderProcessHost()->GetID(), 1179 web_contents_->GetRenderProcessHost()->GetID(),
1182 web_contents_->GetRoutingID(), 1180 web_contents_->GetRoutingID(),
1183 web_contents_->GetMainFrame()->GetRoutingID(), false, 1181 web_contents_->GetMainFrame()->GetRoutingID(), false);
1184 false, std::move(save_info), DownloadItem::kInvalidId,
1185 ResourceDispatcherHostImpl::DownloadStartedCallback());
1186 } 1182 }
1187 1183
1188 void ResourceDispatcherHostTest::CancelRequest(int request_id) { 1184 void ResourceDispatcherHostTest::CancelRequest(int request_id) {
1189 host_.CancelRequest(filter_->child_id(), request_id); 1185 host_.CancelRequest(filter_->child_id(), request_id);
1190 } 1186 }
1191 1187
1192 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) { 1188 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) {
1193 CompleteStartRequest(filter_.get(), request_id); 1189 CompleteStartRequest(filter_.get(), request_id);
1194 } 1190 }
1195 1191
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after
3670 return nullptr; 3666 return nullptr;
3671 } 3667 }
3672 3668
3673 INSTANTIATE_TEST_CASE_P( 3669 INSTANTIATE_TEST_CASE_P(
3674 ResourceDispatcherHostTests, 3670 ResourceDispatcherHostTests,
3675 ResourceDispatcherHostTest, 3671 ResourceDispatcherHostTest,
3676 testing::Values(TestConfig::kDefault, 3672 testing::Values(TestConfig::kDefault,
3677 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3673 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3678 3674
3679 } // namespace content 3675 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/public/browser/download_url_parameters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698