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

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

Issue 11419306: Don't disable Caps Lock when Shift+<non-modifier-key> is pressed and Shift is released first. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/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 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 659
660 // Do not handle when a shift pressed with other keys. 660 // Do not handle when a shift pressed with other keys.
661 delegate->SetCapsLockEnabled(true); 661 delegate->SetCapsLockEnabled(true);
662 EXPECT_FALSE(ProcessWithContext( 662 EXPECT_FALSE(ProcessWithContext(
663 ui::Accelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN))); 663 ui::Accelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN)));
664 EXPECT_TRUE(delegate->IsCapsLockEnabled()); 664 EXPECT_TRUE(delegate->IsCapsLockEnabled());
665 EXPECT_FALSE(ProcessWithContext( 665 EXPECT_FALSE(ProcessWithContext(
666 ReleaseAccelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN))); 666 ReleaseAccelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN)));
667 EXPECT_TRUE(delegate->IsCapsLockEnabled()); 667 EXPECT_TRUE(delegate->IsCapsLockEnabled());
668 668
669 // Do not handle when a shift pressed with other keys, and shift is
670 // released first.
671 delegate->SetCapsLockEnabled(true);
672 EXPECT_FALSE(ProcessWithContext(
673 ui::Accelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN)));
674 EXPECT_TRUE(delegate->IsCapsLockEnabled());
675 EXPECT_FALSE(ProcessWithContext(
676 ReleaseAccelerator(ui::VKEY_LSHIFT, ui::EF_NONE)));
677 EXPECT_TRUE(delegate->IsCapsLockEnabled());
678
679 EXPECT_FALSE(ProcessWithContext(
680 ui::Accelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN)));
681 EXPECT_TRUE(delegate->IsCapsLockEnabled());
682 EXPECT_FALSE(ProcessWithContext(
683 ReleaseAccelerator(ui::VKEY_SHIFT, ui::EF_NONE)));
684 EXPECT_TRUE(delegate->IsCapsLockEnabled());
685
686 EXPECT_FALSE(ProcessWithContext(
687 ui::Accelerator(ui::VKEY_A, ui::EF_SHIFT_DOWN)));
688 EXPECT_TRUE(delegate->IsCapsLockEnabled());
689 EXPECT_FALSE(ProcessWithContext(
690 ReleaseAccelerator(ui::VKEY_RSHIFT, ui::EF_NONE)));
691 EXPECT_TRUE(delegate->IsCapsLockEnabled());
692
669 // Do not consume shift keyup when caps lock is off. 693 // Do not consume shift keyup when caps lock is off.
670 delegate->SetCapsLockEnabled(false); 694 delegate->SetCapsLockEnabled(false);
671 EXPECT_FALSE(ProcessWithContext( 695 EXPECT_FALSE(ProcessWithContext(
672 ui::Accelerator(ui::VKEY_LSHIFT, ui::EF_NONE))); 696 ui::Accelerator(ui::VKEY_LSHIFT, ui::EF_NONE)));
673 EXPECT_FALSE(ProcessWithContext( 697 EXPECT_FALSE(ProcessWithContext(
674 ReleaseAccelerator(ui::VKEY_LSHIFT, ui::EF_NONE))); 698 ReleaseAccelerator(ui::VKEY_LSHIFT, ui::EF_NONE)));
675 EXPECT_FALSE(ProcessWithContext( 699 EXPECT_FALSE(ProcessWithContext(
676 ui::Accelerator(ui::VKEY_RSHIFT, ui::EF_NONE))); 700 ui::Accelerator(ui::VKEY_RSHIFT, ui::EF_NONE)));
677 EXPECT_FALSE(ProcessWithContext( 701 EXPECT_FALSE(ProcessWithContext(
678 ReleaseAccelerator(ui::VKEY_RSHIFT, ui::EF_NONE))); 702 ReleaseAccelerator(ui::VKEY_RSHIFT, ui::EF_NONE)));
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 EXPECT_EQ(volume_down, delegate->last_accelerator()); 1280 EXPECT_EQ(volume_down, delegate->last_accelerator());
1257 EXPECT_EQ(0, delegate->handle_volume_up_count()); 1281 EXPECT_EQ(0, delegate->handle_volume_up_count());
1258 EXPECT_TRUE(ProcessWithContext(volume_up)); 1282 EXPECT_TRUE(ProcessWithContext(volume_up));
1259 EXPECT_EQ(1, delegate->handle_volume_up_count()); 1283 EXPECT_EQ(1, delegate->handle_volume_up_count());
1260 EXPECT_EQ(volume_up, delegate->last_accelerator()); 1284 EXPECT_EQ(volume_up, delegate->last_accelerator());
1261 } 1285 }
1262 } 1286 }
1263 #endif 1287 #endif
1264 1288
1265 } // namespace ash 1289 } // 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