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 18 matching lines...) Expand all Loading... |
29 if (delegate_) | 29 if (delegate_) |
30 delegate_->SetView(NULL); | 30 delegate_->SetView(NULL); |
31 } | 31 } |
32 | 32 |
33 void Close() { | 33 void Close() { |
34 if (delegate_) | 34 if (delegate_) |
35 delegate_->Closing(); | 35 delegate_->Closing(); |
36 } | 36 } |
37 | 37 |
38 // PermissionBubbleView: | 38 // PermissionBubbleView: |
39 virtual void SetDelegate(Delegate* delegate) OVERRIDE { | 39 virtual void SetDelegate(Delegate* delegate) override { |
40 delegate_ = delegate; | 40 delegate_ = delegate; |
41 } | 41 } |
42 | 42 |
43 virtual void Show( | 43 virtual void Show( |
44 const std::vector<PermissionBubbleRequest*>& requests, | 44 const std::vector<PermissionBubbleRequest*>& requests, |
45 const std::vector<bool>& accept_state, | 45 const std::vector<bool>& accept_state, |
46 bool customization_mode) OVERRIDE; | 46 bool customization_mode) override; |
47 | 47 |
48 virtual bool CanAcceptRequestUpdate() OVERRIDE { return false; } | 48 virtual bool CanAcceptRequestUpdate() override { return false; } |
49 | 49 |
50 virtual void Hide() OVERRIDE {} | 50 virtual void Hide() override {} |
51 virtual bool IsVisible() OVERRIDE { return false; } | 51 virtual bool IsVisible() override { return false; } |
52 | 52 |
53 private: | 53 private: |
54 DownloadRequestLimiterTest* test_; | 54 DownloadRequestLimiterTest* test_; |
55 Delegate* delegate_; | 55 Delegate* delegate_; |
56 }; | 56 }; |
57 | 57 |
58 class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness { | 58 class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness { |
59 public: | 59 public: |
60 enum TestingAction { | 60 enum TestingAction { |
61 ACCEPT, | 61 ACCEPT, |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 CanDownload(); | 454 CanDownload(); |
455 ExpectAndResetCounts(0, 1, 0, __LINE__); | 455 ExpectAndResetCounts(0, 1, 0, __LINE__); |
456 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 456 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
457 download_request_limiter_->GetDownloadStatus(web_contents())); | 457 download_request_limiter_->GetDownloadStatus(web_contents())); |
458 | 458 |
459 CanDownload(); | 459 CanDownload(); |
460 ExpectAndResetCounts(0, 1, 0, __LINE__); | 460 ExpectAndResetCounts(0, 1, 0, __LINE__); |
461 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, | 461 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, |
462 download_request_limiter_->GetDownloadStatus(web_contents())); | 462 download_request_limiter_->GetDownloadStatus(web_contents())); |
463 } | 463 } |
OLD | NEW |