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

Unified Diff: services/ui/ws/window_tree_unittest.cc

Issue 2863913004: chromeos: makes mus send keyevents to display root when nothing has focus (Closed)
Patch Set: GetClientVisibleRoot Created 3 years, 7 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 | « services/ui/ws/window_server.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/ws/window_tree_unittest.cc
diff --git a/services/ui/ws/window_tree_unittest.cc b/services/ui/ws/window_tree_unittest.cc
index 15a844ae7e21706733947197ee8ec91648bf51ff..5e7643216bfa6fca5d2055c9a0491d6057a90f0b 100644
--- a/services/ui/ws/window_tree_unittest.cc
+++ b/services/ui/ws/window_tree_unittest.cc
@@ -454,15 +454,28 @@ TEST_F(WindowTreeTest, StartPointerWatcherWrongUser) {
// Tests that a pointer watcher cannot watch keystrokes.
TEST_F(WindowTreeTest, StartPointerWatcherKeyEventsDisallowed) {
- WindowTreeTestApi(wm_tree()).StartPointerWatcher(false);
+ TestWindowTreeBinding* other_binding;
+ WindowTree* other_tree = CreateNewTree("other_user", &other_binding);
+ other_binding->client()->tracker()->changes()->clear();
+
+ WindowTreeTestApi(other_tree).StartPointerWatcher(false);
ui::KeyEvent key_pressed(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
DispatchEventAndAckImmediately(key_pressed);
- EXPECT_EQ(0u, wm_client()->tracker()->changes()->size());
+ EXPECT_EQ(0u, other_binding->client()->tracker()->changes()->size());
+ EXPECT_EQ("InputEvent window=0,3 event_action=7",
+ SingleChangeToDescription(*wm_client()->tracker()->changes()));
WindowTreeTestApi(wm_tree()).StartPointerWatcher(false);
ui::KeyEvent key_released(ui::ET_KEY_RELEASED, ui::VKEY_A, ui::EF_NONE);
DispatchEventAndAckImmediately(key_released);
- EXPECT_EQ(0u, wm_client()->tracker()->changes()->size());
+ EXPECT_EQ(0u, other_binding->client()->tracker()->changes()->size());
+}
+
+TEST_F(WindowTreeTest, KeyEventSentToWindowManagerWhenNothingFocused) {
+ ui::KeyEvent key_pressed(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
+ DispatchEventAndAckImmediately(key_pressed);
+ EXPECT_EQ("InputEvent window=0,3 event_action=7",
+ SingleChangeToDescription(*wm_client()->tracker()->changes()));
}
TEST_F(WindowTreeTest, CursorChangesWhenMouseOverWindowAndWindowSetsCursor) {
« no previous file with comments | « services/ui/ws/window_server.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698