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); | |
75 | 74 |
76 testing_action_ = ACCEPT; | 75 testing_action_ = ACCEPT; |
77 ask_allow_count_ = cancel_count_ = continue_count_ = 0; | 76 ask_allow_count_ = cancel_count_ = continue_count_ = 0; |
78 download_request_limiter_ = new DownloadRequestLimiter(); | 77 download_request_limiter_ = new DownloadRequestLimiter(); |
79 fake_create_callback_ = base::Bind( | 78 fake_create_callback_ = base::Bind( |
80 &DownloadRequestLimiterTest::FakeCreate, base::Unretained(this)); | 79 &DownloadRequestLimiterTest::FakeCreate, base::Unretained(this)); |
81 DownloadRequestInfoBarDelegate::SetCallbackForTesting( | 80 DownloadRequestInfoBarDelegate::SetCallbackForTesting( |
82 &fake_create_callback_); | 81 &fake_create_callback_); |
83 content_settings_ = new HostContentSettingsMap(profile_.GetPrefs(), false); | 82 content_settings_ = new HostContentSettingsMap(profile_.GetPrefs(), false); |
84 DownloadRequestLimiter::SetContentSettingsForTesting( | 83 DownloadRequestLimiter::SetContentSettingsForTesting( |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 CanDownload(); | 454 CanDownload(); |
456 ExpectAndResetCounts(0, 1, 0, __LINE__); | 455 ExpectAndResetCounts(0, 1, 0, __LINE__); |
457 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 456 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
458 download_request_limiter_->GetDownloadStatus(web_contents())); | 457 download_request_limiter_->GetDownloadStatus(web_contents())); |
459 | 458 |
460 CanDownload(); | 459 CanDownload(); |
461 ExpectAndResetCounts(0, 1, 0, __LINE__); | 460 ExpectAndResetCounts(0, 1, 0, __LINE__); |
462 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 461 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
463 download_request_limiter_->GetDownloadStatus(web_contents())); | 462 download_request_limiter_->GetDownloadStatus(web_contents())); |
464 } | 463 } |
OLD | NEW |