| 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/caps_lock_delegate.h" | 7 #include "ash/caps_lock_delegate.h" |
| 8 #include "ash/display/display_manager.h" | 8 #include "ash/display/display_manager.h" |
| 9 #include "ash/ime_control_delegate.h" | 9 #include "ash/ime_control_delegate.h" |
| 10 #include "ash/screenshot_delegate.h" | 10 #include "ash/screenshot_delegate.h" |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); | 625 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
| 626 EXPECT_TRUE(ProcessWithContext( | 626 EXPECT_TRUE(ProcessWithContext( |
| 627 ui::Accelerator(ui::VKEY_F5, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); | 627 ui::Accelerator(ui::VKEY_F5, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
| 628 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); | 628 EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
| 629 } | 629 } |
| 630 #endif | 630 #endif |
| 631 // ToggleAppList | 631 // ToggleAppList |
| 632 { | 632 { |
| 633 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); | 633 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
| 634 EXPECT_TRUE(ProcessWithContext( | 634 EXPECT_TRUE(ProcessWithContext( |
| 635 ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); | 635 ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
| 636 EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); | 636 EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
| 637 EXPECT_TRUE(ProcessWithContext( | 637 EXPECT_TRUE(ProcessWithContext( |
| 638 ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); | 638 ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
| 639 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); | 639 EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
| 640 } | 640 } |
| 641 // ToggleAppList (with spoken feedback enabled) | 641 // ToggleAppList (with spoken feedback enabled) |
| 642 { | 642 { |
| 643 ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); | 643 ShellDelegate* delegate = ash::Shell::GetInstance()->delegate(); |
| 644 delegate->ToggleSpokenFeedback(); | 644 delegate->ToggleSpokenFeedback(); |
| 645 EXPECT_FALSE(ProcessWithContext( | 645 EXPECT_FALSE(ProcessWithContext( |
| 646 ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); | 646 ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
| 647 delegate->ToggleSpokenFeedback(); | 647 delegate->ToggleSpokenFeedback(); |
| 648 EXPECT_TRUE(ProcessWithContext( | 648 EXPECT_TRUE(ProcessWithContext( |
| 649 ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); | 649 ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
| 650 } | 650 } |
| 651 // DisableCapsLock | 651 // DisableCapsLock |
| 652 { | 652 { |
| 653 CapsLockDelegate* delegate = Shell::GetInstance()->caps_lock_delegate(); | 653 CapsLockDelegate* delegate = Shell::GetInstance()->caps_lock_delegate(); |
| 654 delegate->SetCapsLockEnabled(true); | 654 delegate->SetCapsLockEnabled(true); |
| 655 EXPECT_TRUE(delegate->IsCapsLockEnabled()); | 655 EXPECT_TRUE(delegate->IsCapsLockEnabled()); |
| 656 // Handled only on key release. | 656 // Handled only on key release. |
| 657 EXPECT_FALSE(ProcessWithContext( | 657 EXPECT_FALSE(ProcessWithContext( |
| 658 ui::Accelerator(ui::VKEY_LSHIFT, ui::EF_NONE))); | 658 ui::Accelerator(ui::VKEY_LSHIFT, ui::EF_NONE))); |
| 659 EXPECT_TRUE(delegate->IsCapsLockEnabled()); | 659 EXPECT_TRUE(delegate->IsCapsLockEnabled()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 ui::Accelerator(ui::VKEY_SHIFT, ui::EF_NONE))); | 698 ui::Accelerator(ui::VKEY_SHIFT, ui::EF_NONE))); |
| 699 EXPECT_FALSE(ProcessWithContext( | 699 EXPECT_FALSE(ProcessWithContext( |
| 700 ReleaseAccelerator(ui::VKEY_SHIFT, ui::EF_NONE))); | 700 ReleaseAccelerator(ui::VKEY_SHIFT, ui::EF_NONE))); |
| 701 } | 701 } |
| 702 // ToggleCapsLock | 702 // ToggleCapsLock |
| 703 { | 703 { |
| 704 CapsLockDelegate* delegate = Shell::GetInstance()->caps_lock_delegate(); | 704 CapsLockDelegate* delegate = Shell::GetInstance()->caps_lock_delegate(); |
| 705 delegate->SetCapsLockEnabled(true); | 705 delegate->SetCapsLockEnabled(true); |
| 706 EXPECT_TRUE(delegate->IsCapsLockEnabled()); | 706 EXPECT_TRUE(delegate->IsCapsLockEnabled()); |
| 707 EXPECT_TRUE(ProcessWithContext( | 707 EXPECT_TRUE(ProcessWithContext( |
| 708 ui::Accelerator(ui::VKEY_LWIN, ui::EF_ALT_DOWN))); | 708 ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_ALT_DOWN))); |
| 709 EXPECT_FALSE(delegate->IsCapsLockEnabled()); | 709 EXPECT_FALSE(delegate->IsCapsLockEnabled()); |
| 710 EXPECT_TRUE(ProcessWithContext( | 710 EXPECT_TRUE(ProcessWithContext( |
| 711 ui::Accelerator(ui::VKEY_LWIN, ui::EF_ALT_DOWN))); | 711 ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_ALT_DOWN))); |
| 712 EXPECT_TRUE(delegate->IsCapsLockEnabled()); | 712 EXPECT_TRUE(delegate->IsCapsLockEnabled()); |
| 713 } | 713 } |
| 714 #if defined(OS_CHROMEOS) | 714 #if defined(OS_CHROMEOS) |
| 715 // Volume | 715 // Volume |
| 716 const ui::Accelerator f8(ui::VKEY_F8, ui::EF_NONE); | 716 const ui::Accelerator f8(ui::VKEY_F8, ui::EF_NONE); |
| 717 const ui::Accelerator f9(ui::VKEY_F9, ui::EF_NONE); | 717 const ui::Accelerator f9(ui::VKEY_F9, ui::EF_NONE); |
| 718 const ui::Accelerator f10(ui::VKEY_F10, ui::EF_NONE); | 718 const ui::Accelerator f10(ui::VKEY_F10, ui::EF_NONE); |
| 719 { | 719 { |
| 720 EXPECT_TRUE(ProcessWithContext(f8)); | 720 EXPECT_TRUE(ProcessWithContext(f8)); |
| 721 EXPECT_TRUE(ProcessWithContext(f9)); | 721 EXPECT_TRUE(ProcessWithContext(f9)); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1264 EXPECT_EQ(f9, delegate->last_accelerator()); | 1264 EXPECT_EQ(f9, delegate->last_accelerator()); |
| 1265 EXPECT_EQ(0, delegate->handle_volume_up_count()); | 1265 EXPECT_EQ(0, delegate->handle_volume_up_count()); |
| 1266 EXPECT_TRUE(ProcessWithContext(f10)); | 1266 EXPECT_TRUE(ProcessWithContext(f10)); |
| 1267 EXPECT_EQ(1, delegate->handle_volume_up_count()); | 1267 EXPECT_EQ(1, delegate->handle_volume_up_count()); |
| 1268 EXPECT_EQ(f10, delegate->last_accelerator()); | 1268 EXPECT_EQ(f10, delegate->last_accelerator()); |
| 1269 } | 1269 } |
| 1270 } | 1270 } |
| 1271 #endif | 1271 #endif |
| 1272 | 1272 |
| 1273 } // namespace ash | 1273 } // namespace ash |
| OLD | NEW |