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

Unified Diff: ash/accelerators/accelerator_filter_unittest.cc

Issue 1117173003: Converting (Alt+LeftClick -> RightClick) to (Search+LeftClick -> RightClick) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added a test case for ignoring synthesized mouse events. Created 5 years, 8 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 | « no previous file | chrome/browser/chromeos/events/event_rewriter.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 a4e9c297b5643cc36349e460f9ca0e246b288181..12991369212c5a2c64e4361a049b1f92ec4f8441 100644
--- a/ash/accelerators/accelerator_filter_unittest.cc
+++ b/ash/accelerators/accelerator_filter_unittest.cc
@@ -19,6 +19,7 @@
#include "ui/aura/window.h"
#include "ui/base/accelerators/accelerator_history.h"
#include "ui/events/event.h"
+#include "ui/events/event_utils.h"
#include "ui/events/test/event_generator.h"
#include "ui/gfx/geometry/rect.h"
@@ -134,5 +135,34 @@ TEST_F(AcceleratorFilterTest, CanConsumeSystemKeys) {
}
#endif // defined(OS_CHROMEOS)
+// Tests that pressing 'SEARCH' + LeftMouseClick, which will be rewritten as a
+// RightMouseClick, will not toggle the AppList.
+// This test will fail without the code to clear the current accelerator in
+// the accelerator history present in |AcceleratorFilter::OnMouseEvent()|.
+TEST_F(AcceleratorFilterTest, SearchClickDoesntToggleAppList) {
+ ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+ generator.PressKey(ui::VKEY_LWIN, 0);
+ generator.ClickLeftButton();
+ generator.ReleaseKey(ui::VKEY_LWIN, 0);
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+}
+
+// Make sure that synthesized mouse events don't interfere with tracking
+// the key accelerators.
+TEST_F(AcceleratorFilterTest, SynthesizeMouseEventsAreIgnored) {
+ ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow());
+ const gfx::Point origin(0, 0);
+
+ EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+ generator.PressKey(ui::VKEY_LWIN, 0);
+ ui::MouseEvent mouse_event(ui::ET_MOUSE_MOVED, origin, origin,
+ ui::EventTimeForNow(), ui::EF_IS_SYNTHESIZED, 0);
+ generator.Dispatch(&mouse_event);
+ generator.ReleaseKey(ui::VKEY_LWIN, 0);
+ EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility());
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « no previous file | chrome/browser/chromeos/events/event_rewriter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698