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

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

Issue 2923723002: Avoid toggling app list if interrupted by mouse (Closed)
Patch Set: Rebase and refactor is_interrupted_by_mouse_event() to interrupted_by_mouse_event() Created 3 years, 5 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
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 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/accessibility_types.h" 9 #include "ash/accessibility_types.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 855
856 // The press of VKEY_BROWSER_SEARCH should toggle the AppList 856 // The press of VKEY_BROWSER_SEARCH should toggle the AppList
857 EXPECT_TRUE(ProcessInController( 857 EXPECT_TRUE(ProcessInController(
858 ui::Accelerator(ui::VKEY_BROWSER_SEARCH, ui::EF_NONE))); 858 ui::Accelerator(ui::VKEY_BROWSER_SEARCH, ui::EF_NONE)));
859 RunAllPendingInMessageLoop(); 859 RunAllPendingInMessageLoop();
860 EXPECT_EQ(3u, test_app_list_presenter.toggle_count()); 860 EXPECT_EQ(3u, test_app_list_presenter.toggle_count());
861 EXPECT_FALSE(ProcessInController( 861 EXPECT_FALSE(ProcessInController(
862 CreateReleaseAccelerator(ui::VKEY_BROWSER_SEARCH, ui::EF_NONE))); 862 CreateReleaseAccelerator(ui::VKEY_BROWSER_SEARCH, ui::EF_NONE)));
863 RunAllPendingInMessageLoop(); 863 RunAllPendingInMessageLoop();
864 EXPECT_EQ(3u, test_app_list_presenter.toggle_count()); 864 EXPECT_EQ(3u, test_app_list_presenter.toggle_count());
865
866 // When pressed key is interrupted by mouse, the AppList should not toggle.
867 EXPECT_FALSE(
868 ProcessInController(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
869 GetController()->accelerator_history()->InterruptCurrentAccelerator();
870 EXPECT_FALSE(ProcessInController(
871 CreateReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
872 RunAllPendingInMessageLoop();
873 EXPECT_EQ(3u, test_app_list_presenter.toggle_count());
865 } 874 }
866 875
867 TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { 876 TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) {
868 ASSERT_EQ(0u, Shell::Get()->ime_controller()->available_imes().size()); 877 ASSERT_EQ(0u, Shell::Get()->ime_controller()->available_imes().size());
869 878
870 // Cycling IME is blocked because there is nothing to switch to. 879 // Cycling IME is blocked because there is nothing to switch to.
871 ui::Accelerator control_space_down(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); 880 ui::Accelerator control_space_down(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN);
872 ui::Accelerator control_space_up(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); 881 ui::Accelerator control_space_up(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN);
873 control_space_up.set_key_state(ui::Accelerator::KeyState::RELEASED); 882 control_space_up.set_key_state(ui::Accelerator::KeyState::RELEASED);
874 ui::Accelerator control_shift_space(ui::VKEY_SPACE, 883 ui::Accelerator control_shift_space(ui::VKEY_SPACE,
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 EXPECT_TRUE(IsMessageCenterEmpty()); 1330 EXPECT_TRUE(IsMessageCenterEmpty());
1322 } 1331 }
1323 1332
1324 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1333 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1325 // screen before we proceed testing the rest of accelerators. 1334 // screen before we proceed testing the rest of accelerators.
1326 ResetStateIfNeeded(); 1335 ResetStateIfNeeded();
1327 } 1336 }
1328 } 1337 }
1329 1338
1330 } // namespace ash 1339 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698