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")); |