Commit 1f8c4dcb authored by Yoshifumi Inoue's avatar Yoshifumi Inoue Committed by Commit Bot

Make ApplyRulesetsTest to use Element::AttachShadowRootInternal()

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

Change-Id: Iafe926240feca77ee87b345aa0688398db119110
Reviewed-on: https://chromium-review.googlesource.com/1067565Reviewed-by: default avatarHayato Ito <hayato@chromium.org>
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560973}
parent b845d098
...@@ -34,20 +34,7 @@ class ActiveStyleSheetsTest : public PageTestBase { ...@@ -34,20 +34,7 @@ class ActiveStyleSheetsTest : public PageTestBase {
} }
}; };
class ApplyRulesetsTest : public ActiveStyleSheetsTest { class ApplyRulesetsTest : public ActiveStyleSheetsTest {};
protected:
ShadowRoot& AttachShadow(Element& host);
};
ShadowRoot& ApplyRulesetsTest::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;
}
TEST_F(ActiveStyleSheetsTest, CompareActiveStyleSheets_NoChange) { TEST_F(ActiveStyleSheetsTest, CompareActiveStyleSheets_NoChange) {
ActiveStyleSheetVector old_sheets; ActiveStyleSheetVector old_sheets;
...@@ -451,7 +438,8 @@ TEST_F(ApplyRulesetsTest, AddUniversalRuleToShadowTree) { ...@@ -451,7 +438,8 @@ TEST_F(ApplyRulesetsTest, AddUniversalRuleToShadowTree) {
Element* host = GetElementById("host"); Element* host = GetElementById("host");
ASSERT_TRUE(host); ASSERT_TRUE(host);
ShadowRoot& shadow_root = AttachShadow(*host); ShadowRoot& shadow_root =
host->AttachShadowRootInternal(ShadowRootType::kOpen);
UpdateAllLifecyclePhases(); UpdateAllLifecyclePhases();
CSSStyleSheet* sheet = CreateSheet("body * { color:red }"); CSSStyleSheet* sheet = CreateSheet("body * { color:red }");
...@@ -488,7 +476,8 @@ TEST_F(ApplyRulesetsTest, AddFontFaceRuleToShadowTree) { ...@@ -488,7 +476,8 @@ TEST_F(ApplyRulesetsTest, AddFontFaceRuleToShadowTree) {
Element* host = GetElementById("host"); Element* host = GetElementById("host");
ASSERT_TRUE(host); ASSERT_TRUE(host);
ShadowRoot& shadow_root = AttachShadow(*host); ShadowRoot& shadow_root =
host->AttachShadowRootInternal(ShadowRootType::kOpen);
UpdateAllLifecyclePhases(); UpdateAllLifecyclePhases();
CSSStyleSheet* sheet = CSSStyleSheet* sheet =
...@@ -512,7 +501,8 @@ TEST_F(ApplyRulesetsTest, RemoveSheetFromShadowTree) { ...@@ -512,7 +501,8 @@ TEST_F(ApplyRulesetsTest, RemoveSheetFromShadowTree) {
Element* host = GetElementById("host"); Element* host = GetElementById("host");
ASSERT_TRUE(host); ASSERT_TRUE(host);
ShadowRoot& shadow_root = AttachShadow(*host); ShadowRoot& shadow_root =
host->AttachShadowRootInternal(ShadowRootType::kOpen);
shadow_root.SetInnerHTMLFromString( shadow_root.SetInnerHTMLFromString(
"<style>::slotted(#dummy){color:pink}</style>"); "<style>::slotted(#dummy){color:pink}</style>");
UpdateAllLifecyclePhases(); UpdateAllLifecyclePhases();
......
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