Index: content/browser/renderer_host/input/touch_selection_controller_unittest.cc |
diff --git a/content/browser/renderer_host/input/touch_selection_controller_unittest.cc b/content/browser/renderer_host/input/touch_selection_controller_unittest.cc |
index d5aabbb0a565a283bd030efc82afffd8e56a89fb..cfbd48ee6ac79f83ca7ca8c61d89f4662bb6cf69 100644 |
--- a/content/browser/renderer_host/input/touch_selection_controller_unittest.cc |
+++ b/content/browser/renderer_host/input/touch_selection_controller_unittest.cc |
@@ -652,4 +652,23 @@ TEST_F(TouchSelectionControllerTest, TemporarilyHidden) { |
EXPECT_TRUE(GetAndResetNeedsAnimate()); |
} |
+TEST_F(TouchSelectionControllerTest, SelectionClearOnTap) { |
+ gfx::RectF start_rect(5, 5, 0, 10); |
+ gfx::RectF end_rect(50, 5, 0, 10); |
+ bool visible = true; |
+ |
+ controller().OnLongPressEvent(); |
+ ChangeSelection(start_rect, visible, end_rect, visible); |
+ |
+ // Selection should not be cleared if the selection bounds have not changed. |
+ controller().OnTapEvent(); |
+ EXPECT_EQ(SELECTION_SHOWN, GetLastEventType()); |
+ EXPECT_EQ(start_rect.bottom_left(), GetLastEventAnchor()); |
+ |
+ controller().OnTapEvent(); |
+ ClearSelection(); |
+ EXPECT_EQ(SELECTION_CLEARED, GetLastEventType()); |
+ EXPECT_EQ(gfx::PointF(), GetLastEventAnchor()); |
+} |
+ |
} // namespace content |