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

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

Issue 2696873002: Change OnWindowInputEvent to use display_id to find the host and update event root_location in WS. (Closed)
Patch Set: nits Created 3 years, 9 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: services/ui/ws/window_manager_state_unittest.cc
diff --git a/services/ui/ws/window_manager_state_unittest.cc b/services/ui/ws/window_manager_state_unittest.cc
index 2b2e7e2e617af5f991dab91263922494b05dfdc1..2b9e07ec65d264aa089032d30761395fd4817e7b 100644
--- a/services/ui/ws/window_manager_state_unittest.cc
+++ b/services/ui/ws/window_manager_state_unittest.cc
@@ -384,7 +384,7 @@ TEST_F(WindowManagerStateTest, DontSendQueuedEventsToADeadTree) {
EF_LEFT_MOUSE_BUTTON);
DispatchInputEventToWindow(target, press, nullptr);
ASSERT_EQ(1u, tracker->changes()->size());
- EXPECT_EQ("InputEvent window=1,1 event_action=1",
+ EXPECT_EQ("InputEvent window=1,1 event_action=1 event_root_location=5,5",
ChangesToDescription1(*tracker->changes())[0]);
tracker->changes()->clear();
// The above is not setting TreeAwaitingInputAck.
@@ -587,6 +587,29 @@ TEST_F(WindowManagerStateTest, CursorResetOverNoTarget) {
EXPECT_EQ(ui::mojom::Cursor::POINTER, display_test_api.last_cursor());
}
+TEST_F(WindowManagerStateTest, RootLocationCoordinateConversion) {
+ TestWindowTreeClient* embed_connection = nullptr;
+ WindowTree* target_tree = nullptr;
+ ServerWindow* target = nullptr;
+ window()->SetBounds(gfx::Rect(10, 10, 100, 100));
+ CreateSecondaryTree(&embed_connection, &target_tree, &target);
+ TestWindowManager target_window_manager;
+ WindowTreeTestApi(target_tree)
+ .set_window_manager_internal(&target_window_manager);
+
+ const gfx::Point event_location(40, 50);
+ const gfx::Point event_root_location(30, 40);
+ ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_root_location,
+ base::TimeTicks(), 0, 0);
+ std::unique_ptr<Accelerator> accelerator = CreateAccelerator();
+ DispatchInputEventToWindow(target, mouse, accelerator.get());
+ TestChangeTracker* tracker = embed_connection->tracker();
+ ASSERT_EQ(1u, tracker->changes()->size());
+ EXPECT_EQ("InputEvent window=2,1 event_action=4 event_root_location=20,30",
+ ChangesToDescription1(*tracker->changes())[0]);
+ EXPECT_TRUE(wm_client()->tracker()->changes()->empty());
+}
+
} // namespace test
} // namespace ws
} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698