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

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

Issue 11113004: Do not consume keys for DISABLE_CAPS_LOCK when caps lock is off. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add test Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | no next file » | no next file with comments »
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 #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/multi_display_manager.h" 8 #include "ash/display/multi_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 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 EXPECT_FALSE(delegate->IsCapsLockEnabled()); 620 EXPECT_FALSE(delegate->IsCapsLockEnabled());
621 621
622 // Do not handle when a shift pressed with other keys. 622 // Do not handle when a shift pressed with other keys.
623 delegate->SetCapsLockEnabled(true); 623 delegate->SetCapsLockEnabled(true);
624 EXPECT_FALSE(GetController()->Process( 624 EXPECT_FALSE(GetController()->Process(
625 ui::Accelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN))); 625 ui::Accelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN)));
626 EXPECT_TRUE(delegate->IsCapsLockEnabled()); 626 EXPECT_TRUE(delegate->IsCapsLockEnabled());
627 EXPECT_FALSE(GetController()->Process( 627 EXPECT_FALSE(GetController()->Process(
628 ReleaseAccelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN))); 628 ReleaseAccelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN)));
629 EXPECT_TRUE(delegate->IsCapsLockEnabled()); 629 EXPECT_TRUE(delegate->IsCapsLockEnabled());
630
631 // Do not consume shift keyup when caps lock is off.
632 delegate->SetCapsLockEnabled(false);
633 EXPECT_FALSE(GetController()->Process(
634 ui::Accelerator(ui::VKEY_LSHIFT, ui::EF_NONE)));
635 EXPECT_FALSE(GetController()->Process(
636 ReleaseAccelerator(ui::VKEY_LSHIFT, ui::EF_NONE)));
637 EXPECT_FALSE(GetController()->Process(
638 ui::Accelerator(ui::VKEY_RSHIFT, ui::EF_NONE)));
639 EXPECT_FALSE(GetController()->Process(
640 ReleaseAccelerator(ui::VKEY_RSHIFT, ui::EF_NONE)));
641 EXPECT_FALSE(GetController()->Process(
642 ui::Accelerator(ui::VKEY_SHIFT, ui::EF_NONE)));
643 EXPECT_FALSE(GetController()->Process(
644 ReleaseAccelerator(ui::VKEY_SHIFT, ui::EF_NONE)));
630 } 645 }
631 // ToggleCapsLock 646 // ToggleCapsLock
632 { 647 {
633 CapsLockDelegate* delegate = Shell::GetInstance()->caps_lock_delegate(); 648 CapsLockDelegate* delegate = Shell::GetInstance()->caps_lock_delegate();
634 delegate->SetCapsLockEnabled(true); 649 delegate->SetCapsLockEnabled(true);
635 EXPECT_TRUE(delegate->IsCapsLockEnabled()); 650 EXPECT_TRUE(delegate->IsCapsLockEnabled());
636 EXPECT_TRUE(GetController()->Process( 651 EXPECT_TRUE(GetController()->Process(
637 ui::Accelerator(ui::VKEY_LWIN, ui::EF_ALT_DOWN))); 652 ui::Accelerator(ui::VKEY_LWIN, ui::EF_ALT_DOWN)));
638 EXPECT_FALSE(delegate->IsCapsLockEnabled()); 653 EXPECT_FALSE(delegate->IsCapsLockEnabled());
639 EXPECT_TRUE(GetController()->Process( 654 EXPECT_TRUE(GetController()->Process(
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 EXPECT_FALSE(GetController()->IsReservedAccelerator( 1023 EXPECT_FALSE(GetController()->IsReservedAccelerator(
1009 ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); 1024 ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE)));
1010 EXPECT_FALSE(GetController()->IsReservedAccelerator( 1025 EXPECT_FALSE(GetController()->IsReservedAccelerator(
1011 ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE))); 1026 ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE)));
1012 EXPECT_FALSE(GetController()->IsReservedAccelerator( 1027 EXPECT_FALSE(GetController()->IsReservedAccelerator(
1013 ui::Accelerator(ui::VKEY_A, ui::EF_NONE))); 1028 ui::Accelerator(ui::VKEY_A, ui::EF_NONE)));
1014 } 1029 }
1015 1030
1016 } // namespace test 1031 } // namespace test
1017 } // namespace ash 1032 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698