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

Side by Side Diff: chrome/browser/ui/autofill/autofill_popup_controller_unittest.cc

Issue 627043002: replace OVERRIDE and FINAL with override and final in chrome/browser/ui/[a-s]* (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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/memory/weak_ptr.h" 6 #include "base/memory/weak_ptr.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" 9 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
10 #include "chrome/browser/ui/autofill/autofill_popup_view.h" 10 #include "chrome/browser/ui/autofill/autofill_popup_view.h"
(...skipping 26 matching lines...) Expand all
37 namespace { 37 namespace {
38 38
39 class MockAutofillExternalDelegate : public AutofillExternalDelegate { 39 class MockAutofillExternalDelegate : public AutofillExternalDelegate {
40 public: 40 public:
41 MockAutofillExternalDelegate(AutofillManager* autofill_manager, 41 MockAutofillExternalDelegate(AutofillManager* autofill_manager,
42 AutofillDriver* autofill_driver) 42 AutofillDriver* autofill_driver)
43 : AutofillExternalDelegate(autofill_manager, autofill_driver) {} 43 : AutofillExternalDelegate(autofill_manager, autofill_driver) {}
44 virtual ~MockAutofillExternalDelegate() {} 44 virtual ~MockAutofillExternalDelegate() {}
45 45
46 virtual void DidSelectSuggestion(const base::string16& value, 46 virtual void DidSelectSuggestion(const base::string16& value,
47 int identifier) OVERRIDE {} 47 int identifier) override {}
48 virtual void RemoveSuggestion(const base::string16& value, 48 virtual void RemoveSuggestion(const base::string16& value,
49 int identifier) OVERRIDE {} 49 int identifier) override {}
50 virtual void ClearPreviewedForm() OVERRIDE {} 50 virtual void ClearPreviewedForm() override {}
51 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr() { 51 base::WeakPtr<AutofillExternalDelegate> GetWeakPtr() {
52 return AutofillExternalDelegate::GetWeakPtr(); 52 return AutofillExternalDelegate::GetWeakPtr();
53 } 53 }
54 }; 54 };
55 55
56 class MockAutofillClient : public autofill::TestAutofillClient { 56 class MockAutofillClient : public autofill::TestAutofillClient {
57 public: 57 public:
58 MockAutofillClient() : prefs_(autofill::test::PrefServiceForTesting()) {} 58 MockAutofillClient() : prefs_(autofill::test::PrefServiceForTesting()) {}
59 virtual ~MockAutofillClient() {} 59 virtual ~MockAutofillClient() {}
60 60
61 virtual PrefService* GetPrefs() OVERRIDE { return prefs_.get(); } 61 virtual PrefService* GetPrefs() override { return prefs_.get(); }
62 62
63 private: 63 private:
64 scoped_ptr<PrefService> prefs_; 64 scoped_ptr<PrefService> prefs_;
65 65
66 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient); 66 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient);
67 }; 67 };
68 68
69 class TestAutofillPopupController : public AutofillPopupControllerImpl { 69 class TestAutofillPopupController : public AutofillPopupControllerImpl {
70 public: 70 public:
71 explicit TestAutofillPopupController( 71 explicit TestAutofillPopupController(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 using AutofillPopupControllerImpl::GetWeakPtr; 106 using AutofillPopupControllerImpl::GetWeakPtr;
107 MOCK_METHOD1(InvalidateRow, void(size_t)); 107 MOCK_METHOD1(InvalidateRow, void(size_t));
108 MOCK_METHOD0(UpdateBoundsAndRedrawPopup, void()); 108 MOCK_METHOD0(UpdateBoundsAndRedrawPopup, void());
109 MOCK_METHOD0(Hide, void()); 109 MOCK_METHOD0(Hide, void());
110 110
111 void DoHide() { 111 void DoHide() {
112 AutofillPopupControllerImpl::Hide(); 112 AutofillPopupControllerImpl::Hide();
113 } 113 }
114 114
115 private: 115 private:
116 virtual void ShowView() OVERRIDE {} 116 virtual void ShowView() override {}
117 117
118 TestPopupControllerCommon* test_controller_common_; 118 TestPopupControllerCommon* test_controller_common_;
119 }; 119 };
120 120
121 } // namespace 121 } // namespace
122 122
123 class AutofillPopupControllerUnitTest : public ChromeRenderViewHostTestHarness { 123 class AutofillPopupControllerUnitTest : public ChromeRenderViewHostTestHarness {
124 public: 124 public:
125 AutofillPopupControllerUnitTest() 125 AutofillPopupControllerUnitTest()
126 : autofill_client_(new MockAutofillClient()), 126 : autofill_client_(new MockAutofillClient()),
127 autofill_popup_controller_(NULL) {} 127 autofill_popup_controller_(NULL) {}
128 virtual ~AutofillPopupControllerUnitTest() {} 128 virtual ~AutofillPopupControllerUnitTest() {}
129 129
130 virtual void SetUp() OVERRIDE { 130 virtual void SetUp() override {
131 ChromeRenderViewHostTestHarness::SetUp(); 131 ChromeRenderViewHostTestHarness::SetUp();
132 132
133 ContentAutofillDriver::CreateForWebContentsAndDelegate( 133 ContentAutofillDriver::CreateForWebContentsAndDelegate(
134 web_contents(), 134 web_contents(),
135 autofill_client_.get(), 135 autofill_client_.get(),
136 "en-US", 136 "en-US",
137 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER); 137 AutofillManager::ENABLE_AUTOFILL_DOWNLOAD_MANAGER);
138 ContentAutofillDriver* driver = 138 ContentAutofillDriver* driver =
139 ContentAutofillDriver::FromWebContents(web_contents()); 139 ContentAutofillDriver::FromWebContents(web_contents());
140 external_delegate_.reset( 140 external_delegate_.reset(
141 new NiceMock<MockAutofillExternalDelegate>( 141 new NiceMock<MockAutofillExternalDelegate>(
142 driver->autofill_manager(), 142 driver->autofill_manager(),
143 driver)); 143 driver));
144 144
145 autofill_popup_controller_ = 145 autofill_popup_controller_ =
146 new testing::NiceMock<TestAutofillPopupController>( 146 new testing::NiceMock<TestAutofillPopupController>(
147 external_delegate_->GetWeakPtr(),gfx::Rect()); 147 external_delegate_->GetWeakPtr(),gfx::Rect());
148 } 148 }
149 149
150 virtual void TearDown() OVERRIDE { 150 virtual void TearDown() override {
151 // This will make sure the controller and the view (if any) are both 151 // This will make sure the controller and the view (if any) are both
152 // cleaned up. 152 // cleaned up.
153 if (autofill_popup_controller_) 153 if (autofill_popup_controller_)
154 autofill_popup_controller_->DoHide(); 154 autofill_popup_controller_->DoHide();
155 155
156 external_delegate_.reset(); 156 external_delegate_.reset();
157 ChromeRenderViewHostTestHarness::TearDown(); 157 ChromeRenderViewHostTestHarness::TearDown();
158 } 158 }
159 159
160 TestAutofillPopupController* popup_controller() { 160 TestAutofillPopupController* popup_controller() {
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 EXPECT_NE(names[0], autofill_popup_controller_->names()[0]); 527 EXPECT_NE(names[0], autofill_popup_controller_->names()[0]);
528 EXPECT_NE(subtexts[0], autofill_popup_controller_->subtexts()[0]); 528 EXPECT_NE(subtexts[0], autofill_popup_controller_->subtexts()[0]);
529 529
530 // The second element was shorter so it should be unchanged. 530 // The second element was shorter so it should be unchanged.
531 EXPECT_EQ(names[1], autofill_popup_controller_->names()[1]); 531 EXPECT_EQ(names[1], autofill_popup_controller_->names()[1]);
532 EXPECT_EQ(subtexts[1], autofill_popup_controller_->subtexts()[1]); 532 EXPECT_EQ(subtexts[1], autofill_popup_controller_->subtexts()[1]);
533 } 533 }
534 #endif 534 #endif
535 535
536 } // namespace autofill 536 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698