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

Unified Diff: ui/touch_selection/touch_selection_controller_unittest.cc

Issue 2733603003: Tapping/longpressing should result in INSERTION_HANDLE_SHOWN (Closed)
Patch Set: removed InsertionNotResetByRepeatedTapOrPress Created 3 years, 9 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/touch_selection/touch_selection_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/touch_selection/touch_selection_controller_unittest.cc
diff --git a/ui/touch_selection/touch_selection_controller_unittest.cc b/ui/touch_selection/touch_selection_controller_unittest.cc
index 6093e1799805c22f4a28c9f63b5e2ca19a3e6730..9d59383729c5710d72fbd3623c44be40704cb533 100644
--- a/ui/touch_selection/touch_selection_controller_unittest.cc
+++ b/ui/touch_selection/touch_selection_controller_unittest.cc
@@ -255,6 +255,12 @@ TEST_F(TouchSelectionControllerTest, InsertionBasic) {
EXPECT_THAT(GetAndResetEvents(), ElementsAre(INSERTION_HANDLE_MOVED));
EXPECT_EQ(insertion_rect.bottom_left(), GetLastEventStart());
+ OnTapEvent();
+ insertion_rect.Offset(1, 0);
+ ChangeInsertion(insertion_rect, visible);
+ EXPECT_THAT(GetAndResetEvents(), ElementsAre(INSERTION_HANDLE_SHOWN));
+ EXPECT_EQ(insertion_rect.bottom_left(), GetLastEventStart());
+
ClearInsertion();
EXPECT_THAT(GetAndResetEvents(),
ElementsAre(INSERTION_HANDLE_CLEARED));
@@ -469,50 +475,6 @@ TEST_F(TouchSelectionControllerTest, InsertionTapped) {
INSERTION_HANDLE_DRAG_STOPPED));
}
-TEST_F(TouchSelectionControllerTest, InsertionNotResetByRepeatedTapOrPress) {
- base::TimeTicks event_time = base::TimeTicks::Now();
- OnTapEvent();
- SetDraggingEnabled(true);
-
- gfx::RectF anchor_rect(10, 0, 0, 10);
- bool visible = true;
- ChangeInsertion(anchor_rect, visible);
- EXPECT_THAT(GetAndResetEvents(),
- ElementsAre(INSERTION_HANDLE_SHOWN));
- EXPECT_EQ(anchor_rect.bottom_left(), GetLastEventStart());
-
- // Tapping again shouldn't reset the active insertion point.
- OnTapEvent();
- MockMotionEvent event(MockMotionEvent::ACTION_DOWN, event_time, 0, 0);
- EXPECT_TRUE(controller().WillHandleTouchEvent(event));
- EXPECT_THAT(GetAndResetEvents(), ElementsAre(INSERTION_HANDLE_DRAG_STARTED));
- EXPECT_EQ(anchor_rect.bottom_left(), GetLastEventStart());
-
- event = MockMotionEvent(MockMotionEvent::ACTION_UP, event_time, 0, 0);
- EXPECT_TRUE(controller().WillHandleTouchEvent(event));
- EXPECT_THAT(GetAndResetEvents(), ElementsAre(INSERTION_HANDLE_TAPPED,
- INSERTION_HANDLE_DRAG_STOPPED));
- EXPECT_EQ(anchor_rect.bottom_left(), GetLastEventStart());
-
- anchor_rect.Offset(5, 15);
- ChangeInsertion(anchor_rect, visible);
- EXPECT_THAT(GetAndResetEvents(), ElementsAre(INSERTION_HANDLE_MOVED));
- EXPECT_EQ(anchor_rect.bottom_left(), GetLastEventStart());
-
- // Pressing shouldn't reset the active insertion point.
- OnLongPressEvent();
- event = MockMotionEvent(MockMotionEvent::ACTION_DOWN, event_time, 0, 0);
- EXPECT_TRUE(controller().WillHandleTouchEvent(event));
- EXPECT_THAT(GetAndResetEvents(), ElementsAre(INSERTION_HANDLE_DRAG_STARTED));
- EXPECT_EQ(anchor_rect.bottom_left(), GetLastEventStart());
-
- event = MockMotionEvent(MockMotionEvent::ACTION_UP, event_time, 0, 0);
- EXPECT_TRUE(controller().WillHandleTouchEvent(event));
- EXPECT_THAT(GetAndResetEvents(), ElementsAre(INSERTION_HANDLE_TAPPED,
- INSERTION_HANDLE_DRAG_STOPPED));
- EXPECT_EQ(anchor_rect.bottom_left(), GetLastEventStart());
-}
-
TEST_F(TouchSelectionControllerTest, SelectionBasic) {
gfx::RectF start_rect(5, 5, 0, 10);
gfx::RectF end_rect(50, 5, 0, 10);
« no previous file with comments | « ui/touch_selection/touch_selection_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698