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

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: 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 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1100 ResourceHostMsg_Request request = CreateResourceRequest( 1100 ResourceHostMsg_Request request = CreateResourceRequest(
1101 "GET", RESOURCE_TYPE_SUB_RESOURCE, GURL("http://example.com/priority")); 1101 "GET", RESOURCE_TYPE_SUB_RESOURCE, GURL("http://example.com/priority"));
1102 request.priority = priority; 1102 request.priority = priority;
1103 ResourceHostMsg_RequestResource msg(render_view_id, request_id, request); 1103 ResourceHostMsg_RequestResource msg(render_view_id, request_id, request);
1104 host_.OnMessageReceived(msg, filter_.get()); 1104 host_.OnMessageReceived(msg, filter_.get());
1105 } 1105 }
1106 1106
1107 void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest( 1107 void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest(
1108 int request_id, 1108 int request_id,
1109 const GURL& url) { 1109 const GURL& url) {
1110 scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo());
1111 save_info->prompt_for_save_location = false;
1112 net::URLRequestContext* request_context = 1110 net::URLRequestContext* request_context =
1113 browser_context_->GetResourceContext()->GetRequestContext(); 1111 browser_context_->GetResourceContext()->GetRequestContext();
1114 scoped_ptr<net::URLRequest> request( 1112 scoped_ptr<net::URLRequest> request(
1115 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); 1113 request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
1116 host_.BeginDownload(std::move(request), Referrer(), 1114 host_.BeginDownload(std::move(request), Referrer(),
1117 false, // is_content_initiated 1115 false, // is_content_initiated
1118 browser_context_->GetResourceContext(), 1116 browser_context_->GetResourceContext(),
1119 web_contents_->GetRenderProcessHost()->GetID(), 1117 web_contents_->GetRenderProcessHost()->GetID(),
1120 web_contents_->GetRoutingID(), 1118 web_contents_->GetRoutingID(),
1121 web_contents_->GetMainFrame()->GetRoutingID(), false, 1119 web_contents_->GetMainFrame()->GetRoutingID(), false);
1122 false, std::move(save_info), DownloadItem::kInvalidId,
1123 ResourceDispatcherHostImpl::DownloadStartedCallback());
1124 } 1120 }
1125 1121
1126 void ResourceDispatcherHostTest::CancelRequest(int request_id) { 1122 void ResourceDispatcherHostTest::CancelRequest(int request_id) {
1127 host_.CancelRequest(filter_->child_id(), request_id); 1123 host_.CancelRequest(filter_->child_id(), request_id);
1128 } 1124 }
1129 1125
1130 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) { 1126 void ResourceDispatcherHostTest::CompleteStartRequest(int request_id) {
1131 CompleteStartRequest(filter_.get(), request_id); 1127 CompleteStartRequest(filter_.get(), request_id);
1132 } 1128 }
1133 1129
(...skipping 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after
3537 return nullptr; 3533 return nullptr;
3538 } 3534 }
3539 3535
3540 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse( 3536 net::URLRequestJob* TestURLRequestJobFactory::MaybeInterceptResponse(
3541 net::URLRequest* request, 3537 net::URLRequest* request,
3542 net::NetworkDelegate* network_delegate) const { 3538 net::NetworkDelegate* network_delegate) const {
3543 return nullptr; 3539 return nullptr;
3544 } 3540 }
3545 3541
3546 } // namespace content 3542 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698