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

Unified 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: Move the blob code to RDHI::BeginURLRequest Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_dispatcher_host_unittest.cc
diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc
index a1b1f7b1df531921974518a8956c6588f6e0651d..319c4ff058e19ea6c69dc550ce57fe14db619bf2 100644
--- a/content/browser/loader/resource_dispatcher_host_unittest.cc
+++ b/content/browser/loader/resource_dispatcher_host_unittest.cc
@@ -25,6 +25,7 @@
#include "content/browser/browser_thread_impl.h"
#include "content/browser/cert_store_impl.h"
#include "content/browser/child_process_security_policy_impl.h"
+#include "content/browser/download/download_resource_handler.h"
#include "content/browser/frame_host/navigation_request_info.h"
#include "content/browser/loader/cross_site_resource_handler.h"
#include "content/browser/loader/detachable_resource_handler.h"
@@ -854,6 +855,7 @@ class ResourceDispatcherHostTest : public testing::TestWithParam<TestConfig>,
ResourceDispatcherHostTest()
: thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP),
+ host_(base::Bind(base::Bind(&DownloadResourceHandler::Create))),
use_test_ssl_certificate_(false),
send_data_received_acks_(false),
auto_advance_(false) {
@@ -1007,9 +1009,6 @@ class ResourceDispatcherHostTest : public testing::TestWithParam<TestConfig>,
int request_id,
net::RequestPriority priority);
- void MakeWebContentsAssociatedDownloadRequest(int request_id,
- const GURL& url);
-
void CancelRequest(int request_id);
void RendererCancelRequest(int request_id) {
ResourceMessageFilter* old_filter = SetFilter(filter_.get());
@@ -1235,21 +1234,6 @@ void ResourceDispatcherHostTest::MakeTestRequestWithPriorityAndRenderFrame(
host_.OnMessageReceived(msg, filter_.get());
}
-void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest(
- int request_id,
- const GURL& url) {
- net::URLRequestContext* request_context =
- browser_context_->GetResourceContext()->GetRequestContext();
- std::unique_ptr<net::URLRequest> request(
- request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL));
- host_.BeginDownload(std::move(request), Referrer(),
- false, // is_content_initiated
- browser_context_->GetResourceContext(),
- web_contents_->GetRenderProcessHost()->GetID(),
- web_contents_->GetRoutingID(),
- web_contents_->GetMainFrame()->GetRoutingID(), false);
-}
-
void ResourceDispatcherHostTest::CancelRequest(int request_id) {
host_.CancelRequest(filter_->child_id(), request_id);
}
@@ -3711,30 +3695,6 @@ TEST_P(ResourceDispatcherHostTest, DidChangePriority) {
0); // route_id
}
-// Confirm that resource response started notifications for downloads are not
-// transmitted to the WebContents.
-TEST_P(ResourceDispatcherHostTest, TransferResponseStartedDownload) {
- int initial_count(web_contents_observer_->resource_response_start_count());
-
- MakeWebContentsAssociatedDownloadRequest(
- 1, net::URLRequestTestJob::test_url_1());
- base::RunLoop().RunUntilIdle();
- EXPECT_EQ(initial_count,
- web_contents_observer_->resource_response_start_count());
-}
-
-// Confirm that request redirected notifications for downloads are not
-// transmitted to the WebContents.
-TEST_P(ResourceDispatcherHostTest, TransferRequestRedirectedDownload) {
- int initial_count(web_contents_observer_->resource_request_redirect_count());
-
- MakeWebContentsAssociatedDownloadRequest(
- 1, net::URLRequestTestJob::test_url_redirect_to_url_2());
- base::RunLoop().RunUntilIdle();
- EXPECT_EQ(initial_count,
- web_contents_observer_->resource_request_redirect_count());
-}
-
// A URLRequestTestJob that sets a test certificate on the |ssl_info|
// field of the response.
class TestHTTPSURLRequestJob : public net::URLRequestTestJob {

Powered by Google App Engine
This is Rietveld 408576698