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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 25336003: Use root window's coordinates when updating cursor in Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win-specific hack removed Created 7 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | ui/aura/test/test_cursor_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 120956067dfd1c1d085321b754cade3815f94ff7..d50f71a3de7d54c9ff087cfd36cbd30723e6bb30 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -678,6 +678,51 @@ TEST_F(RenderWidgetHostViewAuraTest, CursorVisibilityChange) {
cursor_client.RemoveObserver(view_);
}
+TEST_F(RenderWidgetHostViewAuraTest, UpdateCursorIfOverSelf) {
+ view_->InitAsChild(NULL);
+ aura::client::ParentWindowWithContext(
+ view_->GetNativeView(),
+ parent_view_->GetNativeView()->GetRootWindow(),
+ gfx::Rect());
+
+ // Note that all coordinates in this test are screen coordinates.
+ view_->SetBounds(gfx::Rect(60, 60, 100, 100));
+ view_->Show();
+
+ aura::test::TestCursorClient cursor_client(
+ parent_view_->GetNativeView()->GetRootWindow());
+
+ // Cursor is in the middle of the window.
+ cursor_client.reset_calls_to_set_cursor();
+ aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(110, 110));
+ view_->UpdateCursorIfOverSelf();
+ EXPECT_EQ(1, cursor_client.calls_to_set_cursor());
+
+ // Cursor is near the top of the window.
+ cursor_client.reset_calls_to_set_cursor();
+ aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(80, 65));
+ view_->UpdateCursorIfOverSelf();
+ EXPECT_EQ(1, cursor_client.calls_to_set_cursor());
+
+ // Cursor is near the bottom of the window.
+ cursor_client.reset_calls_to_set_cursor();
+ aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(159, 159));
+ view_->UpdateCursorIfOverSelf();
+ EXPECT_EQ(1, cursor_client.calls_to_set_cursor());
+
+ // Cursor is above the window.
+ cursor_client.reset_calls_to_set_cursor();
+ aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(67, 59));
+ view_->UpdateCursorIfOverSelf();
+ EXPECT_EQ(0, cursor_client.calls_to_set_cursor());
+
+ // Cursor is below the window.
+ cursor_client.reset_calls_to_set_cursor();
+ aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(161, 161));
+ view_->UpdateCursorIfOverSelf();
+ EXPECT_EQ(0, cursor_client.calls_to_set_cursor());
+}
+
scoped_ptr<cc::CompositorFrame> MakeGLFrame(float scale_factor,
gfx::Size size,
gfx::Rect damage) {
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | ui/aura/test/test_cursor_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698