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

Unified Diff: ui/aura/window_event_dispatcher_unittest.cc

Issue 971753008: Do not show the mouse cursor when the display is rotated in TouchView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rotate_display
Patch Set: Created 5 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
« no previous file with comments | « ui/aura/window_event_dispatcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2af89578c02d30069b0b2e5b1db3c225fc42d640..2503107c4745c9f5398a0e99d8d8364c16c9057a 100644
--- a/ui/aura/window_event_dispatcher_unittest.cc
+++ b/ui/aura/window_event_dispatcher_unittest.cc
@@ -2540,4 +2540,36 @@ TEST_F(WindowEventDispatcherTest, TouchMovesMarkedWhenCausingScroll) {
root_window()->RemovePreTargetHandler(&recorder);
}
+
+// OnCursorMovedToRootLocation() is sometimes called instead of
+// WindowTreeHost::MoveCursorTo() when the cursor did not move but the
+// cursor's position in root coordinates has changed (e.g. when the displays's
+// scale factor changed). Test that hover effects are properly updated.
+TEST_F(WindowEventDispatcherTest, OnCursorMovedToRootLocationUpdatesHover) {
+ WindowEventDispatcher* dispatcher = host()->dispatcher();
+
+ scoped_ptr<Window> w(CreateNormalWindow(1, root_window(), nullptr));
+ w->SetBounds(gfx::Rect(20, 20, 20, 20));
+ w->Show();
+
+ // Move the cursor off of |w|.
+ dispatcher->OnCursorMovedToRootLocation(gfx::Point(100, 100));
+
+ EventFilterRecorder recorder;
+ w->AddPreTargetHandler(&recorder);
+ dispatcher->OnCursorMovedToRootLocation(gfx::Point(22, 22));
+ RunAllPendingInMessageLoop();
+ EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_MOUSE_ENTERED));
+ recorder.Reset();
+
+ // The cursor should not be over |w| after changing the device scale factor to
+ // 2x. A ET_MOUSE_EXITED event should have been sent to |w|.
+ test_screen()->SetDeviceScaleFactor(2.f);
+ dispatcher->OnCursorMovedToRootLocation(gfx::Point(11, 11));
+ RunAllPendingInMessageLoop();
+ EXPECT_TRUE(recorder.HasReceivedEvent(ui::ET_MOUSE_EXITED));
+
+ w->RemovePreTargetHandler(&recorder);
+}
+
} // namespace aura
« no previous file with comments | « ui/aura/window_event_dispatcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698