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

Side by Side Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 621133002: replace OVERRIDE and FINAL with override and final in ash/ (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
« no previous file with comments | « ash/accelerators/accelerator_controller.h ('k') | ash/accelerators/accelerator_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 6
7 #include "ash/accelerators/accelerator_table.h" 7 #include "ash/accelerators/accelerator_table.h"
8 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 int accelerator_repeat_count() const { return accelerator_repeat_count_; } 58 int accelerator_repeat_count() const { return accelerator_repeat_count_; }
59 59
60 void reset() { 60 void reset() {
61 accelerator_pressed_count_ = 0; 61 accelerator_pressed_count_ = 0;
62 accelerator_repeat_count_ = 0; 62 accelerator_repeat_count_ = 0;
63 } 63 }
64 64
65 // Overridden from ui::AcceleratorTarget: 65 // Overridden from ui::AcceleratorTarget:
66 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 66 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
67 virtual bool CanHandleAccelerators() const OVERRIDE; 67 virtual bool CanHandleAccelerators() const override;
68 68
69 private: 69 private:
70 int accelerator_pressed_count_; 70 int accelerator_pressed_count_;
71 int accelerator_repeat_count_; 71 int accelerator_repeat_count_;
72 72
73 DISALLOW_COPY_AND_ASSIGN(TestTarget); 73 DISALLOW_COPY_AND_ASSIGN(TestTarget);
74 }; 74 };
75 75
76 class ReleaseAccelerator : public ui::Accelerator { 76 class ReleaseAccelerator : public ui::Accelerator {
77 public: 77 public:
78 ReleaseAccelerator(ui::KeyboardCode keycode, int modifiers) 78 ReleaseAccelerator(ui::KeyboardCode keycode, int modifiers)
79 : ui::Accelerator(keycode, modifiers) { 79 : ui::Accelerator(keycode, modifiers) {
80 set_type(ui::ET_KEY_RELEASED); 80 set_type(ui::ET_KEY_RELEASED);
81 } 81 }
82 }; 82 };
83 83
84 class DummyBrightnessControlDelegate : public BrightnessControlDelegate { 84 class DummyBrightnessControlDelegate : public BrightnessControlDelegate {
85 public: 85 public:
86 explicit DummyBrightnessControlDelegate(bool consume) 86 explicit DummyBrightnessControlDelegate(bool consume)
87 : consume_(consume), 87 : consume_(consume),
88 handle_brightness_down_count_(0), 88 handle_brightness_down_count_(0),
89 handle_brightness_up_count_(0) { 89 handle_brightness_up_count_(0) {
90 } 90 }
91 virtual ~DummyBrightnessControlDelegate() {} 91 virtual ~DummyBrightnessControlDelegate() {}
92 92
93 virtual bool HandleBrightnessDown( 93 virtual bool HandleBrightnessDown(
94 const ui::Accelerator& accelerator) OVERRIDE { 94 const ui::Accelerator& accelerator) override {
95 ++handle_brightness_down_count_; 95 ++handle_brightness_down_count_;
96 last_accelerator_ = accelerator; 96 last_accelerator_ = accelerator;
97 return consume_; 97 return consume_;
98 } 98 }
99 virtual bool HandleBrightnessUp(const ui::Accelerator& accelerator) OVERRIDE { 99 virtual bool HandleBrightnessUp(const ui::Accelerator& accelerator) override {
100 ++handle_brightness_up_count_; 100 ++handle_brightness_up_count_;
101 last_accelerator_ = accelerator; 101 last_accelerator_ = accelerator;
102 return consume_; 102 return consume_;
103 } 103 }
104 virtual void SetBrightnessPercent(double percent, bool gradual) OVERRIDE {} 104 virtual void SetBrightnessPercent(double percent, bool gradual) override {}
105 virtual void GetBrightnessPercent( 105 virtual void GetBrightnessPercent(
106 const base::Callback<void(double)>& callback) OVERRIDE { 106 const base::Callback<void(double)>& callback) override {
107 callback.Run(100.0); 107 callback.Run(100.0);
108 } 108 }
109 109
110 int handle_brightness_down_count() const { 110 int handle_brightness_down_count() const {
111 return handle_brightness_down_count_; 111 return handle_brightness_down_count_;
112 } 112 }
113 int handle_brightness_up_count() const { 113 int handle_brightness_up_count() const {
114 return handle_brightness_up_count_; 114 return handle_brightness_up_count_;
115 } 115 }
116 const ui::Accelerator& last_accelerator() const { 116 const ui::Accelerator& last_accelerator() const {
(...skipping 12 matching lines...) Expand all
129 class DummyImeControlDelegate : public ImeControlDelegate { 129 class DummyImeControlDelegate : public ImeControlDelegate {
130 public: 130 public:
131 explicit DummyImeControlDelegate(bool consume) 131 explicit DummyImeControlDelegate(bool consume)
132 : consume_(consume), 132 : consume_(consume),
133 handle_next_ime_count_(0), 133 handle_next_ime_count_(0),
134 handle_previous_ime_count_(0), 134 handle_previous_ime_count_(0),
135 handle_switch_ime_count_(0) { 135 handle_switch_ime_count_(0) {
136 } 136 }
137 virtual ~DummyImeControlDelegate() {} 137 virtual ~DummyImeControlDelegate() {}
138 138
139 virtual void HandleNextIme() OVERRIDE { 139 virtual void HandleNextIme() override {
140 ++handle_next_ime_count_; 140 ++handle_next_ime_count_;
141 } 141 }
142 virtual bool HandlePreviousIme(const ui::Accelerator& accelerator) OVERRIDE { 142 virtual bool HandlePreviousIme(const ui::Accelerator& accelerator) override {
143 ++handle_previous_ime_count_; 143 ++handle_previous_ime_count_;
144 last_accelerator_ = accelerator; 144 last_accelerator_ = accelerator;
145 return consume_; 145 return consume_;
146 } 146 }
147 virtual bool HandleSwitchIme(const ui::Accelerator& accelerator) OVERRIDE { 147 virtual bool HandleSwitchIme(const ui::Accelerator& accelerator) override {
148 ++handle_switch_ime_count_; 148 ++handle_switch_ime_count_;
149 last_accelerator_ = accelerator; 149 last_accelerator_ = accelerator;
150 return consume_; 150 return consume_;
151 } 151 }
152 152
153 int handle_next_ime_count() const { 153 int handle_next_ime_count() const {
154 return handle_next_ime_count_; 154 return handle_next_ime_count_;
155 } 155 }
156 int handle_previous_ime_count() const { 156 int handle_previous_ime_count() const {
157 return handle_previous_ime_count_; 157 return handle_previous_ime_count_;
158 } 158 }
159 int handle_switch_ime_count() const { 159 int handle_switch_ime_count() const {
160 return handle_switch_ime_count_; 160 return handle_switch_ime_count_;
161 } 161 }
162 const ui::Accelerator& last_accelerator() const { 162 const ui::Accelerator& last_accelerator() const {
163 return last_accelerator_; 163 return last_accelerator_;
164 } 164 }
165 virtual ui::Accelerator RemapAccelerator( 165 virtual ui::Accelerator RemapAccelerator(
166 const ui::Accelerator& accelerator) OVERRIDE { 166 const ui::Accelerator& accelerator) override {
167 return ui::Accelerator(accelerator); 167 return ui::Accelerator(accelerator);
168 } 168 }
169 169
170 private: 170 private:
171 const bool consume_; 171 const bool consume_;
172 int handle_next_ime_count_; 172 int handle_next_ime_count_;
173 int handle_previous_ime_count_; 173 int handle_previous_ime_count_;
174 int handle_switch_ime_count_; 174 int handle_switch_ime_count_;
175 ui::Accelerator last_accelerator_; 175 ui::Accelerator last_accelerator_;
176 176
177 DISALLOW_COPY_AND_ASSIGN(DummyImeControlDelegate); 177 DISALLOW_COPY_AND_ASSIGN(DummyImeControlDelegate);
178 }; 178 };
179 179
180 class DummyKeyboardBrightnessControlDelegate 180 class DummyKeyboardBrightnessControlDelegate
181 : public KeyboardBrightnessControlDelegate { 181 : public KeyboardBrightnessControlDelegate {
182 public: 182 public:
183 explicit DummyKeyboardBrightnessControlDelegate(bool consume) 183 explicit DummyKeyboardBrightnessControlDelegate(bool consume)
184 : consume_(consume), 184 : consume_(consume),
185 handle_keyboard_brightness_down_count_(0), 185 handle_keyboard_brightness_down_count_(0),
186 handle_keyboard_brightness_up_count_(0) { 186 handle_keyboard_brightness_up_count_(0) {
187 } 187 }
188 virtual ~DummyKeyboardBrightnessControlDelegate() {} 188 virtual ~DummyKeyboardBrightnessControlDelegate() {}
189 189
190 virtual bool HandleKeyboardBrightnessDown( 190 virtual bool HandleKeyboardBrightnessDown(
191 const ui::Accelerator& accelerator) OVERRIDE { 191 const ui::Accelerator& accelerator) override {
192 ++handle_keyboard_brightness_down_count_; 192 ++handle_keyboard_brightness_down_count_;
193 last_accelerator_ = accelerator; 193 last_accelerator_ = accelerator;
194 return consume_; 194 return consume_;
195 } 195 }
196 196
197 virtual bool HandleKeyboardBrightnessUp( 197 virtual bool HandleKeyboardBrightnessUp(
198 const ui::Accelerator& accelerator) OVERRIDE { 198 const ui::Accelerator& accelerator) override {
199 ++handle_keyboard_brightness_up_count_; 199 ++handle_keyboard_brightness_up_count_;
200 last_accelerator_ = accelerator; 200 last_accelerator_ = accelerator;
201 return consume_; 201 return consume_;
202 } 202 }
203 203
204 int handle_keyboard_brightness_down_count() const { 204 int handle_keyboard_brightness_down_count() const {
205 return handle_keyboard_brightness_down_count_; 205 return handle_keyboard_brightness_down_count_;
206 } 206 }
207 207
208 int handle_keyboard_brightness_up_count() const { 208 int handle_keyboard_brightness_up_count() const {
(...skipping 885 matching lines...) Expand 10 before | Expand all | Expand 10 after
1094 } 1094 }
1095 1095
1096 namespace { 1096 namespace {
1097 1097
1098 class PreferredReservedAcceleratorsTest : public test::AshTestBase { 1098 class PreferredReservedAcceleratorsTest : public test::AshTestBase {
1099 public: 1099 public:
1100 PreferredReservedAcceleratorsTest() {} 1100 PreferredReservedAcceleratorsTest() {}
1101 virtual ~PreferredReservedAcceleratorsTest() {} 1101 virtual ~PreferredReservedAcceleratorsTest() {}
1102 1102
1103 // test::AshTestBase: 1103 // test::AshTestBase:
1104 virtual void SetUp() OVERRIDE { 1104 virtual void SetUp() override {
1105 AshTestBase::SetUp(); 1105 AshTestBase::SetUp();
1106 Shell::GetInstance()->lock_state_controller()-> 1106 Shell::GetInstance()->lock_state_controller()->
1107 set_animator_for_test(new test::TestSessionStateAnimator); 1107 set_animator_for_test(new test::TestSessionStateAnimator);
1108 } 1108 }
1109 1109
1110 private: 1110 private:
1111 DISALLOW_COPY_AND_ASSIGN(PreferredReservedAcceleratorsTest); 1111 DISALLOW_COPY_AND_ASSIGN(PreferredReservedAcceleratorsTest);
1112 }; 1112 };
1113 1113
1114 } // namespace 1114 } // namespace
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1323 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); 1323 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20)));
1324 wm::ActivateWindow(window.get()); 1324 wm::ActivateWindow(window.get());
1325 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); 1325 GetController()->PerformAction(WINDOW_MINIMIZE, dummy);
1326 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); 1326 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
1327 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); 1327 GetController()->PerformAction(kActionsNeedingWindow[i], dummy);
1328 EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED); 1328 EXPECT_NE(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_WINDOW_NEEDED);
1329 } 1329 }
1330 } 1330 }
1331 1331
1332 } // namespace ash 1332 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.h ('k') | ash/accelerators/accelerator_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698