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

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: Comment updates 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/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 "GET", RESOURCE_TYPE_SUB_RESOURCE, GURL("http://example.com/priority")); 1138 "GET", RESOURCE_TYPE_SUB_RESOURCE, GURL("http://example.com/priority"));
1139 request.render_frame_id = render_frame_id; 1139 request.render_frame_id = render_frame_id;
1140 request.priority = priority; 1140 request.priority = priority;
1141 ResourceHostMsg_RequestResource msg(render_view_id, request_id, request); 1141 ResourceHostMsg_RequestResource msg(render_view_id, request_id, request);
1142 host_.OnMessageReceived(msg, filter_.get()); 1142 host_.OnMessageReceived(msg, filter_.get());
1143 } 1143 }
1144 1144
1145 void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest( 1145 void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest(
1146 int request_id, 1146 int request_id,
1147 const GURL& url) { 1147 const GURL& url) {
1148 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
1149 save_info->prompt_for_save_location = false;
1150 net::URLRequestContext* request_context = 1148 net::URLRequestContext* request_context =
1151 browser_context_->GetResourceContext()->GetRequestContext(); 1149 browser_context_->GetResourceContext()->GetRequestContext();
1152 scoped_ptr<net::URLRequest> request( 1150 scoped_ptr<net::URLRequest> request(
1153 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); 1151 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
1154 host_.BeginDownload(std::move(request), Referrer(), 1152 host_.BeginDownload(std::move(request), Referrer(),
1155 false, // is_content_initiated 1153 false, // is_content_initiated
1156 browser_context_->GetResourceContext(), 1154 browser_context_->GetResourceContext(),
1157 web_contents_->GetRenderProcessHost()->GetID(), 1155 web_contents_->GetRenderProcessHost()->GetID(),
1158 web_contents_->GetRoutingID(), 1156 web_contents_->GetRoutingID(),
1159 web_contents_->GetMainFrame()->GetRoutingID(), false, 1157 web_contents_->GetMainFrame()->GetRoutingID(), false);
1160 false, std::move(save_info), DownloadItem::kInvalidId,
1161 ResourceDispatcherHostImpl::DownloadStartedCallback());
1162 } 1158 }
1163 1159
1164 void ResourceDispatcherHostTest::CancelRequest(int request_id) { 1160 void ResourceDispatcherHostTest::CancelRequest(int request_id) {
1165 host_.CancelRequest(filter_->child_id(), request_id); 1161 host_.CancelRequest(filter_->child_id(), request_id);
1166 } 1162 }
1167 1163
1168 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) { 1164 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) {
1169 CompleteStartRequest(filter_.get(), request_id); 1165 CompleteStartRequest(filter_.get(), request_id);
1170 } 1166 }
1171 1167
(...skipping 2423 matching lines...) Expand 10 before | Expand all | Expand 10 after
3595 return nullptr; 3591 return nullptr;
3596 } 3592 }
3597 3593
3598 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( 3594 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse(
3599 net::URLRequest* request, 3595 net::URLRequest* request,
3600 net::NetworkDelegate* network_delegate) const { 3596 net::NetworkDelegate* network_delegate) const {
3601 return nullptr; 3597 return nullptr;
3602 } 3598 }
3603 3599
3604 } // namespace content 3600 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698