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

Unified Diff: third_party/WebKit/Source/web/tests/WebViewTest.cpp

Issue 2074093003: Fix more corner cases for empty touch selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix type assertion in WebViewTest Created 4 years, 6 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: third_party/WebKit/Source/web/tests/WebViewTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index 905d7365cc9cec5397c4eedc2e66a98e6d0254fb..28b4f6b7f9df22fecb1699511203aaedf2caaf60 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -1752,7 +1752,7 @@ TEST_F(WebViewTest, LongPressSelection)
}
#if !OS(MACOSX)
-TEST_F(WebViewTest, LongPressEmptyTextarea)
+TEST_F(WebViewTest, TouchDoesntSelectEmptyTextarea)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_textarea.html"));
@@ -1764,8 +1764,31 @@ TEST_F(WebViewTest, LongPressEmptyTextarea)
WebString blanklinestextbox = WebString::fromUTF8("blanklinestextbox");
WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
+ // Long-press on carriage returns.
EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, blanklinestextbox));
EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data()));
yosin_UTC9 2016/06/21 07:50:45 nit: I think you don't need to use |std::string()|
aelias_OOO_until_Jul13 2016/06/21 18:30:41 OK, all 4 changed.
+
+ // Double-tap on carriage returns.
+ WebGestureEvent event;
+ event.type = WebInputEvent::GestureTap;
+ event.sourceDevice = WebGestureDeviceTouchscreen;
+ event.x = 100;
+ event.y = 25;
+ event.data.tap.tapCount = 2;
+
+ webView->handleInputEvent(event);
+ EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data()));
yosin_UTC9 2016/06/21 07:50:45 nit: I think you don't need to use |std::string()|
+
+ HTMLTextAreaElement* textAreaElement = toHTMLTextAreaElement(webView->mainFrame()->document().getElementById(blanklinestextbox));
+ textAreaElement->setValue("hello");
+
+ // Long-press past last word of textbox.
+ EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, blanklinestextbox));
+ EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data()));
yosin_UTC9 2016/06/21 07:50:45 nit: I think you don't need to use |std::string()|
+
+ // Double-tap past last word of textbox.
+ webView->handleInputEvent(event);
+ EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data()));
yosin_UTC9 2016/06/21 07:50:45 nit: I think you don't need to use |std::string()|
}
#endif

Powered by Google App Engine
This is Rietveld 408576698