Commit 787285e1 authored by Mason Freed's avatar Mason Freed Committed by Chromium LUCI CQ

Remove CreateV0ShadowRootForTesting() usage from more tests

Bug: 966758,937746
Change-Id: I7315e4b9a1a818d470c31000c4b605270e22391c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580432
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Commit-Queue: Koji Ishii <kojii@chromium.org>
Reviewed-by: default avatarKoji Ishii <kojii@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835080}
parent 0ede9ad7
...@@ -229,11 +229,10 @@ TEST_F(TextFinderTest, FindTextNotFound) { ...@@ -229,11 +229,10 @@ TEST_F(TextFinderTest, FindTextNotFound) {
} }
TEST_F(TextFinderTest, FindTextInShadowDOM) { TEST_F(TextFinderTest, FindTextInShadowDOM) {
GetDocument().body()->setInnerHTML("<b>FOO</b><i>foo</i>"); GetDocument().body()->setInnerHTML("<b>FOO</b><i slot='bar'>foo</i>");
ShadowRoot& shadow_root = ShadowRoot& shadow_root =
GetDocument().body()->CreateV0ShadowRootForTesting(); GetDocument().body()->AttachShadowRootInternal(ShadowRootType::kOpen);
shadow_root.setInnerHTML( shadow_root.setInnerHTML("<slot name='bar'></slot><u>Foo</u><slot></slot>");
"<content select=\"i\"></content><u>Foo</u><content></content>");
Node* text_in_b_element = GetDocument().body()->firstChild()->firstChild(); Node* text_in_b_element = GetDocument().body()->firstChild()->firstChild();
Node* text_in_i_element = GetDocument().body()->lastChild()->firstChild(); Node* text_in_i_element = GetDocument().body()->lastChild()->firstChild();
Node* text_in_u_element = shadow_root.childNodes()->item(1)->firstChild(); Node* text_in_u_element = shadow_root.childNodes()->item(1)->firstChild();
...@@ -391,11 +390,10 @@ TEST_F(TextFinderTest, ScopeTextMatchesRepeated) { ...@@ -391,11 +390,10 @@ TEST_F(TextFinderTest, ScopeTextMatchesRepeated) {
} }
TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM) { TEST_F(TextFinderTest, ScopeTextMatchesWithShadowDOM) {
GetDocument().body()->setInnerHTML("<b>FOO</b><i>foo</i>"); GetDocument().body()->setInnerHTML("<b>FOO</b><i slot='bar'>foo</i>");
ShadowRoot& shadow_root = ShadowRoot& shadow_root =
GetDocument().body()->CreateV0ShadowRootForTesting(); GetDocument().body()->AttachShadowRootInternal(ShadowRootType::kOpen);
shadow_root.setInnerHTML( shadow_root.setInnerHTML("<slot name='bar'></slot><u>Foo</u><slot></slot>");
"<content select=\"i\"></content><u>Foo</u><content></content>");
Node* text_in_b_element = GetDocument().body()->firstChild()->firstChild(); Node* text_in_b_element = GetDocument().body()->firstChild()->firstChild();
Node* text_in_i_element = GetDocument().body()->lastChild()->firstChild(); Node* text_in_i_element = GetDocument().body()->lastChild()->firstChild();
Node* text_in_u_element = shadow_root.childNodes()->item(1)->firstChild(); Node* text_in_u_element = shadow_root.childNodes()->item(1)->firstChild();
......
...@@ -97,16 +97,6 @@ TEST_F(WebElementTest, ShadowRoot) { ...@@ -97,16 +97,6 @@ TEST_F(WebElementTest, ShadowRoot) {
EXPECT_TRUE(TestElement().ShadowRoot().IsNull()) EXPECT_TRUE(TestElement().ShadowRoot().IsNull())
<< "ShadowRoot() should not return a UA ShadowRoot."; << "ShadowRoot() should not return a UA ShadowRoot.";
{
InsertHTML("<div id=testElement></div>");
EXPECT_TRUE(TestElement().ShadowRoot().IsNull())
<< "No ShadowRoot initially.";
auto* element = GetDocument().getElementById("testElement");
element->CreateV0ShadowRootForTesting();
EXPECT_FALSE(TestElement().ShadowRoot().IsNull())
<< "Should return V0 ShadowRoot.";
}
{ {
InsertHTML("<span id=testElement></span>"); InsertHTML("<span id=testElement></span>");
EXPECT_TRUE(TestElement().ShadowRoot().IsNull()) EXPECT_TRUE(TestElement().ShadowRoot().IsNull())
......
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