Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(471)

Side by Side Diff: chrome/browser/download/download_request_limiter_unittest.cc

Issue 665253002: Standardize usage of virtual/override/final in chrome/browser/download/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 12 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
13 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 13 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
14 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
15 #include "content/public/browser/navigation_controller.h" 15 #include "content/public/browser/navigation_controller.h"
16 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 18
19 using content::WebContents; 19 using content::WebContents;
20 20
21 class DownloadRequestLimiterTest; 21 class DownloadRequestLimiterTest;
22 22
23 class FakePermissionBubbleView : public PermissionBubbleView { 23 class FakePermissionBubbleView : public PermissionBubbleView {
24 public: 24 public:
25 explicit FakePermissionBubbleView(DownloadRequestLimiterTest *test) 25 explicit FakePermissionBubbleView(DownloadRequestLimiterTest *test)
26 : test_(test), delegate_(NULL) {} 26 : test_(test), delegate_(NULL) {}
27 27
28 virtual ~FakePermissionBubbleView() { 28 ~FakePermissionBubbleView() override {
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 void SetDelegate(Delegate* delegate) override { delegate_ = delegate; }
40 delegate_ = delegate;
41 }
42 40
43 virtual void Show( 41 void Show(const std::vector<PermissionBubbleRequest*>& requests,
44 const std::vector<PermissionBubbleRequest*>& requests, 42 const std::vector<bool>& accept_state,
45 const std::vector<bool>& accept_state, 43 bool customization_mode) override;
46 bool customization_mode) override;
47 44
48 virtual bool CanAcceptRequestUpdate() override { return false; } 45 bool CanAcceptRequestUpdate() override { return false; }
49 46
50 virtual void Hide() override {} 47 void Hide() override {}
51 virtual bool IsVisible() override { return false; } 48 bool IsVisible() override { return false; }
52 49
53 private: 50 private:
54 DownloadRequestLimiterTest* test_; 51 DownloadRequestLimiterTest* test_;
55 Delegate* delegate_; 52 Delegate* delegate_;
56 }; 53 };
57 54
58 class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness { 55 class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
59 public: 56 public:
60 enum TestingAction { 57 enum TestingAction {
61 ACCEPT, 58 ACCEPT,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 CanDownload(); 451 CanDownload();
455 ExpectAndResetCounts(0, 1, 0, __LINE__); 452 ExpectAndResetCounts(0, 1, 0, __LINE__);
456 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 453 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
457 download_request_limiter_->GetDownloadStatus(web_contents())); 454 download_request_limiter_->GetDownloadStatus(web_contents()));
458 455
459 CanDownload(); 456 CanDownload();
460 ExpectAndResetCounts(0, 1, 0, __LINE__); 457 ExpectAndResetCounts(0, 1, 0, __LINE__);
461 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD, 458 ASSERT_EQ(DownloadRequestLimiter::PROMPT_BEFORE_DOWNLOAD,
462 download_request_limiter_->GetDownloadStatus(web_contents())); 459 download_request_limiter_->GetDownloadStatus(web_contents()));
463 } 460 }
OLDNEW
« no previous file with comments | « chrome/browser/download/download_request_limiter.h ('k') | chrome/browser/download/download_resource_throttle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698