| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 download_request_limiter_ = new DownloadRequestLimiter(); | 105 download_request_limiter_ = new DownloadRequestLimiter(); |
| 106 | 106 |
| 107 #if defined(OS_ANDROID) | 107 #if defined(OS_ANDROID) |
| 108 InfoBarService::CreateForWebContents(web_contents()); | 108 InfoBarService::CreateForWebContents(web_contents()); |
| 109 fake_create_callback_ = base::Bind( | 109 fake_create_callback_ = base::Bind( |
| 110 &DownloadRequestLimiterTest::FakeCreate, base::Unretained(this)); | 110 &DownloadRequestLimiterTest::FakeCreate, base::Unretained(this)); |
| 111 DownloadRequestInfoBarDelegateAndroid::SetCallbackForTesting( | 111 DownloadRequestInfoBarDelegateAndroid::SetCallbackForTesting( |
| 112 &fake_create_callback_); | 112 &fake_create_callback_); |
| 113 #endif | 113 #endif |
| 114 | 114 |
| 115 content_settings_ = new HostContentSettingsMap(profile_->GetPrefs(), false); | 115 content_settings_ = |
| 116 new HostContentSettingsMap(profile_->GetPrefs(), false, false); |
| 116 DownloadRequestLimiter::SetContentSettingsForTesting( | 117 DownloadRequestLimiter::SetContentSettingsForTesting( |
| 117 content_settings_.get()); | 118 content_settings_.get()); |
| 118 } | 119 } |
| 119 | 120 |
| 120 int GetAction() { | 121 int GetAction() { |
| 121 return testing_action_; | 122 return testing_action_; |
| 122 } | 123 } |
| 123 | 124 |
| 124 void AskAllow() { | 125 void AskAllow() { |
| 125 ask_allow_count_++; | 126 ask_allow_count_++; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 CanDownload(); | 502 CanDownload(); |
| 502 ExpectAndResetCounts(0, 1, 0, __LINE__); | 503 ExpectAndResetCounts(0, 1, 0, __LINE__); |
| 503 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 504 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 504 download_request_limiter_->GetDownloadStatus(web_contents())); | 505 download_request_limiter_->GetDownloadStatus(web_contents())); |
| 505 | 506 |
| 506 CanDownload(); | 507 CanDownload(); |
| 507 ExpectAndResetCounts(0, 1, 0, __LINE__); | 508 ExpectAndResetCounts(0, 1, 0, __LINE__); |
| 508 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 509 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 509 download_request_limiter_->GetDownloadStatus(web_contents())); | 510 download_request_limiter_->GetDownloadStatus(web_contents())); |
| 510 } | 511 } |
| OLD | NEW |