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

Make WhitespaceAttacherTest to use Element::AttachShadowRootInternal()

This patch changes |WhitespaceAttacherTest| to use |AttachShadowRootInternal()|
instead of |Element::attachShadow()| to avoid using script only functions for
improving code health.

Change-Id: I8b646df53a1316c2c987f7599a16573c75f82896
Reviewed-on: https://chromium-review.googlesource.com/1067566Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560990}
parent 34928ece
......@@ -14,20 +14,7 @@
namespace blink {
class WhitespaceAttacherTest : public PageTestBase {
protected:
ShadowRoot& AttachShadow(Element& host);
};
ShadowRoot& WhitespaceAttacherTest::AttachShadow(Element& host) {
ShadowRootInit init;
init.setMode("open");
ShadowRoot* shadow_root =
host.attachShadow(ToScriptStateForMainWorld(GetDocument().GetFrame()),
init, ASSERT_NO_EXCEPTION);
EXPECT_TRUE(shadow_root);
return *shadow_root;
}
class WhitespaceAttacherTest : public PageTestBase {};
TEST_F(WhitespaceAttacherTest, WhitespaceAfterReattachedBlock) {
GetDocument().body()->SetInnerHTMLFromString("<div id=block></div> ");
......@@ -205,7 +192,8 @@ TEST_F(WhitespaceAttacherTest, SlottedWhitespaceAfterReattachedBlock) {
Element* host = GetDocument().getElementById("host");
ASSERT_TRUE(host);
ShadowRoot& shadow_root = AttachShadow(*host);
ShadowRoot& shadow_root =
host->AttachShadowRootInternal(ShadowRootType::kOpen);
shadow_root.SetInnerHTMLFromString("<div id=block></div><slot></slot>");
GetDocument().View()->UpdateAllLifecyclePhases();
......@@ -231,7 +219,8 @@ TEST_F(WhitespaceAttacherTest, SlottedWhitespaceAfterReattachedInline) {
Element* host = GetDocument().getElementById("host");
ASSERT_TRUE(host);
ShadowRoot& shadow_root = AttachShadow(*host);
ShadowRoot& shadow_root =
host->AttachShadowRootInternal(ShadowRootType::kOpen);
shadow_root.SetInnerHTMLFromString("<span id=inline></span><slot></slot>");
GetDocument().View()->UpdateAllLifecyclePhases();
......@@ -418,7 +407,8 @@ TEST_F(WhitespaceAttacherTest, SlottedWhitespaceInsideDisplayContents) {
Element* host = GetDocument().getElementById("host");
ASSERT_TRUE(host);
ShadowRoot& shadow_root = AttachShadow(*host);
ShadowRoot& shadow_root =
host->AttachShadowRootInternal(ShadowRootType::kOpen);
shadow_root.SetInnerHTMLFromString(
"<span id=inline></span>"
"<div style='display:contents'><slot></slot></div>");
......
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