| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 119     DownloadRequestInfoBarDelegate::SetCallbackForTesting(NULL); | 119     DownloadRequestInfoBarDelegate::SetCallbackForTesting(NULL); | 
| 120   } | 120   } | 
| 121 | 121 | 
| 122   void CanDownload() { | 122   void CanDownload() { | 
| 123     CanDownloadFor(web_contents()); | 123     CanDownloadFor(web_contents()); | 
| 124   } | 124   } | 
| 125 | 125 | 
| 126   void CanDownloadFor(WebContents* web_contents) { | 126   void CanDownloadFor(WebContents* web_contents) { | 
| 127     download_request_limiter_->CanDownloadImpl( | 127     download_request_limiter_->CanDownloadImpl( | 
| 128         web_contents, | 128         web_contents, | 
| 129         -1,  // request id |  | 
| 130         "GET",  // request method | 129         "GET",  // request method | 
| 131         base::Bind(&DownloadRequestLimiterTest::ContinueDownload, | 130         base::Bind(&DownloadRequestLimiterTest::ContinueDownload, | 
| 132                    base::Unretained(this))); | 131                    base::Unretained(this))); | 
| 133     base::RunLoop().RunUntilIdle(); | 132     base::RunLoop().RunUntilIdle(); | 
| 134   } | 133   } | 
| 135 | 134 | 
| 136   void OnUserGesture() { | 135   void OnUserGesture() { | 
| 137     OnUserGestureFor(web_contents()); | 136     OnUserGestureFor(web_contents()); | 
| 138   } | 137   } | 
| 139 | 138 | 
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 454   CanDownload(); | 453   CanDownload(); | 
| 455   ExpectAndResetCounts(0, 1, 0, __LINE__); | 454   ExpectAndResetCounts(0, 1, 0, __LINE__); | 
| 456   ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 455   ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 
| 457             download_request_limiter_->GetDownloadStatus(web_contents())); | 456             download_request_limiter_->GetDownloadStatus(web_contents())); | 
| 458 | 457 | 
| 459   CanDownload(); | 458   CanDownload(); | 
| 460   ExpectAndResetCounts(0, 1, 0, __LINE__); | 459   ExpectAndResetCounts(0, 1, 0, __LINE__); | 
| 461   ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 460   ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 
| 462             download_request_limiter_->GetDownloadStatus(web_contents())); | 461             download_request_limiter_->GetDownloadStatus(web_contents())); | 
| 463 } | 462 } | 
| OLD | NEW | 
|---|