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

Unified Diff: content/browser/renderer_host/input/touch_selection_controller_unittest.cc

Issue 467303002: [Android] Perform haptic feedback after long press when appropriate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Hard event reset and refactor Created 6 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
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 6389c38a722b29282d5ee1de7dc8c867557c91eb..f14860c4891cb67ddc5996eac90ce5ba218e83b4 100644
--- a/content/browser/renderer_host/input/touch_selection_controller_unittest.cc
+++ b/content/browser/renderer_host/input/touch_selection_controller_unittest.cc
@@ -478,6 +478,25 @@ TEST_F(TouchSelectionControllerTest, SelectionBasic) {
EXPECT_EQ(gfx::PointF(), GetLastEventAnchor());
}
+TEST_F(TouchSelectionControllerTest, SelectionRepeatedLongPress) {
+ 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);
+ EXPECT_EQ(SELECTION_SHOWN, GetLastEventType());
+ EXPECT_EQ(start_rect.bottom_left(), GetLastEventAnchor());
+
+ // A long press triggering a new selection should re-send the SELECTION_SHOWN
+ // event notification.
+ start_rect.Offset(10, 10);
+ controller().OnLongPressEvent();
+ ChangeSelection(start_rect, visible, end_rect, visible);
+ EXPECT_EQ(SELECTION_SHOWN, GetLastEventType());
+ EXPECT_EQ(start_rect.bottom_left(), GetLastEventAnchor());
+}
+
TEST_F(TouchSelectionControllerTest, SelectionDragged) {
base::TimeTicks event_time = base::TimeTicks::Now();
controller().OnLongPressEvent();

Powered by Google App Engine
This is Rietveld 408576698