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..f2c0b49a951f29be47656cb0fa766e23eb3e3ed4 100644 |
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp |
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp |
@@ -1638,6 +1638,37 @@ 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 left button. |
+ WebMouseEvent mouseEvent; |
+ mouseEvent.button = WebMouseEvent::ButtonLeft; |
+ mouseEvent.x = 1; |
+ mouseEvent.y = 1; |
+ mouseEvent.clickCount = 1; |
+ mouseEvent.type = WebInputEvent::MouseDown; |
aelias_OOO_until_Jul13
2015/11/25 03:48:46
Could you also send the MouseUp event for realism
Changwan Ryu
2015/11/26 00:01:47
Actually, MouseUp will be consumed by context menu
|
+ 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")); |