| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "chrome/browser/api/infobars/infobar_service.h" | 6 #include "chrome/browser/api/infobars/infobar_service.h" |
| 7 #include "chrome/browser/download/download_request_limiter.h" | 7 #include "chrome/browser/download/download_request_limiter.h" |
| 8 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 8 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
| 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 class DownloadRequestLimiterTestDelegate | 89 class DownloadRequestLimiterTestDelegate |
| 90 : public DownloadRequestLimiter::TestingDelegate { | 90 : public DownloadRequestLimiter::TestingDelegate { |
| 91 public: | 91 public: |
| 92 explicit DownloadRequestLimiterTestDelegate( | 92 explicit DownloadRequestLimiterTestDelegate( |
| 93 DownloadRequestLimiterTest* test) | 93 DownloadRequestLimiterTest* test) |
| 94 : test_(test) { } | 94 : test_(test) { } |
| 95 | 95 |
| 96 virtual bool ShouldAllowDownload() { | 96 virtual bool ShouldAllowDownload() OVERRIDE { |
| 97 return test_->ShouldAllowDownload(); | 97 return test_->ShouldAllowDownload(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 DownloadRequestLimiterTest* test_; | 101 DownloadRequestLimiterTest* test_; |
| 102 }; | 102 }; |
| 103 | 103 |
| 104 scoped_ptr<DownloadRequestLimiterTestDelegate> test_delegate_; | 104 scoped_ptr<DownloadRequestLimiterTestDelegate> test_delegate_; |
| 105 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; | 105 scoped_refptr<DownloadRequestLimiter> download_request_limiter_; |
| 106 | 106 |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 download_request_limiter_->GetDownloadStatus(web_contents.get())); | 267 download_request_limiter_->GetDownloadStatus(web_contents.get())); |
| 268 OnUserGestureFor(web_contents.get()); | 268 OnUserGestureFor(web_contents.get()); |
| 269 EXPECT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD, | 269 EXPECT_EQ(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD, |
| 270 download_request_limiter_->GetDownloadStatus(web_contents.get())); | 270 download_request_limiter_->GetDownloadStatus(web_contents.get())); |
| 271 CanDownloadFor(web_contents.get()); | 271 CanDownloadFor(web_contents.get()); |
| 272 EXPECT_EQ(3, continue_count_); | 272 EXPECT_EQ(3, continue_count_); |
| 273 EXPECT_EQ(1, cancel_count_); | 273 EXPECT_EQ(1, cancel_count_); |
| 274 EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 274 EXPECT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
| 275 download_request_limiter_->GetDownloadStatus(web_contents.get())); | 275 download_request_limiter_->GetDownloadStatus(web_contents.get())); |
| 276 } | 276 } |
| OLD | NEW |