Commit 1aca7fb2 authored by Oriol Brufau's avatar Oriol Brufau Committed by Chromium LUCI CQ

[editing] Add SelectionModifier unit test for bug 1155342 and 1155309

Bug 1155342 was already fixed by r837219, but I didn't add a unit test
for SelectionModifier since the testcase that I had wasn't trivial.

However, turns out that bug 1155309 is a duplicate, but with a simpler
testcase which does seem a good fit for a unit test.

This new unit test would have crashed before r837219.

Bug: 1155342, 1155309
Change-Id: I52def532cf8eda92d6009e473d3a28ac4960cc2e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2596297Reviewed-by: default avatarXiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#837905}
parent 6b1eb330
......@@ -280,4 +280,16 @@ TEST_F(SelectionModifierTest, MoveCaretWithShadow) {
}
}
// For https://crbug.com/1155342 and https://crbug.com/1155309
TEST_F(SelectionModifierTest, PreviousParagraphOfObject) {
const SelectionInDOMTree selection =
SetSelectionTextToBody("<object>|</object>");
SelectionModifier modifier(GetFrame(), selection);
modifier.Modify(SelectionModifyAlteration::kMove,
SelectionModifyDirection::kBackward,
TextGranularity::kParagraph);
EXPECT_EQ("|<object></object>",
GetSelectionTextFromBody(modifier.Selection().AsSelection()));
}
} // namespace blink
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment