summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ash/wm/window_manager_unittest.cc12
-rw-r--r--ui/views/corewm/compound_event_filter.cc8
-rw-r--r--ui/views/corewm/compound_event_filter_unittest.cc9
3 files changed, 18 insertions, 11 deletions
diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc
index 2b97e52..af21613 100644
--- a/ash/wm/window_manager_unittest.cc
+++ b/ash/wm/window_manager_unittest.cc
@@ -704,10 +704,10 @@ TEST_F(WindowManagerTest, AdditionalFilters) {
env_filter->RemoveHandler(f2.get());
}
-// A keypress and/or touch only hides the cursor on ChromeOS (crbug.com/304296).
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_WIN)
// We should show and hide the cursor in response to mouse and touch events as
-// requested.
+// requested. ChromeOS and Windows are the only platforms which hide the cursor
+// in response to touch (crbug.com/322250).
TEST_F(WindowManagerTest, UpdateCursorVisibility) {
aura::test::EventGenerator& generator = GetEventGenerator();
views::corewm::CursorManager* cursor_manager =
@@ -726,7 +726,11 @@ TEST_F(WindowManagerTest, UpdateCursorVisibility) {
EXPECT_TRUE(cursor_manager->IsCursorVisible());
EXPECT_TRUE(cursor_manager->IsMouseEventsEnabled());
}
+#endif // defined(OS_CHROMEOS) || defined(OS_WIN)
+#if defined(OS_CHROMEOS)
+// ChromeOS is the only platform for which the cursor is hidden on both
+// touch and keypress (crbug.com/304296).
TEST_F(WindowManagerTest, UpdateCursorVisibilityOnKeyEvent) {
aura::test::EventGenerator& generator = GetEventGenerator();
views::corewm::CursorManager* cursor_manager =
@@ -810,6 +814,6 @@ TEST_F(WindowManagerTest, TestCursorClientObserver) {
EXPECT_FALSE(observer_b.did_visibility_change());
EXPECT_TRUE(observer_a.is_cursor_visible());
}
-#endif
+#endif // defined(OS_CHROMEOS)
} // namespace ash
diff --git a/ui/views/corewm/compound_event_filter.cc b/ui/views/corewm/compound_event_filter.cc
index efeca5c..f5fa2a4 100644
--- a/ui/views/corewm/compound_event_filter.cc
+++ b/ui/views/corewm/compound_event_filter.cc
@@ -72,12 +72,12 @@ bool ShouldHideCursorOnKeyEvent(const ui::KeyEvent& event) {
// Returns true if the cursor should be hidden on touch events.
bool ShouldHideCursorOnTouch() {
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_WIN)
return true;
#else
- // Not necessary on windows as windows does it for us. If we do need this
- // funcionality on linux (non-chromeos) we need to make sure
- // CompoundEventFilter shows on the right root (it currently doesn't always).
+ // Linux Aura does not hide the cursor on touch by default.
+ // TODO(tdanderson): Change this if having consistency across
+ // all platforms which use Aura is desired.
return false;
#endif
}
diff --git a/ui/views/corewm/compound_event_filter_unittest.cc b/ui/views/corewm/compound_event_filter_unittest.cc
index 6b852e4..293e2d3 100644
--- a/ui/views/corewm/compound_event_filter_unittest.cc
+++ b/ui/views/corewm/compound_event_filter_unittest.cc
@@ -18,11 +18,11 @@
namespace {
-#if defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_WIN)
base::TimeDelta GetTime() {
return ui::EventTimeForNow();
}
-#endif // defined(OS_CHROMEOS)
+#endif // defined(OS_CHROMEOS) || defined(OS_WIN)
}
@@ -97,7 +97,10 @@ TEST_F(CompoundEventFilterTest, CursorVisibilityChange) {
dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit);
EXPECT_FALSE(cursor_client.IsCursorVisible());
}
+#endif // defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS) || defined(OS_WIN)
+// Touch only hides the cursor on ChromeOS and Windows (crbug.com/322250).
TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
scoped_ptr<CompoundEventFilter> compound_filter(new CompoundEventFilter);
aura::Env::GetInstance()->AddPreTargetHandler(compound_filter.get());
@@ -145,7 +148,7 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
EXPECT_FALSE(cursor_client.IsMouseEventsEnabled());
aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get());
}
-#endif // defined(OS_CHROMEOS)
+#endif // defined(OS_CHROMEOS) || defined(OS_WIN)
// Tests that if an event filter consumes a gesture, then it doesn't focus the
// window.