| 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/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 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 EXPECT_TRUE(ProcessInController( | 853 EXPECT_TRUE(ProcessInController( |
| 854 ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN))); | 854 ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN))); |
| 855 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); | 855 EXPECT_EQ(1, delegate->handle_take_screenshot_count()); |
| 856 EXPECT_TRUE( | 856 EXPECT_TRUE( |
| 857 ProcessInController(ui::Accelerator( | 857 ProcessInController(ui::Accelerator( |
| 858 ui::VKEY_PRINT, ui::EF_NONE))); | 858 ui::VKEY_PRINT, ui::EF_NONE))); |
| 859 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); | 859 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
| 860 EXPECT_TRUE(ProcessInController(ui::Accelerator( | 860 EXPECT_TRUE(ProcessInController(ui::Accelerator( |
| 861 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); | 861 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
| 862 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); | 862 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
| 863 // None active window test case. | |
| 864 EXPECT_TRUE(ProcessInController(ui::Accelerator( | |
| 865 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN))); | |
| 866 EXPECT_EQ(0, delegate->handle_take_window_screenshot_count()); | |
| 867 // Active window test case. | |
| 868 std::unique_ptr<aura::Window> window; | |
| 869 window.reset(CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); | |
| 870 wm::ActivateWindow(window.get()); | |
| 871 EXPECT_TRUE(ProcessInController(ui::Accelerator( | |
| 872 ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN))); | |
| 873 EXPECT_EQ(1, delegate->handle_take_window_screenshot_count()); | |
| 874 } | 863 } |
| 875 const ui::Accelerator volume_mute(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); | 864 const ui::Accelerator volume_mute(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); |
| 876 const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); | 865 const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); |
| 877 const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE); | 866 const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE); |
| 878 { | 867 { |
| 879 TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate; | 868 TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate; |
| 880 ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( | 869 ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( |
| 881 std::unique_ptr<VolumeControlDelegate>(delegate)); | 870 std::unique_ptr<VolumeControlDelegate>(delegate)); |
| 882 EXPECT_EQ(0, delegate->handle_volume_mute_count()); | 871 EXPECT_EQ(0, delegate->handle_volume_mute_count()); |
| 883 EXPECT_TRUE(ProcessInController(volume_mute)); | 872 EXPECT_TRUE(ProcessInController(volume_mute)); |
| (...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1589 EXPECT_TRUE(IsMessageCenterEmpty()); | 1578 EXPECT_TRUE(IsMessageCenterEmpty()); |
| 1590 | 1579 |
| 1591 // If the action is LOCK_SCREEN, we must reset the state by unlocking the | 1580 // If the action is LOCK_SCREEN, we must reset the state by unlocking the |
| 1592 // screen before we proceed testing the rest of accelerators. | 1581 // screen before we proceed testing the rest of accelerators. |
| 1593 ResetStateIfNeeded(); | 1582 ResetStateIfNeeded(); |
| 1594 } | 1583 } |
| 1595 } | 1584 } |
| 1596 #endif // defined(OS_CHROMEOS) | 1585 #endif // defined(OS_CHROMEOS) |
| 1597 | 1586 |
| 1598 } // namespace ash | 1587 } // namespace ash |
| OLD | NEW |