OLD | NEW |
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 #include "ash/accelerators/accelerator_table.h" | 6 #include "ash/accelerators/accelerator_table.h" |
7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
9 #include "ash/display/display_manager.h" | 9 #include "ash/display/display_manager.h" |
10 #include "ash/ime_control_delegate.h" | 10 #include "ash/ime_control_delegate.h" |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 EXPECT_TRUE(ProcessWithContext(volume_up)); | 747 EXPECT_TRUE(ProcessWithContext(volume_up)); |
748 EXPECT_EQ(1, delegate->handle_volume_up_count()); | 748 EXPECT_EQ(1, delegate->handle_volume_up_count()); |
749 EXPECT_EQ(volume_up, delegate->last_accelerator()); | 749 EXPECT_EQ(volume_up, delegate->last_accelerator()); |
750 } | 750 } |
751 #if defined(OS_CHROMEOS) | 751 #if defined(OS_CHROMEOS) |
752 // Brightness | 752 // Brightness |
753 // ui::VKEY_BRIGHTNESS_DOWN/UP are not defined on Windows. | 753 // ui::VKEY_BRIGHTNESS_DOWN/UP are not defined on Windows. |
754 const ui::Accelerator brightness_down(ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE); | 754 const ui::Accelerator brightness_down(ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE); |
755 const ui::Accelerator brightness_up(ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE); | 755 const ui::Accelerator brightness_up(ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE); |
756 { | 756 { |
757 EXPECT_FALSE(ProcessWithContext(brightness_down)); | |
758 EXPECT_FALSE(ProcessWithContext(brightness_up)); | |
759 DummyBrightnessControlDelegate* delegate = | |
760 new DummyBrightnessControlDelegate(true); | |
761 GetController()->SetBrightnessControlDelegate( | |
762 scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); | |
763 EXPECT_FALSE(ProcessWithContext(brightness_down)); | |
764 EXPECT_FALSE(ProcessWithContext(brightness_up)); | |
765 } | |
766 // Enable internal display. | |
767 EnableInternalDisplay(); | |
768 { | |
769 DummyBrightnessControlDelegate* delegate = | 757 DummyBrightnessControlDelegate* delegate = |
770 new DummyBrightnessControlDelegate(false); | 758 new DummyBrightnessControlDelegate(false); |
771 GetController()->SetBrightnessControlDelegate( | 759 GetController()->SetBrightnessControlDelegate( |
772 scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); | 760 scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); |
773 EXPECT_EQ(0, delegate->handle_brightness_down_count()); | 761 EXPECT_EQ(0, delegate->handle_brightness_down_count()); |
774 EXPECT_FALSE(ProcessWithContext(brightness_down)); | 762 EXPECT_FALSE(ProcessWithContext(brightness_down)); |
775 EXPECT_EQ(1, delegate->handle_brightness_down_count()); | 763 EXPECT_EQ(1, delegate->handle_brightness_down_count()); |
776 EXPECT_EQ(brightness_down, delegate->last_accelerator()); | 764 EXPECT_EQ(brightness_down, delegate->last_accelerator()); |
777 EXPECT_EQ(0, delegate->handle_brightness_up_count()); | 765 EXPECT_EQ(0, delegate->handle_brightness_up_count()); |
778 EXPECT_FALSE(ProcessWithContext(brightness_up)); | 766 EXPECT_FALSE(ProcessWithContext(brightness_up)); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); | 1148 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
1161 EXPECT_TRUE(ProcessWithContext( | 1149 EXPECT_TRUE(ProcessWithContext( |
1162 ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, | 1150 ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, |
1163 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); | 1151 ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
1164 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); | 1152 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
1165 } | 1153 } |
1166 // Brightness | 1154 // Brightness |
1167 const ui::Accelerator brightness_down(ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE); | 1155 const ui::Accelerator brightness_down(ui::VKEY_BRIGHTNESS_DOWN, ui::EF_NONE); |
1168 const ui::Accelerator brightness_up(ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE); | 1156 const ui::Accelerator brightness_up(ui::VKEY_BRIGHTNESS_UP, ui::EF_NONE); |
1169 { | 1157 { |
1170 EXPECT_FALSE(ProcessWithContext(brightness_down)); | |
1171 EXPECT_FALSE(ProcessWithContext(brightness_up)); | |
1172 DummyBrightnessControlDelegate* delegate = | |
1173 new DummyBrightnessControlDelegate(true); | |
1174 GetController()->SetBrightnessControlDelegate( | |
1175 scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); | |
1176 EXPECT_FALSE(ProcessWithContext(brightness_down)); | |
1177 EXPECT_FALSE(ProcessWithContext(brightness_up)); | |
1178 } | |
1179 EnableInternalDisplay(); | |
1180 { | |
1181 EXPECT_FALSE(ProcessWithContext(brightness_down)); | |
1182 EXPECT_FALSE(ProcessWithContext(brightness_up)); | |
1183 DummyBrightnessControlDelegate* delegate = | 1158 DummyBrightnessControlDelegate* delegate = |
1184 new DummyBrightnessControlDelegate(false); | 1159 new DummyBrightnessControlDelegate(false); |
1185 GetController()->SetBrightnessControlDelegate( | 1160 GetController()->SetBrightnessControlDelegate( |
1186 scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); | 1161 scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); |
1187 EXPECT_EQ(0, delegate->handle_brightness_down_count()); | 1162 EXPECT_EQ(0, delegate->handle_brightness_down_count()); |
1188 EXPECT_FALSE(ProcessWithContext(brightness_down)); | 1163 EXPECT_FALSE(ProcessWithContext(brightness_down)); |
1189 EXPECT_EQ(1, delegate->handle_brightness_down_count()); | 1164 EXPECT_EQ(1, delegate->handle_brightness_down_count()); |
1190 EXPECT_EQ(brightness_down, delegate->last_accelerator()); | 1165 EXPECT_EQ(brightness_down, delegate->last_accelerator()); |
1191 EXPECT_EQ(0, delegate->handle_brightness_up_count()); | 1166 EXPECT_EQ(0, delegate->handle_brightness_up_count()); |
1192 EXPECT_FALSE(ProcessWithContext(brightness_up)); | 1167 EXPECT_FALSE(ProcessWithContext(brightness_up)); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1277 // Don't alert if we have a minimized window either. | 1252 // Don't alert if we have a minimized window either. |
1278 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); | 1253 GetController()->PerformAction(WINDOW_MINIMIZE, dummy); |
1279 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { | 1254 for (size_t i = 0; i < kActionsNeedingWindowLength; ++i) { |
1280 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); | 1255 delegate->TriggerAccessibilityAlert(A11Y_ALERT_NONE); |
1281 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); | 1256 GetController()->PerformAction(kActionsNeedingWindow[i], dummy); |
1282 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE); | 1257 EXPECT_EQ(delegate->GetLastAccessibilityAlert(), A11Y_ALERT_NONE); |
1283 } | 1258 } |
1284 } | 1259 } |
1285 | 1260 |
1286 } // namespace ash | 1261 } // namespace ash |
OLD | NEW |