Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp |
| index 403316ed57e21e4963eb59e3782097ead5a75065..d124ac45be723eae551ef135514992fcf0c9aad5 100644 |
| --- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp |
| +++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp |
| @@ -56,6 +56,22 @@ Text* FrameSelectionTest::appendTextNode(const String& data) { |
| return text; |
| } |
| +TEST_F(FrameSelectionTest, FirstRange) { |
| + setBodyContent("<div id=sample>0123456789</div>abc"); |
| + Element* const sample = document().getElementById("sample"); |
| + Node* const text = sample->firstChild(); |
| + selection().setSelectedRange( |
| + EphemeralRange(Position(text, 3), Position(text, 6)), VP_DEFAULT_AFFINITY, |
| + SelectionDirectionalMode::NonDirectional, 0); |
| + sample->setAttribute(HTMLNames::styleAttr, "display:none"); |
| + // Move |VisibleSelection| before "abc". |
| + updateAllLifecyclePhases(); |
| + Range* const range = selection().firstRange(); |
| + EXPECT_EQ(Position(sample->nextSibling(), 0), range->startPosition()) |
|
yosin_UTC9
2017/03/03 10:36:18
Before this patch:
range->startPosition() == "012
|
| + << "firstRagne() should return current selection value"; |
| + EXPECT_EQ(Position(sample->nextSibling(), 0), range->endPosition()); |
| +} |
| + |
| TEST_F(FrameSelectionTest, SetValidSelection) { |
| Text* text = appendTextNode("Hello, World!"); |
| document().view()->updateAllLifecyclePhases(); |