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

Side by Side Diff: chrome/browser/download/download_resource_throttle_unittest.cc

Issue 2527133002: Remove some WebContents::GetRenderViewHost() calls. (Closed)
Patch Set: Created 4 years 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "chrome/browser/download/download_request_limiter.h" 7 #include "chrome/browser/download/download_request_limiter.h"
8 #include "chrome/browser/download/download_resource_throttle.h" 8 #include "chrome/browser/download/download_resource_throttle.h"
9 #include "chrome/browser/tab_contents/tab_util.h" 9 #include "chrome/browser/tab_contents/tab_util.h"
10 #include "chrome/common/features.h" 10 #include "chrome/common/features.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 bool defer; 86 bool defer;
87 throttle_->WillStartRequest(&defer); 87 throttle_->WillStartRequest(&defer);
88 EXPECT_EQ(true, defer); 88 EXPECT_EQ(true, defer);
89 } 89 }
90 90
91 void StartThrottle() { 91 void StartThrottle() {
92 content::BrowserThread::PostTask( 92 content::BrowserThread::PostTask(
93 content::BrowserThread::IO, FROM_HERE, 93 content::BrowserThread::IO, FROM_HERE,
94 base::Bind(&DownloadResourceThrottleTest::StartThrottleOnIOThread, 94 base::Bind(&DownloadResourceThrottleTest::StartThrottleOnIOThread,
95 base::Unretained(this), 95 base::Unretained(this),
96 web_contents()->GetRenderViewHost()->GetProcess()->GetID(), 96 web_contents()->GetMainFrame()->GetProcess()->GetID(),
97 web_contents()->GetRoutingID())); 97 web_contents()->GetRoutingID()));
98 run_loop_->Run(); 98 run_loop_->Run();
99 } 99 }
100 100
101 protected: 101 protected:
102 content::ResourceThrottle* throttle_; 102 content::ResourceThrottle* throttle_;
103 MockWebContentsDelegate delegate_; 103 MockWebContentsDelegate delegate_;
104 scoped_refptr<DownloadRequestLimiter> limiter_; 104 scoped_refptr<DownloadRequestLimiter> limiter_;
105 ::testing::NiceMock<MockResourceController> resource_controller_; 105 ::testing::NiceMock<MockResourceController> resource_controller_;
106 std::unique_ptr<base::RunLoop> run_loop_; 106 std::unique_ptr<base::RunLoop> run_loop_;
(...skipping 10 matching lines...) Expand all
117 117
118 #if BUILDFLAG(ANDROID_JAVA_UI) 118 #if BUILDFLAG(ANDROID_JAVA_UI)
119 TEST_F(DownloadResourceThrottleTest, DownloadWithFailedFileAcecssRequest) { 119 TEST_F(DownloadResourceThrottleTest, DownloadWithFailedFileAcecssRequest) {
120 DownloadControllerBase::Get() 120 DownloadControllerBase::Get()
121 ->SetApproveFileAccessRequestForTesting(false); 121 ->SetApproveFileAccessRequestForTesting(false);
122 EXPECT_CALL(resource_controller_, Cancel()) 122 EXPECT_CALL(resource_controller_, Cancel())
123 .WillOnce(QuitLoop(run_loop_->QuitClosure())); 123 .WillOnce(QuitLoop(run_loop_->QuitClosure()));
124 StartThrottle(); 124 StartThrottle();
125 } 125 }
126 #endif 126 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698