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 d124ac45be723eae551ef135514992fcf0c9aad5..fed592a9d8a06db597bebbf1383e249a9ef901fa 100644 |
| --- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp |
| +++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp |
| @@ -293,4 +293,39 @@ TEST_F(FrameSelectionTest, SelectAllPreservesHandle) { |
| "after it."; |
| } |
| +TEST_F(FrameSelectionTest, SetSelectedRangePreservesHandle) { |
| + Text* text = appendTextNode("Hello, World!"); |
| + document().view()->updateAllLifecyclePhases(); |
| + selection().setSelection( |
| + SelectionInDOMTree::Builder() |
| + .setBaseAndExtent(Position(text, 0), Position(text, 5)) |
| + .setIsHandleVisible(false) |
| + .build()); |
| + EXPECT_FALSE(selection().isHandleVisible()); |
|
yosin_UTC9
2017/03/16 01:10:26
nit: Since other test covers this, we don't need t
Tima Vaisburd
2017/03/16 02:02:29
Done.
|
| + |
| + selection().setSelectedRange( |
| + EphemeralRange(Position(text, 0), Position(text, 12)), |
| + VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, 0); |
| + |
| + EXPECT_FALSE(selection().isHandleVisible()) |
| + << "If handles weren't present before" |
| + "setSelectedRange they shouldn't be present" |
| + "after it."; |
| + |
| + selection().setSelection( |
| + SelectionInDOMTree::Builder() |
| + .setBaseAndExtent(Position(text, 0), Position(text, 5)) |
| + .setIsHandleVisible(true) |
| + .build()); |
| + EXPECT_TRUE(selection().isHandleVisible()); |
|
yosin_UTC9
2017/03/16 01:10:26
nit: Since other test covers this, we don't need t
Tima Vaisburd
2017/03/16 02:02:29
Done.
|
| + |
| + selection().setSelectedRange( |
| + EphemeralRange(Position(text, 0), Position(text, 12)), |
| + VP_DEFAULT_AFFINITY, SelectionDirectionalMode::NonDirectional, 0); |
| + |
| + EXPECT_TRUE(selection().isHandleVisible()) |
| + << "If handles were present before" |
| + "selectSetSelectedRange they should be present after it."; |
| +} |
| + |
| } // namespace blink |