Commit 8e225510 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

[LayoutNG] Removed unused parameterization in NGOffsetMappingTest

Bug: 699017
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_layout_ng
Change-Id: I88f9753576e67f1ed5ff4f6ca8fbf52cac4bcda2
Reviewed-on: https://chromium-review.googlesource.com/1178755
Commit-Queue: Xiaocheng Hu <xiaochengh@chromium.org>
Commit-Queue: Emil A Eklund <eae@chromium.org>
Reviewed-by: default avatarEmil A Eklund <eae@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583840}
parent cf4073e5
...@@ -88,16 +88,6 @@ class NGOffsetMappingTest : public NGLayoutTest { ...@@ -88,16 +88,6 @@ class NGOffsetMappingTest : public NGLayoutTest {
FontCachePurgePreventer purge_preventer_; FontCachePurgePreventer purge_preventer_;
}; };
// TODO(layout-dev): Remove this unused parameterization.
class ParameterizedNGOffsetMappingTest
: public testing::WithParamInterface<bool>,
public NGOffsetMappingTest {
public:
ParameterizedNGOffsetMappingTest() {}
};
INSTANTIATE_TEST_CASE_P(All, ParameterizedNGOffsetMappingTest, testing::Bool());
#define TEST_UNIT(unit, type, owner, dom_start, dom_end, text_content_start, \ #define TEST_UNIT(unit, type, owner, dom_start, dom_end, text_content_start, \
text_content_end) \ text_content_end) \
EXPECT_EQ(type, unit.GetType()); \ EXPECT_EQ(type, unit.GetType()); \
...@@ -112,14 +102,14 @@ INSTANTIATE_TEST_CASE_P(All, ParameterizedNGOffsetMappingTest, testing::Bool()); ...@@ -112,14 +102,14 @@ INSTANTIATE_TEST_CASE_P(All, ParameterizedNGOffsetMappingTest, testing::Bool());
EXPECT_EQ(start, ranges.at(owner).first); \ EXPECT_EQ(start, ranges.at(owner).first); \
EXPECT_EQ(end, ranges.at(owner).second) EXPECT_EQ(end, ranges.at(owner).second)
TEST_P(ParameterizedNGOffsetMappingTest, StoredResult) { TEST_F(NGOffsetMappingTest, StoredResult) {
SetupHtml("t", "<div id=t>foo</div>"); SetupHtml("t", "<div id=t>foo</div>");
EXPECT_FALSE(IsOffsetMappingStored()); EXPECT_FALSE(IsOffsetMappingStored());
GetOffsetMapping(); GetOffsetMapping();
EXPECT_TRUE(IsOffsetMappingStored()); EXPECT_TRUE(IsOffsetMappingStored());
} }
TEST_P(ParameterizedNGOffsetMappingTest, NGInlineFormattingContextOf) { TEST_F(NGOffsetMappingTest, NGInlineFormattingContextOf) {
SetBodyInnerHTML( SetBodyInnerHTML(
"<div id=container>" "<div id=container>"
" foo" " foo"
...@@ -156,7 +146,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, NGInlineFormattingContextOf) { ...@@ -156,7 +146,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, NGInlineFormattingContextOf) {
NGInlineFormattingContextOf(Position(blah, 0))); NGInlineFormattingContextOf(Position(blah, 0)));
} }
TEST_P(ParameterizedNGOffsetMappingTest, OneTextNode) { TEST_F(NGOffsetMappingTest, OneTextNode) {
SetupHtml("t", "<div id=t>foo</div>"); SetupHtml("t", "<div id=t>foo</div>");
const Node* foo_node = layout_object_->GetNode(); const Node* foo_node = layout_object_->GetNode();
const NGOffsetMapping& result = GetOffsetMapping(); const NGOffsetMapping& result = GetOffsetMapping();
...@@ -219,7 +209,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, OneTextNode) { ...@@ -219,7 +209,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, OneTextNode) {
EXPECT_TRUE(IsAfterNonCollapsedContent(Position(foo_node, 3))); EXPECT_TRUE(IsAfterNonCollapsedContent(Position(foo_node, 3)));
} }
TEST_P(ParameterizedNGOffsetMappingTest, TwoTextNodes) { TEST_F(NGOffsetMappingTest, TwoTextNodes) {
SetupHtml("t", "<div id=t>foo<span id=s>bar</span></div>"); SetupHtml("t", "<div id=t>foo<span id=s>bar</span></div>");
const LayoutText* foo = ToLayoutText(layout_object_); const LayoutText* foo = ToLayoutText(layout_object_);
const LayoutText* bar = GetLayoutTextUnder("s"); const LayoutText* bar = GetLayoutTextUnder("s");
...@@ -287,7 +277,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, TwoTextNodes) { ...@@ -287,7 +277,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, TwoTextNodes) {
EXPECT_TRUE(IsAfterNonCollapsedContent(Position(bar_node, 3))); EXPECT_TRUE(IsAfterNonCollapsedContent(Position(bar_node, 3)));
} }
TEST_P(ParameterizedNGOffsetMappingTest, BRBetweenTextNodes) { TEST_F(NGOffsetMappingTest, BRBetweenTextNodes) {
SetupHtml("t", u"<div id=t>foo<br>bar</div>"); SetupHtml("t", u"<div id=t>foo<br>bar</div>");
const LayoutText* foo = ToLayoutText(layout_object_); const LayoutText* foo = ToLayoutText(layout_object_);
const LayoutText* br = ToLayoutText(foo->NextSibling()); const LayoutText* br = ToLayoutText(foo->NextSibling());
...@@ -342,7 +332,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, BRBetweenTextNodes) { ...@@ -342,7 +332,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, BRBetweenTextNodes) {
EXPECT_EQ(Position(bar_node, 0), GetLastPosition(4)); EXPECT_EQ(Position(bar_node, 0), GetLastPosition(4));
} }
TEST_P(ParameterizedNGOffsetMappingTest, OneTextNodeWithCollapsedSpace) { TEST_F(NGOffsetMappingTest, OneTextNodeWithCollapsedSpace) {
SetupHtml("t", "<div id=t>foo bar</div>"); SetupHtml("t", "<div id=t>foo bar</div>");
const Node* node = layout_object_->GetNode(); const Node* node = layout_object_->GetNode();
const NGOffsetMapping& result = GetOffsetMapping(); const NGOffsetMapping& result = GetOffsetMapping();
...@@ -415,7 +405,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, OneTextNodeWithCollapsedSpace) { ...@@ -415,7 +405,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, OneTextNodeWithCollapsedSpace) {
EXPECT_TRUE(IsAfterNonCollapsedContent(Position(node, 8))); EXPECT_TRUE(IsAfterNonCollapsedContent(Position(node, 8)));
} }
TEST_P(ParameterizedNGOffsetMappingTest, FullyCollapsedWhiteSpaceNode) { TEST_F(NGOffsetMappingTest, FullyCollapsedWhiteSpaceNode) {
SetupHtml("t", SetupHtml("t",
"<div id=t>" "<div id=t>"
"<span id=s1>foo </span>" "<span id=s1>foo </span>"
...@@ -481,7 +471,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FullyCollapsedWhiteSpaceNode) { ...@@ -481,7 +471,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FullyCollapsedWhiteSpaceNode) {
StartOfNextNonCollapsedContent(Position(space_node, 0u)).IsNull()); StartOfNextNonCollapsedContent(Position(space_node, 0u)).IsNull());
} }
TEST_P(ParameterizedNGOffsetMappingTest, ReplacedElement) { TEST_F(NGOffsetMappingTest, ReplacedElement) {
SetupHtml("t", "<div id=t>foo <img> bar</div>"); SetupHtml("t", "<div id=t>foo <img> bar</div>");
const LayoutText* foo = ToLayoutText(layout_object_); const LayoutText* foo = ToLayoutText(layout_object_);
const LayoutObject* img = foo->NextSibling(); const LayoutObject* img = foo->NextSibling();
...@@ -538,7 +528,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, ReplacedElement) { ...@@ -538,7 +528,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, ReplacedElement) {
EXPECT_EQ(Position(bar_node, 0), GetLastPosition(5)); EXPECT_EQ(Position(bar_node, 0), GetLastPosition(5));
} }
TEST_P(ParameterizedNGOffsetMappingTest, FirstLetter) { TEST_F(NGOffsetMappingTest, FirstLetter) {
SetupHtml("t", SetupHtml("t",
"<style>div:first-letter{color:red}</style>" "<style>div:first-letter{color:red}</style>"
"<div id=t>foo</div>"); "<div id=t>foo</div>");
...@@ -568,7 +558,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FirstLetter) { ...@@ -568,7 +558,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FirstLetter) {
EXPECT_EQ(Position(foo_node, 1), GetLastPosition(1)); EXPECT_EQ(Position(foo_node, 1), GetLastPosition(1));
} }
TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterWithLeadingSpace) { TEST_F(NGOffsetMappingTest, FirstLetterWithLeadingSpace) {
SetupHtml("t", SetupHtml("t",
"<style>div:first-letter{color:red}</style>" "<style>div:first-letter{color:red}</style>"
"<div id=t> foo</div>"); "<div id=t> foo</div>");
...@@ -604,7 +594,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterWithLeadingSpace) { ...@@ -604,7 +594,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterWithLeadingSpace) {
EXPECT_EQ(Position(foo_node, 2), GetLastPosition(0)); EXPECT_EQ(Position(foo_node, 2), GetLastPosition(0));
} }
TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterWithoutRemainingText) { TEST_F(NGOffsetMappingTest, FirstLetterWithoutRemainingText) {
SetupHtml("t", SetupHtml("t",
"<style>div:first-letter{color:red}</style>" "<style>div:first-letter{color:red}</style>"
"<div id=t> f</div>"); "<div id=t> f</div>");
...@@ -635,7 +625,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterWithoutRemainingText) { ...@@ -635,7 +625,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterWithoutRemainingText) {
EXPECT_EQ(Position(text_node, 2), GetLastPosition(0)); EXPECT_EQ(Position(text_node, 2), GetLastPosition(0));
} }
TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterInDifferentBlock) { TEST_F(NGOffsetMappingTest, FirstLetterInDifferentBlock) {
SetupHtml("t", SetupHtml("t",
"<style>:first-letter{float:right}</style><div id=t>foo</div>"); "<style>:first-letter{float:right}</style><div id=t>foo</div>");
Element* div = GetDocument().getElementById("t"); Element* div = GetDocument().getElementById("t");
...@@ -699,7 +689,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterInDifferentBlock) { ...@@ -699,7 +689,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, FirstLetterInDifferentBlock) {
EXPECT_EQ(Position(text_node, 1), remaining_text_result.GetLastPosition(1)); EXPECT_EQ(Position(text_node, 1), remaining_text_result.GetLastPosition(1));
} }
TEST_P(ParameterizedNGOffsetMappingTest, WhiteSpaceTextNodeWithoutLayoutText) { TEST_F(NGOffsetMappingTest, WhiteSpaceTextNodeWithoutLayoutText) {
SetupHtml("t", "<div id=t> <span>foo</span></div>"); SetupHtml("t", "<div id=t> <span>foo</span></div>");
Element* div = GetDocument().getElementById("t"); Element* div = GetDocument().getElementById("t");
const Node* text_node = div->firstChild(); const Node* text_node = div->firstChild();
...@@ -708,8 +698,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, WhiteSpaceTextNodeWithoutLayoutText) { ...@@ -708,8 +698,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, WhiteSpaceTextNodeWithoutLayoutText) {
EXPECT_TRUE(StartOfNextNonCollapsedContent(Position(text_node, 0u)).IsNull()); EXPECT_TRUE(StartOfNextNonCollapsedContent(Position(text_node, 0u)).IsNull());
} }
TEST_P(ParameterizedNGOffsetMappingTest, TEST_F(NGOffsetMappingTest, OneContainerWithLeadingAndTrailingSpaces) {
OneContainerWithLeadingAndTrailingSpaces) {
SetupHtml("t", "<div id=t><span id=s> foo </span></div>"); SetupHtml("t", "<div id=t><span id=s> foo </span></div>");
const Node* span = GetElementById("s"); const Node* span = GetElementById("s");
const Node* text = span->firstChild(); const Node* text = span->firstChild();
...@@ -733,7 +722,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, ...@@ -733,7 +722,7 @@ TEST_P(ParameterizedNGOffsetMappingTest,
EXPECT_EQ(3u, *GetTextContentOffset(Position::AfterNode(*span))); EXPECT_EQ(3u, *GetTextContentOffset(Position::AfterNode(*span)));
} }
TEST_P(ParameterizedNGOffsetMappingTest, ContainerWithGeneratedContent) { TEST_F(NGOffsetMappingTest, ContainerWithGeneratedContent) {
SetupHtml("t", SetupHtml("t",
"<style>#s::before{content:'bar'} #s::after{content:'baz'}</style>" "<style>#s::before{content:'bar'} #s::after{content:'baz'}</style>"
"<div id=t><span id=s>foo</span></div>"); "<div id=t><span id=s>foo</span></div>");
...@@ -755,7 +744,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, ContainerWithGeneratedContent) { ...@@ -755,7 +744,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, ContainerWithGeneratedContent) {
EXPECT_EQ(6u, *GetTextContentOffset(Position::AfterNode(*span))); EXPECT_EQ(6u, *GetTextContentOffset(Position::AfterNode(*span)));
} }
TEST_P(ParameterizedNGOffsetMappingTest, Table) { TEST_F(NGOffsetMappingTest, Table) {
SetupHtml("t", "<table><tr><td id=t> foo </td></tr></table>"); SetupHtml("t", "<table><tr><td id=t> foo </td></tr></table>");
const Node* foo_node = layout_object_->GetNode(); const Node* foo_node = layout_object_->GetNode();
...@@ -775,7 +764,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, Table) { ...@@ -775,7 +764,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, Table) {
TEST_RANGE(result.GetRanges(), foo_node, 0u, 3u); TEST_RANGE(result.GetRanges(), foo_node, 0u, 3u);
} }
TEST_P(ParameterizedNGOffsetMappingTest, GetMappingForInlineBlock) { TEST_F(NGOffsetMappingTest, GetMappingForInlineBlock) {
SetupHtml("t", SetupHtml("t",
"<div id=t>foo" "<div id=t>foo"
"<span style='display: inline-block' id=span> bar </span>" "<span style='display: inline-block' id=span> bar </span>"
...@@ -803,7 +792,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, GetMappingForInlineBlock) { ...@@ -803,7 +792,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, GetMappingForInlineBlock) {
EXPECT_NE(span_mapping, span_after_mapping); EXPECT_NE(span_mapping, span_after_mapping);
} }
TEST_P(ParameterizedNGOffsetMappingTest, NoWrapSpaceAndCollapsibleSpace) { TEST_F(NGOffsetMappingTest, NoWrapSpaceAndCollapsibleSpace) {
SetupHtml("t", SetupHtml("t",
"<div id=t>" "<div id=t>"
"<span style='white-space: nowrap' id=span>foo </span>" "<span style='white-space: nowrap' id=span>foo </span>"
...@@ -828,7 +817,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, NoWrapSpaceAndCollapsibleSpace) { ...@@ -828,7 +817,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, NoWrapSpaceAndCollapsibleSpace) {
4u, 5u, 8u); 4u, 5u, 8u);
} }
TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPreLine) { TEST_F(NGOffsetMappingTest, BiDiAroundForcedBreakInPreLine) {
SetupHtml("t", SetupHtml("t",
"<div id=t style='white-space: pre-line'>" "<div id=t style='white-space: pre-line'>"
"<bdo dir=rtl id=bdo>foo\nbar</bdo></div>"); "<bdo dir=rtl id=bdo>foo\nbar</bdo></div>");
...@@ -852,7 +841,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPreLine) { ...@@ -852,7 +841,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPreLine) {
TEST_RANGE(mapping.GetRanges(), text, 0u, 3u); TEST_RANGE(mapping.GetRanges(), text, 0u, 3u);
} }
TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPreWrap) { TEST_F(NGOffsetMappingTest, BiDiAroundForcedBreakInPreWrap) {
SetupHtml("t", SetupHtml("t",
"<div id=t style='white-space: pre-wrap'>" "<div id=t style='white-space: pre-wrap'>"
"<bdo dir=rtl id=bdo>foo\nbar</bdo></div>"); "<bdo dir=rtl id=bdo>foo\nbar</bdo></div>");
...@@ -876,7 +865,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPreWrap) { ...@@ -876,7 +865,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPreWrap) {
TEST_RANGE(mapping.GetRanges(), text, 0u, 3u); TEST_RANGE(mapping.GetRanges(), text, 0u, 3u);
} }
TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPre) { TEST_F(NGOffsetMappingTest, BiDiAroundForcedBreakInPre) {
SetupHtml("t", SetupHtml("t",
"<div id=t style='white-space: pre'>" "<div id=t style='white-space: pre'>"
"<bdo dir=rtl id=bdo>foo\nbar</bdo></div>"); "<bdo dir=rtl id=bdo>foo\nbar</bdo></div>");
...@@ -900,7 +889,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPre) { ...@@ -900,7 +889,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, BiDiAroundForcedBreakInPre) {
TEST_RANGE(mapping.GetRanges(), text, 0u, 3u); TEST_RANGE(mapping.GetRanges(), text, 0u, 3u);
} }
TEST_P(ParameterizedNGOffsetMappingTest, SoftHyphen) { TEST_F(NGOffsetMappingTest, SoftHyphen) {
LoadAhem(); LoadAhem();
SetupHtml( SetupHtml(
"t", "t",
...@@ -916,7 +905,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, SoftHyphen) { ...@@ -916,7 +905,7 @@ TEST_P(ParameterizedNGOffsetMappingTest, SoftHyphen) {
TEST_RANGE(mapping.GetRanges(), text, 0u, 1u); TEST_RANGE(mapping.GetRanges(), text, 0u, 1u);
} }
TEST_P(ParameterizedNGOffsetMappingTest, TextOverflowEllipsis) { TEST_F(NGOffsetMappingTest, TextOverflowEllipsis) {
LoadAhem(); LoadAhem();
SetupHtml("t", SetupHtml("t",
"<div id=t style='font: 10px/10px Ahem; width: 30px; overflow: " "<div id=t style='font: 10px/10px Ahem; width: 30px; overflow: "
......
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