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

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

Issue 2024323002: Fixing Regression Bug where context menu doesn't appear on long press (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « third_party/WebKit/Source/web/WebSettingsImpl.cpp ('k') | third_party/WebKit/public/web/WebSettings.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9ec6c0639a806cfbbee22e5265a81b67437fc492..905d7365cc9cec5397c4eedc2e66a98e6d0254fb 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -1617,6 +1617,7 @@ TEST_F(WebViewTest, LongPressEmptyDiv)
WebString::fromUTF8("long_press_empty_div.html"));
WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_press_empty_div.html", true);
+ webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false);
webView->resize(WebSize(500, 300));
webView->updateAllLifecyclePhases();
runPendingTasks();
@@ -1630,12 +1631,33 @@ TEST_F(WebViewTest, LongPressEmptyDiv)
EXPECT_EQ(WebInputEventResult::NotHandled, webView->handleInputEvent(event));
}
+TEST_F(WebViewTest, LongPressEmptyDivAlwaysShow)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()),
+ WebString::fromUTF8("long_press_empty_div.html"));
+
+ WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_press_empty_div.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 = 250;
+ event.y = 150;
+
+ EXPECT_EQ(WebInputEventResult::HandledSystem, webView->handleInputEvent(event));
+}
+
TEST_F(WebViewTest, LongPressImage)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()),
WebString::fromUTF8("long_press_image.html"));
WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_press_image.html", true);
+ webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false);
webView->resize(WebSize(500, 300));
webView->updateAllLifecyclePhases();
runPendingTasks();
@@ -1655,6 +1677,7 @@ TEST_F(WebViewTest, LongPressVideo)
WebString::fromUTF8("long_press_video.html"));
WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_press_video.html", true);
+ webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false);
webView->resize(WebSize(500, 300));
webView->updateAllLifecyclePhases();
runPendingTasks();
@@ -1674,6 +1697,7 @@ TEST_F(WebViewTest, LongPressLink)
WebString::fromUTF8("long_press_link.html"));
WebViewImpl* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "long_press_link.html", true);
+ webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false);
webView->resize(WebSize(500, 300));
webView->updateAllLifecyclePhases();
runPendingTasks();
@@ -1694,6 +1718,7 @@ TEST_F(WebViewTest, LongPressEmptyEditableSelection)
WebViewImpl* webView = m_webViewHelper.initializeAndLoad(
m_baseURL + "long_press_empty_editable_selection.html", true);
+ webView->settingsImpl()->setAlwaysShowContextMenuOnTouch(false);
webView->resize(WebSize(500, 300));
webView->updateAllLifecyclePhases();
runPendingTasks();
« no previous file with comments | « third_party/WebKit/Source/web/WebSettingsImpl.cpp ('k') | third_party/WebKit/public/web/WebSettings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698