| 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..6b9fbdca608e83e6a90893e96db92d9289e69bc4 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
|
| @@ -151,7 +151,7 @@ class TouchSelectionControllerClientAuraTest : public ContentBrowserTest {
|
| return false;
|
| }
|
|
|
| - bool EmptyTextfield() { return ExecuteScript(shell(), "empty_textfield()"); }
|
| + bool ClearTextfield() { return ExecuteScript(shell(), "clear_textfield()"); }
|
|
|
| RenderWidgetHostViewAura* GetRenderWidgetHostViewAura() {
|
| return static_cast<RenderWidgetHostViewAura*>(
|
| @@ -282,7 +282,7 @@ IN_PROC_BROWSER_TEST_F(TouchSelectionControllerClientAuraTest,
|
| RenderWidgetHostViewAura* rwhva = GetRenderWidgetHostViewAura();
|
|
|
| // Clear textfield contents.
|
| - ASSERT_TRUE(EmptyTextfield());
|
| + ASSERT_TRUE(ClearTextfield());
|
|
|
| EXPECT_EQ(ui::TouchSelectionController::INACTIVE,
|
| rwhva->selection_controller()->active_status());
|
| @@ -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(ClearTextfield());
|
| +
|
| + 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) {
|
|
|