Index: content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc |
diff --git a/content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc b/content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc |
index 901d61dfcc6732df843c151bdd5292ac5aceba85..ca6737a9678a09912a053afcc849dab1a0b72955 100644 |
--- a/content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc |
+++ b/content/browser/renderer_host/input/touch_selection_controller_client_aura_browsertest.cc |
@@ -309,6 +309,43 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, |
EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
} |
+// Tests that long-pressing on an empty textfield brings up the insertion handle |
+// and the quick menu. |
+IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, |
+ EmptyTextfieldInsertionOnLongPress) { |
+ // Set the test page up. |
+ ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/touch_selection.html")); |
+ InitSelectionController(); |
+ |
+ RenderWidgetHostViewAura* rwhva = GetRenderWidgetHostViewAura(); |
+ |
+ // Clear textfield contents. |
+ ASSERT_TRUE(EmptyTextfield()); |
tdresser
2016/07/14 12:13:40
It isn't immediately clear to me whether this is j
mohsen
2016/07/22 01:22:47
Renamed!
|
+ |
+ EXPECT_EQ(ui::TouchSelectionController::INACTIVE, |
+ rwhva->selection_controller()->active_status()); |
+ EXPECT_FALSE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
+ |
+ // Long-press inside the textfield and wait for the insertion handle. |
+ selection_controller_client()->InitWaitForSelectionEvent( |
+ ui::INSERTION_HANDLE_SHOWN); |
+ |
+ gfx::PointF point; |
+ ASSERT_TRUE(GetPointInsideTextfield(&point)); |
+ ui::GestureEventDetails long_press_details(ui::ET_GESTURE_LONG_PRESS); |
+ long_press_details.set_device_type(ui::GestureDeviceType::DEVICE_TOUCHSCREEN); |
+ ui::GestureEvent long_press(point.x(), point.y(), 0, ui::EventTimeForNow(), |
+ long_press_details); |
+ rwhva->OnGestureEvent(&long_press); |
+ |
+ selection_controller_client()->Wait(); |
+ |
+ // Check that insertion is active and the quick menu is showing. |
+ EXPECT_EQ(ui::TouchSelectionController::INSERTION_ACTIVE, |
+ rwhva->selection_controller()->active_status()); |
+ EXPECT_TRUE(ui::TouchSelectionMenuRunner::GetInstance()->IsRunning()); |
+} |
+ |
// Tests that the quick menu is hidden whenever a touch point is active. |
IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest, |
QuickMenuHiddenOnTouch) { |