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

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

Issue 2247963002: Suppress drag and drop on links on touch screen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase mac result so it uses the expected txt shared by all platforms Created 4 years, 4 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 c542443721ecc9ea3c9f7e82fa981a181ebd2ffb..578439baa6270f3d33983580ee3afc11ec1bdbfb 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -1705,6 +1705,30 @@ TEST_F(WebViewTest, LongPressLink)
EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(event));
}
+TEST_F(WebViewTest, showContextMenuOnLongPressingLinks)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()),
+ WebString::fromUTF8("long_press_links_and_images.html"));
+
+ URLTestHelpers::registerMockedURLLoad(toKURL("http://www.test.com/foo.png"), "white-1x1.png");
+ WebViewImpl* webView = m_webViewHelper.initializeAndLoad(
+ m_baseURL + "long_press_links_and_images.html", true);
+
+ webView->settingsImpl()->setTouchDragDropEnabled(true);
+ webView->resize(WebSize(500, 300));
+ webView->updateAllLifecyclePhases();
+ runPendingTasks();
+
+ WebString anchorTagId = WebString::fromUTF8("anchorTag");
+ WebString imageTagId = WebString::fromUTF8("imageTag");
+
+ EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, anchorTagId));
+ EXPECT_STREQ("anchor contextmenu", webView->mainFrame()->document().title().utf8().data());
+
+ EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, imageTagId));
+ EXPECT_STREQ("image contextmenu", webView->mainFrame()->document().title().utf8().data());
+}
+
TEST_F(WebViewTest, LongPressEmptyEditableSelection)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()),

Powered by Google App Engine
This is Rietveld 408576698