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

Unified Diff: components/mus/ws/event_dispatcher_unittest.cc

Issue 1759273002: Add AcceleratorType to EventMatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
Index: components/mus/ws/event_dispatcher_unittest.cc
diff --git a/components/mus/ws/event_dispatcher_unittest.cc b/components/mus/ws/event_dispatcher_unittest.cc
index a6d6c09230952aa6cf20f2229ea6f4a8d8db4b5d..2dcbecabc93d27ee407d40253e8efb418d27a5e6 100644
--- a/components/mus/ws/event_dispatcher_unittest.cc
+++ b/components/mus/ws/event_dispatcher_unittest.cc
@@ -355,6 +355,27 @@ TEST_F(EventDispatcherTest, EventMatching) {
EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
}
+// Tests that a post-target accelerator is not triggered by ProcessEvent.
+TEST_F(EventDispatcherTest, PostTargetAccelerator) {
+ TestEventDispatcherDelegate* event_dispatcher_delegate =
+ test_event_dispatcher_delegate();
+ EventDispatcher* dispatcher = event_dispatcher();
+
+ mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher(
+ mus::mojom::KeyboardCode::W, mus::mojom::kEventFlagControlDown);
+ matcher->accelerator_matcher->accelerator_phase =
+ mojom::AcceleratorPhase::POST_TARGET;
+ uint32_t accelerator_1 = 1;
+ dispatcher->AddAccelerator(accelerator_1, std::move(matcher));
+
+ ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN);
+ dispatcher->ProcessEvent(key);
+ EXPECT_EQ(0u, event_dispatcher_delegate->GetAndClearLastAccelerator());
+
+ // TODO(jonross): Update this test to include actual invokation of PostTarget
+ // acceleratos once events acking includes consuming.
+}
+
TEST_F(EventDispatcherTest, Capture) {
ServerWindow* root = root_window();
scoped_ptr<ServerWindow> child(CreateChildWindow(WindowId(1, 3)));

Powered by Google App Engine
This is Rietveld 408576698