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

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

Issue 1668453002: Make empty selection behavior behave like Android EditText. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply code review and fix test Created 4 years, 11 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 e91eee8f9885e38fb5e7234c829d9f463453fbdb..46ce4ec0984266fb84cb538dd7c061fdd2fa5e92 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -1617,6 +1617,22 @@ TEST_F(WebViewTest, LongPressSelection)
EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data()));
}
+TEST_F(WebViewTest, LongPressEmptyTextarea)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_textarea.html"));
+
+ WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_textarea.html", true);
+ webView->resize(WebSize(500, 300));
+ webView->updateAllLifecyclePhases();
+ runPendingTasks();
+
+ WebString blanklinestextbox = WebString::fromUTF8("blanklinestextbox");
+ WebLocalFrameImpl* frame = toWebLocalFrameImpl(webView->mainFrame());
+
+ EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureLongPress, blanklinestextbox));
+ EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data()));
+}
+
TEST_F(WebViewTest, BlinkCaretOnTypingAfterLongPress)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("blink_caret_on_typing_after_long_press.html"));

Powered by Google App Engine
This is Rietveld 408576698