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

Unified Diff: ui/aura/window_event_dispatcher_unittest.cc

Issue 754013007: Fix the wrong relative coordinates from EventDispatch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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: ui/aura/window_event_dispatcher_unittest.cc
diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc
index 25f9186836352a8ebc582cb18e76a84e45e36177..ff955a3314e883fe5b404dcce2d6dc3edb10d0dd 100644
--- a/ui/aura/window_event_dispatcher_unittest.cc
+++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -807,6 +807,36 @@ TEST_F(WindowEventDispatcherTest, TouchMovesHeld) {
EXPECT_TRUE(recorder.events().empty());
}
+// Tests that mouse move event has a right location
+// when there isn't the target window
+TEST_F(WindowEventDispatcherTest, MouseEventWithoutTargetWindow) {
+ EventFilterRecorder recorder_first;
+ EventFilterRecorder recorder_second;
+
+ test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> window_first(CreateTestWindowWithDelegate(
+ &delegate, 1, gfx::Rect(20, 10, 10, 20), root_window()));
+ window_first->Show();
+ window_first->AddPreTargetHandler(&recorder_first);
+
+ scoped_ptr<aura::Window> window_second(CreateTestWindowWithDelegate(
+ &delegate, 2, gfx::Rect(20, 30, 10, 20), root_window()));
+ window_second->Show();
+ window_second->AddPreTargetHandler(&recorder_second);
+
+ const gfx::Point event_location(22, 33);
+ ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, 0,
+ 0);
+ DispatchEventUsingWindowDispatcher(&mouse);
+
+ EXPECT_TRUE(recorder_first.events().empty());
+ EXPECT_EQ("MOUSE_ENTERED MOUSE_MOVED",
+ EventTypesToString(recorder_second.events()));
+ ASSERT_EQ(2u, recorder_second.mouse_locations().size());
+ EXPECT_EQ(gfx::Point(2, 3).ToString(),
+ recorder_second.mouse_locations()[0].ToString());
+}
+
// Verifies that a direct call to ProcessedTouchEvent() with a
// TOUCH_PRESSED event does not cause a crash.
TEST_F(WindowEventDispatcherTest, CallToProcessedTouchEvent) {

Powered by Google App Engine
This is Rietveld 408576698