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

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

Issue 251193005: Enabled volume buttons when TouchView is active (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Style fixes as per Jons comments from Patch Set 1 Created 6 years, 7 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 | « no previous file | ash/ash.gyp » ('j') | ash/test/dummy_volume_control_delegate.h » ('J')
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 #include "ash/accelerators/accelerator_table.h" 7 #include "ash/accelerators/accelerator_table.h"
7 #include "ash/accessibility_delegate.h" 8 #include "ash/accessibility_delegate.h"
8 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
9 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
10 #include "ash/ime_control_delegate.h" 11 #include "ash/ime_control_delegate.h"
11 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
12 #include "ash/shell.h" 13 #include "ash/shell.h"
13 #include "ash/shell_window_ids.h" 14 #include "ash/shell_window_ids.h"
14 #include "ash/system/brightness_control_delegate.h" 15 #include "ash/system/brightness_control_delegate.h"
15 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" 16 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h"
16 #include "ash/system/tray/system_tray_delegate.h" 17 #include "ash/system/tray/system_tray_delegate.h"
17 #include "ash/test/ash_test_base.h" 18 #include "ash/test/ash_test_base.h"
18 #include "ash/test/display_manager_test_api.h" 19 #include "ash/test/display_manager_test_api.h"
20 #include "ash/test/dummy_volume_control_delegate.h"
19 #include "ash/test/test_screenshot_delegate.h" 21 #include "ash/test/test_screenshot_delegate.h"
20 #include "ash/test/test_shell_delegate.h" 22 #include "ash/test/test_shell_delegate.h"
21 #include "ash/volume_control_delegate.h" 23 #include "ash/volume_control_delegate.h"
22 #include "ash/wm/window_state.h" 24 #include "ash/wm/window_state.h"
23 #include "ash/wm/window_util.h" 25 #include "ash/wm/window_util.h"
24 #include "base/command_line.h" 26 #include "base/command_line.h"
25 #include "ui/aura/test/test_window_delegate.h" 27 #include "ui/aura/test/test_window_delegate.h"
26 #include "ui/aura/test/test_windows.h" 28 #include "ui/aura/test/test_windows.h"
27 #include "ui/aura/window.h" 29 #include "ui/aura/window.h"
28 #include "ui/events/event.h" 30 #include "ui/events/event.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }; 64 };
63 65
64 class ReleaseAccelerator : public ui::Accelerator { 66 class ReleaseAccelerator : public ui::Accelerator {
65 public: 67 public:
66 ReleaseAccelerator(ui::KeyboardCode keycode, int modifiers) 68 ReleaseAccelerator(ui::KeyboardCode keycode, int modifiers)
67 : ui::Accelerator(keycode, modifiers) { 69 : ui::Accelerator(keycode, modifiers) {
68 set_type(ui::ET_KEY_RELEASED); 70 set_type(ui::ET_KEY_RELEASED);
69 } 71 }
70 }; 72 };
71 73
72 class DummyVolumeControlDelegate : public VolumeControlDelegate {
73 public:
74 explicit DummyVolumeControlDelegate(bool consume)
75 : consume_(consume),
76 handle_volume_mute_count_(0),
77 handle_volume_down_count_(0),
78 handle_volume_up_count_(0) {
79 }
80 virtual ~DummyVolumeControlDelegate() {}
81
82 virtual bool HandleVolumeMute(const ui::Accelerator& accelerator) OVERRIDE {
83 ++handle_volume_mute_count_;
84 last_accelerator_ = accelerator;
85 return consume_;
86 }
87 virtual bool HandleVolumeDown(const ui::Accelerator& accelerator) OVERRIDE {
88 ++handle_volume_down_count_;
89 last_accelerator_ = accelerator;
90 return consume_;
91 }
92 virtual bool HandleVolumeUp(const ui::Accelerator& accelerator) OVERRIDE {
93 ++handle_volume_up_count_;
94 last_accelerator_ = accelerator;
95 return consume_;
96 }
97
98 int handle_volume_mute_count() const {
99 return handle_volume_mute_count_;
100 }
101 int handle_volume_down_count() const {
102 return handle_volume_down_count_;
103 }
104 int handle_volume_up_count() const {
105 return handle_volume_up_count_;
106 }
107 const ui::Accelerator& last_accelerator() const {
108 return last_accelerator_;
109 }
110
111 private:
112 const bool consume_;
113 int handle_volume_mute_count_;
114 int handle_volume_down_count_;
115 int handle_volume_up_count_;
116 ui::Accelerator last_accelerator_;
117
118 DISALLOW_COPY_AND_ASSIGN(DummyVolumeControlDelegate);
119 };
120
121 class DummyBrightnessControlDelegate : public BrightnessControlDelegate { 74 class DummyBrightnessControlDelegate : public BrightnessControlDelegate {
122 public: 75 public:
123 explicit DummyBrightnessControlDelegate(bool consume) 76 explicit DummyBrightnessControlDelegate(bool consume)
124 : consume_(consume), 77 : consume_(consume),
125 handle_brightness_down_count_(0), 78 handle_brightness_down_count_(0),
126 handle_brightness_up_count_(0) { 79 handle_brightness_up_count_(0) {
127 } 80 }
128 virtual ~DummyBrightnessControlDelegate() {} 81 virtual ~DummyBrightnessControlDelegate() {}
129 82
130 virtual bool HandleBrightnessDown( 83 virtual bool HandleBrightnessDown(
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 // Don't alert if we have a minimized window either. 1205 // Don't alert if we have a minimized window either.
1253 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); 1206 GetController()->PerformAction(WINDOW_MINIMIZE, dummy);
1254 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { 1207 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) {
1255 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); 1208 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE);
1256 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); 1209 GetController()->PerformAction(kActionsNeedingWindow[i], dummy);
1257 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE); 1210 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE);
1258 } 1211 }
1259 } 1212 }
1260 1213
1261 } // namespace ash 1214 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/ash.gyp » ('j') | ash/test/dummy_volume_control_delegate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698