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

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

Issue 286543002: Cleanup CanDownload WebContentsDelegate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Android build hopefully Created 6 years, 7 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
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 "chrome/browser/download/download_request_limiter.h" 5 #include "chrome/browser/download/download_request_limiter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "chrome/browser/content_settings/host_content_settings_map.h" 9 #include "chrome/browser/content_settings/host_content_settings_map.h"
10 #include "chrome/browser/download/download_request_infobar_delegate.h" 10 #include "chrome/browser/download/download_request_infobar_delegate.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 DownloadRequestInfoBarDelegate::SetCallbackForTesting(NULL); 119 DownloadRequestInfoBarDelegate::SetCallbackForTesting(NULL);
120 } 120 }
121 121
122 void CanDownload() { 122 void CanDownload() {
123 CanDownloadFor(web_contents()); 123 CanDownloadFor(web_contents());
124 } 124 }
125 125
126 void CanDownloadFor(WebContents* web_contents) { 126 void CanDownloadFor(WebContents* web_contents) {
127 download_request_limiter_->CanDownloadImpl( 127 download_request_limiter_->CanDownloadImpl(
128 web_contents, 128 web_contents,
129 -1, // request id
130 "GET", // request method 129 "GET", // request method
131 base::Bind(&DownloadRequestLimiterTest::ContinueDownload, 130 base::Bind(&DownloadRequestLimiterTest::ContinueDownload,
132 base::Unretained(this))); 131 base::Unretained(this)));
133 base::RunLoop().RunUntilIdle(); 132 base::RunLoop().RunUntilIdle();
134 } 133 }
135 134
136 void OnUserGesture() { 135 void OnUserGesture() {
137 OnUserGestureFor(web_contents()); 136 OnUserGestureFor(web_contents());
138 } 137 }
139 138
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 CanDownload(); 453 CanDownload();
455 ExpectAndResetCounts(0, 1, 0, __LINE__); 454 ExpectAndResetCounts(0, 1, 0, __LINE__);
456 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 455 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
457 download_request_limiter_->GetDownloadStatus(web_contents())); 456 download_request_limiter_->GetDownloadStatus(web_contents()));
458 457
459 CanDownload(); 458 CanDownload();
460 ExpectAndResetCounts(0, 1, 0, __LINE__); 459 ExpectAndResetCounts(0, 1, 0, __LINE__);
461 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 460 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
462 download_request_limiter_->GetDownloadStatus(web_contents())); 461 download_request_limiter_->GetDownloadStatus(web_contents()));
463 } 462 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_limiter.cc ('k') | chrome/browser/download/download_resource_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698