| 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 | 6 |
| 7 #include "ash/accelerators/accelerator_table.h" | 7 #include "ash/accelerators/accelerator_table.h" |
| 8 #include "ash/ash_switches.h" | 8 #include "ash/ash_switches.h" |
| 9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/accessibility_delegate.h" | 10 #include "ash/common/accessibility_delegate.h" |
| 11 #include "ash/common/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/common/system/tray/system_tray_delegate.h" | 12 #include "ash/common/system/tray/system_tray_delegate.h" |
| 13 #include "ash/common/system/volume_control_delegate.h" | 13 #include "ash/common/system/volume_control_delegate.h" |
| 14 #include "ash/common/wm/panels/panel_layout_manager.h" | 14 #include "ash/common/wm/panels/panel_layout_manager.h" |
| 15 #include "ash/common/wm/window_positioning_utils.h" | 15 #include "ash/common/wm/window_positioning_utils.h" |
| 16 #include "ash/common/wm/window_state.h" | 16 #include "ash/common/wm/window_state.h" |
| 17 #include "ash/common/wm/wm_event.h" | 17 #include "ash/common/wm/wm_event.h" |
| 18 #include "ash/common/wm_shell.h" |
| 18 #include "ash/display/display_manager.h" | 19 #include "ash/display/display_manager.h" |
| 19 #include "ash/ime_control_delegate.h" | 20 #include "ash/ime_control_delegate.h" |
| 20 #include "ash/screen_util.h" | 21 #include "ash/screen_util.h" |
| 21 #include "ash/shell.h" | 22 #include "ash/shell.h" |
| 22 #include "ash/system/brightness_control_delegate.h" | 23 #include "ash/system/brightness_control_delegate.h" |
| 23 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" | 24 #include "ash/system/keyboard_brightness/keyboard_brightness_control_delegate.h" |
| 24 #include "ash/test/ash_test_base.h" | 25 #include "ash/test/ash_test_base.h" |
| 25 #include "ash/test/display_manager_test_api.h" | 26 #include "ash/test/display_manager_test_api.h" |
| 26 #include "ash/test/test_screenshot_delegate.h" | 27 #include "ash/test/test_screenshot_delegate.h" |
| 27 #include "ash/test/test_session_state_animator.h" | 28 #include "ash/test/test_session_state_animator.h" |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); | 860 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
| 860 EXPECT_TRUE(ProcessInController(ui::Accelerator( | 861 EXPECT_TRUE(ProcessInController(ui::Accelerator( |
| 861 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); | 862 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
| 862 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); | 863 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
| 863 } | 864 } |
| 864 const ui::Accelerator volume_mute(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); | 865 const ui::Accelerator volume_mute(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); |
| 865 const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); | 866 const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); |
| 866 const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE); | 867 const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE); |
| 867 { | 868 { |
| 868 TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate; | 869 TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate; |
| 869 ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( | 870 ash::WmShell::Get()->system_tray_delegate()->SetVolumeControlDelegate( |
| 870 std::unique_ptr<VolumeControlDelegate>(delegate)); | 871 std::unique_ptr<VolumeControlDelegate>(delegate)); |
| 871 EXPECT_EQ(0, delegate->handle_volume_mute_count()); | 872 EXPECT_EQ(0, delegate->handle_volume_mute_count()); |
| 872 EXPECT_TRUE(ProcessInController(volume_mute)); | 873 EXPECT_TRUE(ProcessInController(volume_mute)); |
| 873 EXPECT_EQ(1, delegate->handle_volume_mute_count()); | 874 EXPECT_EQ(1, delegate->handle_volume_mute_count()); |
| 874 EXPECT_EQ(volume_mute, delegate->last_accelerator()); | 875 EXPECT_EQ(volume_mute, delegate->last_accelerator()); |
| 875 EXPECT_EQ(0, delegate->handle_volume_down_count()); | 876 EXPECT_EQ(0, delegate->handle_volume_down_count()); |
| 876 EXPECT_TRUE(ProcessInController(volume_down)); | 877 EXPECT_TRUE(ProcessInController(volume_down)); |
| 877 EXPECT_EQ(1, delegate->handle_volume_down_count()); | 878 EXPECT_EQ(1, delegate->handle_volume_down_count()); |
| 878 EXPECT_EQ(volume_down, delegate->last_accelerator()); | 879 EXPECT_EQ(volume_down, delegate->last_accelerator()); |
| 879 EXPECT_EQ(0, delegate->handle_volume_up_count()); | 880 EXPECT_EQ(0, delegate->handle_volume_up_count()); |
| (...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1419 } | 1420 } |
| 1420 // Volume | 1421 // Volume |
| 1421 const ui::Accelerator volume_mute(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); | 1422 const ui::Accelerator volume_mute(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); |
| 1422 const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); | 1423 const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); |
| 1423 const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE); | 1424 const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE); |
| 1424 { | 1425 { |
| 1425 EXPECT_TRUE(ProcessInController(volume_mute)); | 1426 EXPECT_TRUE(ProcessInController(volume_mute)); |
| 1426 EXPECT_TRUE(ProcessInController(volume_down)); | 1427 EXPECT_TRUE(ProcessInController(volume_down)); |
| 1427 EXPECT_TRUE(ProcessInController(volume_up)); | 1428 EXPECT_TRUE(ProcessInController(volume_up)); |
| 1428 TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate; | 1429 TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate; |
| 1429 ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( | 1430 ash::WmShell::Get()->system_tray_delegate()->SetVolumeControlDelegate( |
| 1430 std::unique_ptr<VolumeControlDelegate>(delegate)); | 1431 std::unique_ptr<VolumeControlDelegate>(delegate)); |
| 1431 EXPECT_EQ(0, delegate->handle_volume_mute_count()); | 1432 EXPECT_EQ(0, delegate->handle_volume_mute_count()); |
| 1432 EXPECT_TRUE(ProcessInController(volume_mute)); | 1433 EXPECT_TRUE(ProcessInController(volume_mute)); |
| 1433 EXPECT_EQ(1, delegate->handle_volume_mute_count()); | 1434 EXPECT_EQ(1, delegate->handle_volume_mute_count()); |
| 1434 EXPECT_EQ(volume_mute, delegate->last_accelerator()); | 1435 EXPECT_EQ(volume_mute, delegate->last_accelerator()); |
| 1435 EXPECT_EQ(0, delegate->handle_volume_down_count()); | 1436 EXPECT_EQ(0, delegate->handle_volume_down_count()); |
| 1436 EXPECT_TRUE(ProcessInController(volume_down)); | 1437 EXPECT_TRUE(ProcessInController(volume_down)); |
| 1437 EXPECT_EQ(1, delegate->handle_volume_down_count()); | 1438 EXPECT_EQ(1, delegate->handle_volume_down_count()); |
| 1438 EXPECT_EQ(volume_down, delegate->last_accelerator()); | 1439 EXPECT_EQ(volume_down, delegate->last_accelerator()); |
| 1439 EXPECT_EQ(0, delegate->handle_volume_up_count()); | 1440 EXPECT_EQ(0, delegate->handle_volume_up_count()); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1578 EXPECT_TRUE(IsMessageCenterEmpty()); | 1579 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1579 | 1580 |
| 1580 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1581 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1581 // screen before we proceed testing the rest of accelerators. | 1582 // screen before we proceed testing the rest of accelerators. |
| 1582 ResetStateIfNeeded(); | 1583 ResetStateIfNeeded(); |
| 1583 } | 1584 } |
| 1584 } | 1585 } |
| 1585 #endif // defined(OS_CHROMEOS) | 1586 #endif // defined(OS_CHROMEOS) |
| 1586 | 1587 |
| 1587 } // namespace ash | 1588 } // namespace ash |
| OLD | NEW |