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

Unified Diff: chrome/browser/download/download_request_limiter_unittest.cc

Issue 411503005: Change tests to prepare for turning on the permission bubble flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 2 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: chrome/browser/download/download_request_limiter_unittest.cc
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc
index 273bc42ce8de13fe3bfbbe9cb940a720b9aab9a6..76f6fdced623a428a674cd5a45ec82dda44b0c60 100644
--- a/chrome/browser/download/download_request_limiter_unittest.cc
+++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -181,6 +181,11 @@ class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
setting);
}
+ void BubbleManagerDocumentLoadCompleted() {
+ PermissionBubbleManager::FromWebContents(web_contents())->
+ DocumentOnLoadCompletedInMainFrame();
+ }
+
scoped_refptr<DownloadRequestLimiter> download_request_limiter_;
// The action that FakeCreate() should take.
@@ -222,6 +227,8 @@ void FakePermissionBubbleView::Show(
TEST_F(DownloadRequestLimiterTest,
DownloadRequestLimiter_Allow) {
+ BubbleManagerDocumentLoadCompleted();
+
// All tabs should initially start at ALLOW_ONE_DOWNLOAD.
ASSERT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD,
download_request_limiter_->GetDownloadStatus(web_contents()));
@@ -254,6 +261,7 @@ TEST_F(DownloadRequestLimiterTest,
TEST_F(DownloadRequestLimiterTest,
DownloadRequestLimiter_ResetOnNavigation) {
NavigateAndCommit(GURL("http://foo.com/bar"));
+ BubbleManagerDocumentLoadCompleted();
// Do two downloads, allowing the second so that we end up with allow all.
CanDownload();
@@ -270,6 +278,7 @@ TEST_F(DownloadRequestLimiterTest,
// Navigate to a new URL with the same host, which shouldn't reset the allow
// all state.
NavigateAndCommit(GURL("http://foo.com/bar2"));
+ BubbleManagerDocumentLoadCompleted();
CanDownload();
ExpectAndResetCounts(1, 0, 0, __LINE__);
ASSERT_EQ(DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS,
@@ -283,6 +292,7 @@ TEST_F(DownloadRequestLimiterTest,
// Navigate to a completely different host, which should reset the state.
NavigateAndCommit(GURL("http://fooey.com"));
+ BubbleManagerDocumentLoadCompleted();
ASSERT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD,
download_request_limiter_->GetDownloadStatus(web_contents()));
@@ -301,6 +311,7 @@ TEST_F(DownloadRequestLimiterTest,
// Navigate to a new URL with the same host, which shouldn't reset the allow
// all state.
NavigateAndCommit(GURL("http://fooey.com/bar2"));
+ BubbleManagerDocumentLoadCompleted();
CanDownload();
ExpectAndResetCounts(0, 1, 0, __LINE__);
ASSERT_EQ(DownloadRequestLimiter::DOWNLOADS_NOT_ALLOWED,
@@ -310,6 +321,7 @@ TEST_F(DownloadRequestLimiterTest,
TEST_F(DownloadRequestLimiterTest,
DownloadRequestLimiter_ResetOnUserGesture) {
NavigateAndCommit(GURL("http://foo.com/bar"));
+ BubbleManagerDocumentLoadCompleted();
// Do one download, which should change to prompt before download.
CanDownload();
@@ -350,6 +362,7 @@ TEST_F(DownloadRequestLimiterTest,
TEST_F(DownloadRequestLimiterTest,
DownloadRequestLimiter_ResetOnReload) {
NavigateAndCommit(GURL("http://foo.com/bar"));
+ BubbleManagerDocumentLoadCompleted();
ASSERT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD,
download_request_limiter_->GetDownloadStatus(web_contents()));
@@ -437,6 +450,7 @@ TEST_F(DownloadRequestLimiterTest,
TEST_F(DownloadRequestLimiterTest,
DownloadRequestLimiter_SetHostContentSetting) {
NavigateAndCommit(GURL("http://foo.com/bar"));
+ BubbleManagerDocumentLoadCompleted();
SetHostContentSetting(web_contents(), CONTENT_SETTING_ALLOW);
CanDownload();

Powered by Google App Engine
This is Rietveld 408576698