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

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

Issue 2078143002: Make plugin elements return false from canStartSelection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix readonly-disabled-text-selection for changes in r401155 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..4dcc9624685ccc705c7dcbbd86030ba5b9b76e01 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -1651,6 +1651,52 @@ TEST_F(WebViewTest, LongPressEmptyDivAlwaysShow)
EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(event));
}
+TEST_F(WebViewTest, LongPressObject)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()),
+ WebString::fromUTF8("long_press_object.html"));
+
+ WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_press_object.html", true);
+ webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(true);
+ webView->resize(WebSize(500, 300));
+ webView->updateAllLifecyclePhases();
+ runPendingTasks();
+
+ WebGestureEvent event;
+ event.type = WebInputEvent::GestureLongPress;
+ event.sourceDevice = WebGestureDeviceTouchscreen;
+ event.x = 10;
+ event.y = 10;
+
+ EXPECT_NE(WebInputEventResult::HandledSystem, webView->handleInputEvent(event));
+
+ HTMLElement* element = toHTMLElement(webView->mainFrame()->document().getElementById("obj"));
+ EXPECT_FALSE(element->canStartSelection());
+}
+
+TEST_F(WebViewTest, LongPressObjectFallback)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()),
+ WebString::fromUTF8("long_press_object_fallback.html"));
+
+ WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_press_object_fallback.html", true);
+ webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(true);
+ webView->resize(WebSize(500, 300));
+ webView->updateAllLifecyclePhases();
+ runPendingTasks();
+
+ WebGestureEvent event;
+ event.type = WebInputEvent::GestureLongPress;
+ event.sourceDevice = WebGestureDeviceTouchscreen;
+ event.x = 10;
+ event.y = 10;
+
+ EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(event));
+
+ HTMLElement* element = toHTMLElement(webView->mainFrame()->document().getElementById("obj"));
+ EXPECT_TRUE(element->canStartSelection());
+}
+
TEST_F(WebViewTest, LongPressImage)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()),

Powered by Google App Engine
This is Rietveld 408576698