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

Unified Diff: content/browser/web_contents/touch_editable_impl_aura_browsertest.cc

Issue 963103003: Fix touch editing handles not shown after trying overscroll (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added test Created 5 years, 10 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 | « content/browser/web_contents/touch_editable_impl_aura.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/touch_editable_impl_aura_browsertest.cc
diff --git a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc
index 77b7318ba1081d7191ee505935f0a922f9bb6a29..32c03ef60b1ed3a8eaad31667bf440cc01c38e77 100644
--- a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc
+++ b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc
@@ -338,6 +338,75 @@ IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest,
}
IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest,
+ TestTouchSelectionWhenOverscrolling) {
+ ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/touch_selection.html"));
+ WebContentsImpl* web_contents =
+ static_cast<WebContentsImpl*>(shell()->web_contents());
+ RenderFrameHost* main_frame = web_contents->GetMainFrame();
+ WebContentsViewAura* view_aura = static_cast<WebContentsViewAura*>(
+ web_contents->GetView());
+ TestTouchEditableImplAura* touch_editable = new TestTouchEditableImplAura;
+ view_aura->SetTouchEditableForTest(touch_editable);
+ RenderWidgetHostViewAura* rwhva = static_cast<RenderWidgetHostViewAura*>(
+ web_contents->GetRenderWidgetHostView());
+ EXPECT_EQ(GetRenderWidgetHostViewAura(touch_editable), rwhva);
+
+ // Long press to select word.
+ ui::GestureEvent long_press(
+ 10,
+ 10,
+ 0,
+ ui::EventTimeForNow(),
+ ui::GestureEventDetails(ui::ET_GESTURE_LONG_PRESS));
+ touch_editable->Reset();
+ rwhva->OnGestureEvent(&long_press);
+ touch_editable->WaitForSelectionChangeCallback();
+
+ // Check if selection handles are showing.
+ EXPECT_TRUE(GetTouchSelectionController(touch_editable));
+
+ scoped_ptr<base::Value> value =
+ content::ExecuteScriptAndGetValue(main_frame, "get_selection()");
+ std::string selection;
+ value->GetAsString(&selection);
+ EXPECT_STREQ("Some", selection.c_str());
+
+ // Overscroll is preceded with a scroll. Handles should get hidden.
+ ui::GestureEvent scroll_begin(
+ 10,
+ 10,
+ 0,
+ ui::EventTimeForNow(),
+ ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_BEGIN, 0, 0));
+ rwhva->OnGestureEvent(&scroll_begin);
+ EXPECT_FALSE(GetTouchSelectionController(touch_editable));
+
+ // Then overscroll itself starts. Handles should remain hidden.
+ touch_editable->OverscrollStarted();
+ EXPECT_FALSE(GetTouchSelectionController(touch_editable));
+
+ // We might have multiple overscroll-starts in one overscroll session. Handles
+ // should still remain hidden.
+ touch_editable->OverscrollStarted();
+ EXPECT_FALSE(GetTouchSelectionController(touch_editable));
+
+ // An overscroll session ends with a single overscroll-complete. Handles
+ // should still remain hidden as the scroll is still in progress.
+ touch_editable->OverscrollCompleted();
+ EXPECT_FALSE(GetTouchSelectionController(touch_editable));
+
+ // And, finally an scroll-end. Handles should come back.
+ ui::GestureEvent scroll_end(
+ 10,
+ 10,
+ 0,
+ ui::EventTimeForNow(),
+ ui::GestureEventDetails(ui::ET_GESTURE_SCROLL_END));
+ rwhva->OnGestureEvent(&scroll_end);
+ EXPECT_TRUE(GetTouchSelectionController(touch_editable));
+}
+
+IN_PROC_BROWSER_TEST_F(TouchEditableImplAuraTest,
TouchSelectionOnLongPressTest) {
ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/touch_selection.html"));
WebContentsImpl* web_contents =
« no previous file with comments | « content/browser/web_contents/touch_editable_impl_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698