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

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

Issue 2646963002: Stop dismissing selection handles when selection is kept (Closed)
Patch Set: rebased on amaralp@'s CLs Created 3 years, 10 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 498765c494f0557c0107431e90d662fa51c71d3e..0d35600aa9e55c5ffb0d7f06380f7ecccb613001 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -2344,6 +2344,39 @@ TEST_P(WebViewTest, LongPressSelection) {
EXPECT_EQ("testword", std::string(frame->selectionAsText().utf8().data()));
}
+TEST_P(WebViewTest, FinishComposingTextDoesNotDismissHandles) {
+ registerMockedHttpURLLoad("longpress_selection.html");
+
+ WebViewImpl* webView = m_webViewHelper.initializeAndLoad(
+ m_baseURL + "longpress_selection.html", true);
+ webView->resize(WebSize(500, 300));
+ webView->updateAllLifecyclePhases();
+ runPendingTasks();
+
+ WebString target = WebString::fromUTF8("target");
+ WebLocalFrameImpl* frame = webView->mainFrameImpl();
+ WebInputMethodController* activeInputMethodController =
+ frame->frameWidget()->getActiveWebInputMethodController();
+ EXPECT_TRUE(tapElementById(WebInputEvent::GestureTap, target));
+ WebVector<WebCompositionUnderline> emptyUnderlines;
+ frame->setEditableSelectionOffsets(8, 8);
+ EXPECT_TRUE(activeInputMethodController->setComposition(
+ "12345", emptyUnderlines, 8, 13));
+ EXPECT_TRUE(frame->frame()->inputMethodController().hasComposition());
+ EXPECT_EQ("", std::string(frame->selectionAsText().utf8().data()));
+ EXPECT_FALSE(frame->frame()->selection().isHandleVisible());
+
+ EXPECT_TRUE(tapElementById(WebInputEvent::GestureLongPress, target));
+ EXPECT_EQ("testword12345",
+ std::string(frame->selectionAsText().utf8().data()));
+ EXPECT_TRUE(frame->frame()->selection().isHandleVisible());
+
+ // Check that finishComposingText(KeepSelection) does not dismiss handles.
+ activeInputMethodController->finishComposingText(
+ WebInputMethodController::KeepSelection);
+ EXPECT_TRUE(frame->frame()->selection().isHandleVisible());
+}
+
#if !OS(MACOSX)
TEST_P(WebViewTest, TouchDoesntSelectEmptyTextarea) {
registerMockedHttpURLLoad("longpress_textarea.html");

Powered by Google App Engine
This is Rietveld 408576698