| 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_ = new HostContentSettingsMap( |
| 116 profile_->GetPrefs(), false /* incognito_profile */, |
| 117 false /* guest_profile */); |
| 116 DownloadRequestLimiter::SetContentSettingsForTesting( | 118 DownloadRequestLimiter::SetContentSettingsForTesting( |
| 117 content_settings_.get()); | 119 content_settings_.get()); |
| 118 } | 120 } |
| 119 | 121 |
| 120 int GetAction() { | 122 int GetAction() { |
| 121 return testing_action_; | 123 return testing_action_; |
| 122 } | 124 } |
| 123 | 125 |
| 124 void AskAllow() { | 126 void AskAllow() { |
| 125 ask_allow_count_++; | 127 ask_allow_count_++; |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 CanDownload(); | 503 CanDownload(); |
| 502 ExpectAndResetCounts(0, 1, 0, __LINE__); | 504 ExpectAndResetCounts(0, 1, 0, __LINE__); |
| 503 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 505 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 504 download_request_limiter_->GetDownloadStatus(web_contents())); | 506 download_request_limiter_->GetDownloadStatus(web_contents())); |
| 505 | 507 |
| 506 CanDownload(); | 508 CanDownload(); |
| 507 ExpectAndResetCounts(0, 1, 0, __LINE__); | 509 ExpectAndResetCounts(0, 1, 0, __LINE__); |
| 508 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 510 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 509 download_request_limiter_->GetDownloadStatus(web_contents())); | 511 download_request_limiter_->GetDownloadStatus(web_contents())); |
| 510 } | 512 } |
| OLD | NEW |