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