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

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

Issue 1471993002: Resume cursor blinking on closing context menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: robusted onContextMenuClosed() and fixed nits Created 5 years, 1 month 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/WebViewImpl.cpp ('k') | third_party/WebKit/public/web/WebView.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 393e0b5fc9e9d2aab5e6f32e175adc5830437a97..060d6f2ca05a4fbf926fe06265e1ef7b99423551 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -1638,6 +1638,39 @@ TEST_F(WebViewTest, BlinkCaretOnTypingAfterLongPress)
}
#endif
+TEST_F(WebViewTest, BlinkCaretOnClosingContextMenu)
+{
+ URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("form.html"));
+ WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "form.html", true);
+
+ webView->setInitialFocus(false);
+ runPendingTasks();
+
+ // We suspend caret blinking when pressing with mouse right button.
+ // Note that we do not send MouseUp event here since it will be consumed
+ // by the context menu once it shows up.
+ WebMouseEvent mouseEvent;
+ mouseEvent.button = WebMouseEvent::ButtonRight;
+ mouseEvent.x = 1;
+ mouseEvent.y = 1;
+ mouseEvent.clickCount = 1;
+ mouseEvent.type = WebInputEvent::MouseDown;
+ webView->handleInputEvent(mouseEvent);
+ runPendingTasks();
+
+ WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webView->mainFrame());
+ EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
+
+ // Caret blinking is still suspended after showing context menu.
+ webView->showContextMenu();
+ EXPECT_TRUE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
+
+ // Caret blinking will be resumed only after context menu is closed.
+ webView->didCloseContextMenu();
+
+ EXPECT_FALSE(mainFrame->frame()->selection().isCaretBlinkingSuspended());
+}
+
TEST_F(WebViewTest, SelectionOnReadOnlyInput)
{
URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("selection_readonly.html"));
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.cpp ('k') | third_party/WebKit/public/web/WebView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698