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

Side by Side Diff: chrome/browser/ui/toolbar/wrench_menu_model_unittest.cc

Issue 628773002: replace OVERRIDE and FINAL with override and final in chrome/browser/ui/[t-v]* (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/ui/toolbar/wrench_menu_model.h" 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h"
6 6
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/prefs/browser_prefs.h" 8 #include "chrome/browser/prefs/browser_prefs.h"
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 14 matching lines...) Expand all
25 // Error class has a menu item. 25 // Error class has a menu item.
26 class MenuError : public GlobalError { 26 class MenuError : public GlobalError {
27 public: 27 public:
28 explicit MenuError(int command_id) 28 explicit MenuError(int command_id)
29 : command_id_(command_id), 29 : command_id_(command_id),
30 execute_count_(0) { 30 execute_count_(0) {
31 } 31 }
32 32
33 int execute_count() { return execute_count_; } 33 int execute_count() { return execute_count_; }
34 34
35 virtual bool HasMenuItem() OVERRIDE { return true; } 35 virtual bool HasMenuItem() override { return true; }
36 virtual int MenuItemCommandID() OVERRIDE { return command_id_; } 36 virtual int MenuItemCommandID() override { return command_id_; }
37 virtual base::string16 MenuItemLabel() OVERRIDE { return base::string16(); } 37 virtual base::string16 MenuItemLabel() override { return base::string16(); }
38 virtual void ExecuteMenuItem(Browser* browser) OVERRIDE { execute_count_++; } 38 virtual void ExecuteMenuItem(Browser* browser) override { execute_count_++; }
39 39
40 virtual bool HasBubbleView() OVERRIDE { return false; } 40 virtual bool HasBubbleView() override { return false; }
41 virtual bool HasShownBubbleView() OVERRIDE { return false; } 41 virtual bool HasShownBubbleView() override { return false; }
42 virtual void ShowBubbleView(Browser* browser) OVERRIDE { ADD_FAILURE(); } 42 virtual void ShowBubbleView(Browser* browser) override { ADD_FAILURE(); }
43 virtual GlobalErrorBubbleViewBase* GetBubbleView() OVERRIDE { return NULL; } 43 virtual GlobalErrorBubbleViewBase* GetBubbleView() override { return NULL; }
44 44
45 private: 45 private:
46 int command_id_; 46 int command_id_;
47 int execute_count_; 47 int execute_count_;
48 48
49 DISALLOW_COPY_AND_ASSIGN(MenuError); 49 DISALLOW_COPY_AND_ASSIGN(MenuError);
50 }; 50 };
51 51
52 } // namespace 52 } // namespace
53 53
54 class WrenchMenuModelTest : public BrowserWithTestWindowTest, 54 class WrenchMenuModelTest : public BrowserWithTestWindowTest,
55 public ui::AcceleratorProvider { 55 public ui::AcceleratorProvider {
56 public: 56 public:
57 // Don't handle accelerators. 57 // Don't handle accelerators.
58 virtual bool GetAcceleratorForCommandId( 58 virtual bool GetAcceleratorForCommandId(
59 int command_id, 59 int command_id,
60 ui::Accelerator* accelerator) OVERRIDE { return false; } 60 ui::Accelerator* accelerator) override { return false; }
61 61
62 protected: 62 protected:
63 virtual void SetUp() OVERRIDE { 63 virtual void SetUp() override {
64 prefs_.reset(new TestingPrefServiceSimple()); 64 prefs_.reset(new TestingPrefServiceSimple());
65 chrome::RegisterLocalState(prefs_->registry()); 65 chrome::RegisterLocalState(prefs_->registry());
66 66
67 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get()); 67 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get());
68 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); 68 testing_io_thread_state_.reset(new chrome::TestingIOThreadState());
69 BrowserWithTestWindowTest::SetUp(); 69 BrowserWithTestWindowTest::SetUp();
70 } 70 }
71 71
72 virtual void TearDown() OVERRIDE { 72 virtual void TearDown() override {
73 BrowserWithTestWindowTest::TearDown(); 73 BrowserWithTestWindowTest::TearDown();
74 testing_io_thread_state_.reset(); 74 testing_io_thread_state_.reset();
75 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); 75 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL);
76 DestroyBrowserAndProfile(); 76 DestroyBrowserAndProfile();
77 } 77 }
78 78
79 private: 79 private:
80 scoped_ptr<TestingPrefServiceSimple> prefs_; 80 scoped_ptr<TestingPrefServiceSimple> prefs_;
81 scoped_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; 81 scoped_ptr<chrome::TestingIOThreadState> testing_io_thread_state_;
82 }; 82 };
83 83
84 // Copies parts of MenuModelTest::Delegate and combines them with the 84 // Copies parts of MenuModelTest::Delegate and combines them with the
85 // WrenchMenuModel since WrenchMenuModel is now a SimpleMenuModel::Delegate and 85 // WrenchMenuModel since WrenchMenuModel is now a SimpleMenuModel::Delegate and
86 // not derived from SimpleMenuModel. 86 // not derived from SimpleMenuModel.
87 class TestWrenchMenuModel : public WrenchMenuModel { 87 class TestWrenchMenuModel : public WrenchMenuModel {
88 public: 88 public:
89 TestWrenchMenuModel(ui::AcceleratorProvider* provider, 89 TestWrenchMenuModel(ui::AcceleratorProvider* provider,
90 Browser* browser) 90 Browser* browser)
91 : WrenchMenuModel(provider, browser), 91 : WrenchMenuModel(provider, browser),
92 execute_count_(0), 92 execute_count_(0),
93 checked_count_(0), 93 checked_count_(0),
94 enable_count_(0) { 94 enable_count_(0) {
95 } 95 }
96 96
97 // Testing overrides to ui::SimpleMenuModel::Delegate: 97 // Testing overrides to ui::SimpleMenuModel::Delegate:
98 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { 98 virtual bool IsCommandIdChecked(int command_id) const override {
99 bool val = WrenchMenuModel::IsCommandIdChecked(command_id); 99 bool val = WrenchMenuModel::IsCommandIdChecked(command_id);
100 if (val) 100 if (val)
101 checked_count_++; 101 checked_count_++;
102 return val; 102 return val;
103 } 103 }
104 104
105 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { 105 virtual bool IsCommandIdEnabled(int command_id) const override {
106 ++enable_count_; 106 ++enable_count_;
107 return true; 107 return true;
108 } 108 }
109 109
110 virtual void ExecuteCommand(int command_id, int event_flags) OVERRIDE { 110 virtual void ExecuteCommand(int command_id, int event_flags) override {
111 ++execute_count_; 111 ++execute_count_;
112 } 112 }
113 113
114 int execute_count_; 114 int execute_count_;
115 mutable int checked_count_; 115 mutable int checked_count_;
116 mutable int enable_count_; 116 mutable int enable_count_;
117 }; 117 };
118 118
119 TEST_F(WrenchMenuModelTest, Basics) { 119 TEST_F(WrenchMenuModelTest, Basics) {
120 TestWrenchMenuModel model(this, browser()); 120 TestWrenchMenuModel model(this, browser());
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 class EncodingMenuModelTest : public BrowserWithTestWindowTest, 195 class EncodingMenuModelTest : public BrowserWithTestWindowTest,
196 public MenuModelTest { 196 public MenuModelTest {
197 }; 197 };
198 198
199 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { 199 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) {
200 EncodingMenuModel model(browser()); 200 EncodingMenuModel model(browser());
201 ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents()); 201 ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents());
202 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_ISO88591)); 202 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_ISO88591));
203 } 203 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/wrench_menu_model.h ('k') | chrome/browser/ui/translate/language_combobox_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698