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

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

Issue 2923723002: Avoid toggling app list if interrupted by mouse (Closed)
Patch Set: Add unit test in accelerator_filter_unittest.cc 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 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 877
878 // The press of VKEY_BROWSER_SEARCH should toggle the AppList 878 // The press of VKEY_BROWSER_SEARCH should toggle the AppList
879 EXPECT_TRUE(ProcessInController( 879 EXPECT_TRUE(ProcessInController(
880 ui::Accelerator(ui::VKEY_BROWSER_SEARCH, ui::EF_NONE))); 880 ui::Accelerator(ui::VKEY_BROWSER_SEARCH, ui::EF_NONE)));
881 RunAllPendingInMessageLoop(); 881 RunAllPendingInMessageLoop();
882 EXPECT_EQ(3u, test_app_list_presenter.toggle_count()); 882 EXPECT_EQ(3u, test_app_list_presenter.toggle_count());
883 EXPECT_FALSE(ProcessInController( 883 EXPECT_FALSE(ProcessInController(
884 CreateReleaseAccelerator(ui::VKEY_BROWSER_SEARCH, ui::EF_NONE))); 884 CreateReleaseAccelerator(ui::VKEY_BROWSER_SEARCH, ui::EF_NONE)));
885 RunAllPendingInMessageLoop(); 885 RunAllPendingInMessageLoop();
886 EXPECT_EQ(3u, test_app_list_presenter.toggle_count()); 886 EXPECT_EQ(3u, test_app_list_presenter.toggle_count());
887
888 // When pressed key is interrupted by mouse, the AppList should not toggle.
889 EXPECT_FALSE(
890 ProcessInController(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE)));
891 GetController()->accelerator_history()->InterruptCurrentAccelerator();
892 EXPECT_FALSE(ProcessInController(
893 CreateReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE)));
894 RunAllPendingInMessageLoop();
895 EXPECT_EQ(3u, test_app_list_presenter.toggle_count());
887 } 896 }
888 897
889 TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { 898 TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) {
890 TestInputMethodManagerState* test_state = 899 TestInputMethodManagerState* test_state =
891 test_input_method_manager_->state_.get(); 900 test_input_method_manager_->state_.get();
892 901
893 // Test IME shortcuts when cycling IME is blocked. 902 // Test IME shortcuts when cycling IME is blocked.
894 test_state->can_change_input_method_ = false; 903 test_state->can_change_input_method_ = false;
895 ui::Accelerator control_space_down(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); 904 ui::Accelerator control_space_down(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN);
896 ui::Accelerator control_space_up(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN); 905 ui::Accelerator control_space_up(ui::VKEY_SPACE, ui::EF_CONTROL_DOWN);
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
1356 // Expect no notifications from the new accelerators. 1365 // Expect no notifications from the new accelerators.
1357 EXPECT_TRUE(IsMessageCenterEmpty()); 1366 EXPECT_TRUE(IsMessageCenterEmpty());
1358 1367
1359 // If the action is LOCK_SCREEN, we must reset the state by unlocking the 1368 // If the action is LOCK_SCREEN, we must reset the state by unlocking the
1360 // screen before we proceed testing the rest of accelerators. 1369 // screen before we proceed testing the rest of accelerators.
1361 ResetStateIfNeeded(); 1370 ResetStateIfNeeded();
1362 } 1371 }
1363 } 1372 }
1364 1373
1365 } // namespace ash 1374 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698