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

Unified Diff: ash/accelerators/accelerator_filter_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/accelerators/accelerator_controller_unittest.cc ('k') | ui/base/accelerators/accelerator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_filter_unittest.cc
diff --git a/ash/accelerators/accelerator_filter_unittest.cc b/ash/accelerators/accelerator_filter_unittest.cc
index 603bbefc4c0ef3f128037b1173aacb8137c72af8..3b1897cba48dee2cb27ded32c78cfcd12da6ed0f 100644
--- a/ash/accelerators/accelerator_filter_unittest.cc
+++ b/ash/accelerators/accelerator_filter_unittest.cc
@@ -18,6 +18,8 @@
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/app_list/presenter/app_list.h"
+#include "ui/app_list/presenter/test/test_app_list_presenter.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/aura_test_base.h"
#include "ui/aura/test/test_windows.h"
@@ -185,5 +187,27 @@ TEST_F(AcceleratorFilterTest, SearchKeyShortcutsAreAlwaysHandled) {
EXPECT_FALSE(session_controller->IsScreenLocked());
}
+TEST_F(AcceleratorFilterTest, ToggleAppListInterruptedByMouseEvent) {
+ ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+ app_list::test::TestAppListPresenter test_app_list_presenter;
+ Shell::Get()->app_list()->SetAppListPresenter(
+ test_app_list_presenter.CreateInterfacePtrAndBind());
+ EXPECT_EQ(0u, test_app_list_presenter.toggle_count());
+
+ // The AppList should toggle if no mouse event occurs between key press and
+ // key release.
+ generator.PressKey(ui::VKEY_LWIN, ui::EF_NONE);
+ generator.ReleaseKey(ui::VKEY_LWIN, ui::EF_NONE);
+ RunAllPendingInMessageLoop();
+ EXPECT_EQ(1u, test_app_list_presenter.toggle_count());
+
+ // When pressed key is interrupted by mouse, the AppList should not toggle.
+ generator.PressKey(ui::VKEY_LWIN, ui::EF_NONE);
+ generator.ClickLeftButton();
+ generator.ReleaseKey(ui::VKEY_LWIN, ui::EF_NONE);
+ RunAllPendingInMessageLoop();
+ EXPECT_EQ(1u, test_app_list_presenter.toggle_count());
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/accelerators/accelerator_controller_unittest.cc ('k') | ui/base/accelerators/accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698