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

Unified Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 11421055: Add power-user keyboard mode for ChromeOS with Search key acting as a typical Fn key. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SkyNits Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller_unittest.cc
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index 7012f4f33aa2bcffbfd6ba162e1444b2e2ffa1cb..b6f925427237e4f1aaadff15e24931454721fa6f 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -628,26 +628,6 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) {
EXPECT_EQ(2, delegate->handle_take_screenshot_count());
}
#endif
- // ToggleAppList
- {
- EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
- EXPECT_TRUE(ProcessWithContext(
- ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
- EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
- EXPECT_TRUE(ProcessWithContext(
- ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
- EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
- }
- // ToggleAppList (with spoken feedback enabled)
- {
- ShellDelegate* delegate = ash::Shell::GetInstance()->delegate();
- delegate->ToggleSpokenFeedback();
- EXPECT_FALSE(ProcessWithContext(
- ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
- delegate->ToggleSpokenFeedback();
- EXPECT_TRUE(ProcessWithContext(
- ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
- }
// DisableCapsLock
{
CapsLockDelegate* delegate = Shell::GetInstance()->caps_lock_delegate();
@@ -962,6 +942,88 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) {
#endif
}
+TEST_F(AcceleratorControllerTest,
+ GlobalAcceleratorsToggleAppListWithoutSearchAsModifier) {
+ ShellDelegate* delegate = ash::Shell::GetInstance()->delegate();
+
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+
+ // When Search is not acting as a modifier, pressing Search should toggle
+ // the AppList
+ EXPECT_TRUE(ProcessWithContext(
+ ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_FALSE(ProcessWithContext(
+ ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+
+ // When spoken feedback is on, the AppList should not toggle.
+ delegate->ToggleSpokenFeedback();
+ EXPECT_FALSE(ProcessWithContext(
+ ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_FALSE(ProcessWithContext(
+ ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ delegate->ToggleSpokenFeedback();
+ EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+
+ EXPECT_TRUE(ProcessWithContext(
+ ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_FALSE(ProcessWithContext(
+ ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+
+ // When spoken feedback is on, the AppList should not toggle.
+ delegate->ToggleSpokenFeedback();
+ EXPECT_FALSE(ProcessWithContext(
+ ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_FALSE(ProcessWithContext(
+ ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ delegate->ToggleSpokenFeedback();
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+}
+
+TEST_F(AcceleratorControllerTest,
+ GlobalAcceleratorsToggleAppListWithSearchAsModifier) {
+ test::TestShellDelegate* delegate =
+ reinterpret_cast<test::TestShellDelegate*>(
+ ash::Shell::GetInstance()->delegate());
+ delegate->set_is_search_key_acting_as_function_key(true);
+
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+
+ // When Search is acting as a modifier for accessing extended keyboard
+ // shortcuts, then the press event should not open the AppList, and the
+ // release should instead.
+ EXPECT_FALSE(ProcessWithContext(
+ ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_TRUE(ProcessWithContext(
+ ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+
+ // When spoken feedback is on, the AppList should not toggle.
+ delegate->ToggleSpokenFeedback();
+ EXPECT_FALSE(ProcessWithContext(
+ ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_FALSE(ProcessWithContext(
+ ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ delegate->ToggleSpokenFeedback();
+ EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+
+ EXPECT_FALSE(ProcessWithContext(
+ ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_TRUE(ProcessWithContext(
+ ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+
+ // When spoken feedback is on, the AppList should not toggle.
+ delegate->ToggleSpokenFeedback();
+ EXPECT_FALSE(ProcessWithContext(
+ ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ EXPECT_FALSE(ProcessWithContext(
+ ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
+ delegate->ToggleSpokenFeedback();
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+}
+
TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) {
// Test IME shortcuts.
{
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698