Commit e7a1f07d authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make LayoutSelectionTest.CommitAppearanceIfNeededNotCrash simpler

This patch makes |LayoutSelectionTest.CommitAppearanceIfNeededNotCrash| simpler
for improving code health.

Change-Id: I3f0c930c31870968432c326207ec930a15eecbb1
Reviewed-on: https://chromium-review.googlesource.com/702118Reviewed-by: default avatarYoichi Osato <yoichio@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#506944}
parent cb8bb767
......@@ -379,24 +379,12 @@ TEST_F(LayoutSelectionTest, FirstLetterUpdateSeletion) {
}
TEST_F(LayoutSelectionTest, CommitAppearanceIfNeededNotCrash) {
SetBodyContent("<div id='host'><span>bar<span></div><div>baz</div>");
SetShadowContent("foo", "host");
UpdateAllLifecyclePhases();
// <div id='host'>
// #shadow-root
// foo
// <span>|bar</span>
// </div>
// <div>baz^</div>
// |span| is not in flat tree.
Node* const span =
ToElement(GetDocument().QuerySelector("#host")->firstChild());
DCHECK(span);
Node* const baz = GetDocument().body()->firstChild()->nextSibling();
DCHECK(baz);
Selection().SetSelection(SelectionInDOMTree::Builder()
.SetBaseAndExtent({baz, 1}, {span, 0})
.Build());
Selection().SetSelection(SetSelectionTextToBody(
"<div>"
"<template data-mode=open>foo</template>"
"<span>|bar<span>" // <span> is not appeared in flat tree.
"</div>"
"<div>baz^</div>"));
Selection().CommitAppearanceIfNeeded();
}
......
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