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 c4473e3b63d7bb1d1820d0663113dfb84a3fccc2..b3ddbb076d0669b78030aed848a9f34f4874d0a8 100644 |
| --- a/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp |
| +++ b/third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp |
| @@ -178,6 +178,24 @@ TEST_F(FrameSelectionTest, ModifyExtendWithFlatTree) |
| EXPECT_EQ(PositionInFlatTree(two, 3), visibleSelectionInFlatTree().end()); |
| } |
| +TEST_F(FrameSelectionTest, ModifyWithUserTriggered) |
| +{ |
| + setBodyContent("<div id=sample>abc</div>"); |
| + Element* sample = document().getElementById("sample"); |
| + const Position endOfText(sample->firstChild(), 3); |
| + selection().setSelection(VisibleSelection(endOfText)); |
| + |
| + EXPECT_FALSE(selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity, NotUserTriggered)) |
| + << "Selection.modify() returns false for user triggered call when selection isn't modified."; |
|
Xiaocheng
2016/08/05 01:51:25
non-user-triggered call
Reference: https://en.wik
yosin_UTC9
2016/08/05 04:03:12
Done
|
| + EXPECT_EQ(endOfText, selection().start()) |
| + << "Selection isn't modified"; |
| + |
| + EXPECT_TRUE(selection().modify(FrameSelection::AlterationMove, DirectionForward, CharacterGranularity, UserTriggered)) |
| + << "Selection.modify() returns true for user triggered call"; |
|
Xiaocheng
2016/08/05 01:51:25
ditto: user-triggered call
yosin_UTC9
2016/08/05 04:03:12
Done.
|
| + EXPECT_EQ(endOfText, selection().start()) |
| + << "Selection isn't modified"; |
| +} |
| + |
| TEST_F(FrameSelectionTest, MoveRangeSelectionTest) |
| { |
| // "Foo Bar Baz," |