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

Unified Diff: ui/views/corewm/compound_event_filter_unittest.cc

Issue 22051002: Don't show cursor on mouse enter/exit as they can be generated when host window is created/removed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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/views/corewm/compound_event_filter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/corewm/compound_event_filter_unittest.cc
diff --git a/ui/views/corewm/compound_event_filter_unittest.cc b/ui/views/corewm/compound_event_filter_unittest.cc
index e179bde98c92bfb0933ef1e592b5c67315a5c035..9d8bd5ac1dd6a3162acd4f0d60832958f2afd30d 100644
--- a/ui/views/corewm/compound_event_filter_unittest.cc
+++ b/ui/views/corewm/compound_event_filter_unittest.cc
@@ -48,6 +48,45 @@ class ConsumeGestureEventFilter : public ui::EventHandler {
typedef aura::test::AuraTestBase CompoundEventFilterTest;
+TEST_F(CompoundEventFilterTest, CursorVisibilityChange) {
+ scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
+ aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
+ aura::test::TestWindowDelegate delegate;
+ scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(&delegate, 1234,
+ gfx::Rect(5, 5, 100, 100), root_window()));
+ window->Show();
+ window->SetCapture();
+
+ aura::test::TestCursorClient cursor_client(root_window());
+
+ // Send key event to hide the cursor.
+ ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, true);
+ root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key);
+ EXPECT_FALSE(cursor_client.IsCursorVisible());
+
+ // Mouse enter event should not show the cursor.
+ ui::MouseEvent enter(ui::ET_MOUSE_ENTERED, gfx::Point(10, 10),
+ gfx::Point(10, 10), 0);
+ root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&enter);
+ EXPECT_FALSE(cursor_client.IsCursorVisible());
+
+ // Mouse move event will show the cursor.
+ ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
+ gfx::Point(10, 10), 0);
+ root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&move);
+ EXPECT_TRUE(cursor_client.IsCursorVisible());
+
+ // Send key event to hide the cursor again.
+ root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key);
+ EXPECT_FALSE(cursor_client.IsCursorVisible());
+
+ // Mouse exit event should not show the cursor.
+ ui::MouseEvent exit(ui::ET_MOUSE_EXITED, gfx::Point(10, 10),
+ gfx::Point(10, 10), 0);
+ root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit);
+ EXPECT_FALSE(cursor_client.IsCursorVisible());
+}
+
TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
« no previous file with comments | « ui/views/corewm/compound_event_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698