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

[editing] Add test for CHECK failure in CreateMarkup

The change from bug 1002937 made this code trigger a CHECK failure in
CreateMarkupAlgorithm::CreateMarkup. It's fine now since it had to be
reverted because of bug 1161370, but adding test coverage will be useful
to avoid the problem when relanding the patch.

Bug: 1155665
Change-Id: I6f39eb7c29bc607fa41d662fedd48c63611d8377
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2632613Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Commit-Queue: Oriol Brufau <obrufau@igalia.com>
Cr-Commit-Position: refs/heads/master@{#844505}
parent 6a4d1ef4
......@@ -144,7 +144,7 @@ TEST_F(CompositeEditCommandTest,
}
TEST_F(CompositeEditCommandTest,
MoveParagraphContentsToNewBlockWithUAShadowDOM) {
MoveParagraphContentsToNewBlockWithUAShadowDOM1) {
SetBodyContent("<object contenteditable><input></object>");
base::RunLoop().RunUntilIdle();
......@@ -160,6 +160,23 @@ TEST_F(CompositeEditCommandTest,
GetDocument().body()->innerHTML());
}
TEST_F(CompositeEditCommandTest,
MoveParagraphContentsToNewBlockWithUAShadowDOM2) {
GetDocument().setDesignMode("on");
SetBodyContent("<span></span><button><meter></meter></button>");
SampleCommand& sample = *MakeGarbageCollected<SampleCommand>(GetDocument());
Element* button = GetDocument().QuerySelector("button");
Position pos = Position(button, 0);
EditingState editing_state;
// Should not crash
sample.MoveParagraphContentsToNewBlockIfNecessary(pos, &editing_state);
EXPECT_FALSE(editing_state.IsAborted());
EXPECT_EQ("<div></div><span></span><button><meter></meter></button>",
GetDocument().body()->innerHTML());
}
TEST_F(CompositeEditCommandTest, InsertNodeOnDisconnectedParent) {
SetBodyContent("<p><b></b></p>");
SampleCommand& sample = *MakeGarbageCollected<SampleCommand>(GetDocument());
......
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