| OLD | NEW |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 virtual void SetUp() { | 65 virtual void SetUp() { |
| 66 ChromeRenderViewHostTestHarness::SetUp(); | 66 ChromeRenderViewHostTestHarness::SetUp(); |
| 67 InfoBarService::CreateForWebContents(web_contents()); | 67 InfoBarService::CreateForWebContents(web_contents()); |
| 68 | 68 |
| 69 PermissionBubbleManager::CreateForWebContents(web_contents()); | 69 PermissionBubbleManager::CreateForWebContents(web_contents()); |
| 70 view_.reset(new FakePermissionBubbleView(this)); | 70 view_.reset(new FakePermissionBubbleView(this)); |
| 71 PermissionBubbleManager* manager = | 71 PermissionBubbleManager* manager = |
| 72 PermissionBubbleManager::FromWebContents(web_contents()); | 72 PermissionBubbleManager::FromWebContents(web_contents()); |
| 73 manager->SetView(view_.get()); | 73 manager->SetView(view_.get()); |
| 74 manager->SetCoalesceIntervalForTesting(0); |
| 74 | 75 |
| 75 testing_action_ = ACCEPT; | 76 testing_action_ = ACCEPT; |
| 76 ask_allow_count_ = cancel_count_ = continue_count_ = 0; | 77 ask_allow_count_ = cancel_count_ = continue_count_ = 0; |
| 77 download_request_limiter_ = new DownloadRequestLimiter(); | 78 download_request_limiter_ = new DownloadRequestLimiter(); |
| 78 fake_create_callback_ = base::Bind( | 79 fake_create_callback_ = base::Bind( |
| 79 &DownloadRequestLimiterTest::FakeCreate, base::Unretained(this)); | 80 &DownloadRequestLimiterTest::FakeCreate, base::Unretained(this)); |
| 80 DownloadRequestInfoBarDelegate::SetCallbackForTesting( | 81 DownloadRequestInfoBarDelegate::SetCallbackForTesting( |
| 81 &fake_create_callback_); | 82 &fake_create_callback_); |
| 82 content_settings_ = new HostContentSettingsMap(profile_.GetPrefs(), false); | 83 content_settings_ = new HostContentSettingsMap(profile_.GetPrefs(), false); |
| 83 DownloadRequestLimiter::SetContentSettingsForTesting( | 84 DownloadRequestLimiter::SetContentSettingsForTesting( |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 CanDownload(); | 455 CanDownload(); |
| 455 ExpectAndResetCounts(0, 1, 0, __LINE__); | 456 ExpectAndResetCounts(0, 1, 0, __LINE__); |
| 456 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 457 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 457 download_request_limiter_->GetDownloadStatus(web_contents())); | 458 download_request_limiter_->GetDownloadStatus(web_contents())); |
| 458 | 459 |
| 459 CanDownload(); | 460 CanDownload(); |
| 460 ExpectAndResetCounts(0, 1, 0, __LINE__); | 461 ExpectAndResetCounts(0, 1, 0, __LINE__); |
| 461 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 462 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 462 download_request_limiter_->GetDownloadStatus(web_contents())); | 463 download_request_limiter_->GetDownloadStatus(web_contents())); |
| 463 } | 464 } |
| OLD | NEW |