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

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 330613002: Copying text closes the keyboard and the text input gets unfocused, forcing virtual keyboard is get… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Removed FrameSelection changes and making use of existing APIs for serving the requirement. Created 6 years, 6 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 | « Source/web/WebRemoteFrameImpl.cpp ('k') | Source/web/tests/data/selection_collapse_to_end.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 7ec49c36674ca3ab4768b7464b26e7f0e0950cad..ce64974177f1518f3d232678e6dfa5cdc580a3cc 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -4277,6 +4277,29 @@ TEST_F(WebFrameTest, RemoveSpellingMarkers)
EXPECT_EQ(0U, document->markers().markersInRange(selectionRange.get(), DocumentMarker::Spelling).size());
}
+#if OS(ANDROID)
+TEST_F(WebFrameTest, selectionCollapseToEnd)
+{
+ registerMockedHttpURLLoad("select_collapse_to_end.html");
+ FrameTestHelpers::WebViewHelper webViewHelper;
+
+ WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame());
+ Document* document = frame->frame()->document();
+ Element* element = document->getElementById("target");
+ element->focus();
+ document->execCommand("InsertText", false, "This is a sample text");
+ const int selectionBeginOffset = 0;
+ const int selectionEndOffset = 5;
+ frame->selectRange(WebRange::fromDocumentRange(frame, selectionBeginOffset, selectionEndOffset));
+ frame->executeCommand(WebString::fromUTF8("Copy"), frame->document().focusedElement());
+ if (frame->setCaretSelectionFromRangeSelection()) {
+ WebRange range = frame->selectionRange();
+ EXPECT_EQ(5, range.startOffset());
+ EXPECT_EQ(5, range.endOffset());
+ }
+}
+#endif
+
TEST_F(WebFrameTest, MarkerHashIdentifiers) {
registerMockedHttpURLLoad("spell.html");
FrameTestHelpers::WebViewHelper webViewHelper;
« no previous file with comments | « Source/web/WebRemoteFrameImpl.cpp ('k') | Source/web/tests/data/selection_collapse_to_end.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698