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

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

Issue 1845193002: Fix long-press image selection inside editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable Mac-only failure (Mac doesn't support long-press anyway) Created 4 years, 8 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 df46990a39ed03fd49bd3f684c52f7646d77f078..84ce55e9db36640247482db8fb6fc7717a5a33b5 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -1585,7 +1585,6 @@ TEST_F(WebViewTest, ClientTapHandlingNullWebViewClient)
localFrame->close();
}
-#if OS(ANDROID)
TEST_F(WebViewTest, LongPressSelection)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_selection.html"));
@@ -1605,6 +1604,7 @@ TEST_F(WebViewTest, LongPressSelection)
EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data()));
}
+#if !OS(MACOSX)
TEST_F(WebViewTest, LongPressEmptyTextarea)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_textarea.html"));
@@ -1620,6 +1620,25 @@ TEST_F(WebViewTest, LongPressEmptyTextarea)
EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, blanklinestextbox));
EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data()));
}
+#endif
+
+TEST_F(WebViewTest, LongPressImageTextarea)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("longpress_image_contenteditable.html"));
+
+ WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "longpress_image_contenteditable.html", true);
+ webView->resize(WebSize(500, 300));
+ webView->updateAllLifecyclePhases();
+ runPendingTasks();
+
+ WebString image = WebString::fromUTF8("purpleimage");
+
+ EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, image));
+ size_t location, length;
+ EXPECT_TRUE(toWebViewImpl(webView)->caretOrSelectionRange(&location, &length));
+ EXPECT_EQ(0UL, location);
+ EXPECT_EQ(1UL, length);
+}
TEST_F(WebViewTest, BlinkCaretOnTypingAfterLongPress)
{
@@ -1643,7 +1662,6 @@ TEST_F(WebViewTest, BlinkCaretOnTypingAfterLongPress)
webView->handleInputEvent(keyEvent);
EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
}
-#endif
TEST_F(WebViewTest, BlinkCaretOnClosingContextMenu)
{

Powered by Google App Engine
This is Rietveld 408576698