Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Unified Diff: third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializerTest.cpp

Issue 1675163002: Rename ComposedTree to FlatTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializerTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializerTest.cpp b/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializerTest.cpp
index c0cad22cafe00eb8d4324ef9b33d1a744d09ac62..272bc18a9cdecfbea27855dc0594fa59556e27f1 100644
--- a/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializerTest.cpp
+++ b/third_party/WebKit/Source/core/editing/serializers/StyledMarkupSerializerTest.cpp
@@ -52,7 +52,7 @@ TEST_F(StyledMarkupSerializerTest, TextOnly)
setBodyContent(bodyContent);
const char* expectedResult = "<span style=\"display: inline !important; float: none;\">Hello world!</span>";
EXPECT_EQ(expectedResult, serialize<EditingStrategy>());
- EXPECT_EQ(expectedResult, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(expectedResult, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, BlockFormatting)
@@ -60,7 +60,7 @@ TEST_F(StyledMarkupSerializerTest, BlockFormatting)
const char* bodyContent = "<div>Hello world!</div>";
setBodyContent(bodyContent);
EXPECT_EQ(bodyContent, serialize<EditingStrategy>());
- EXPECT_EQ(bodyContent, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(bodyContent, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, FormControlInput)
@@ -69,7 +69,7 @@ TEST_F(StyledMarkupSerializerTest, FormControlInput)
setBodyContent(bodyContent);
const char* expectedResult = "<input value=\"foo\">";
EXPECT_EQ(expectedResult, serialize<EditingStrategy>());
- EXPECT_EQ(expectedResult, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(expectedResult, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, FormControlInputRange)
@@ -78,7 +78,7 @@ TEST_F(StyledMarkupSerializerTest, FormControlInputRange)
setBodyContent(bodyContent);
const char* expectedResult = "<input type=\"range\">";
EXPECT_EQ(expectedResult, serialize<EditingStrategy>());
- EXPECT_EQ(expectedResult, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(expectedResult, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, FormControlSelect)
@@ -86,7 +86,7 @@ TEST_F(StyledMarkupSerializerTest, FormControlSelect)
const char* bodyContent = "<select><option value=\"1\">one</option><option value=\"2\">two</option></select>";
setBodyContent(bodyContent);
EXPECT_EQ(bodyContent, serialize<EditingStrategy>());
- EXPECT_EQ(bodyContent, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(bodyContent, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, FormControlTextArea)
@@ -96,7 +96,7 @@ TEST_F(StyledMarkupSerializerTest, FormControlTextArea)
const char* expectedResult = "<textarea></textarea>";
EXPECT_EQ(expectedResult, serialize<EditingStrategy>())
<< "contents of TEXTAREA element should not be appeared.";
- EXPECT_EQ(expectedResult, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(expectedResult, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, HeadingFormatting)
@@ -104,7 +104,7 @@ TEST_F(StyledMarkupSerializerTest, HeadingFormatting)
const char* bodyContent = "<h4>Hello world!</h4>";
setBodyContent(bodyContent);
EXPECT_EQ(bodyContent, serialize<EditingStrategy>());
- EXPECT_EQ(bodyContent, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(bodyContent, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, InlineFormatting)
@@ -112,7 +112,7 @@ TEST_F(StyledMarkupSerializerTest, InlineFormatting)
const char* bodyContent = "<b>Hello world!</b>";
setBodyContent(bodyContent);
EXPECT_EQ(bodyContent, serialize<EditingStrategy>());
- EXPECT_EQ(bodyContent, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(bodyContent, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, Mixed)
@@ -120,7 +120,7 @@ TEST_F(StyledMarkupSerializerTest, Mixed)
const char* bodyContent = "<i>foo<b>bar</b>baz</i>";
setBodyContent(bodyContent);
EXPECT_EQ(bodyContent, serialize<EditingStrategy>());
- EXPECT_EQ(bodyContent, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(bodyContent, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, ShadowTreeDistributeOrder)
@@ -131,7 +131,7 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeDistributeOrder)
setShadowContent(shadowContent, "host");
EXPECT_EQ("<p id=\"host\"><b id=\"one\">11</b><b id=\"two\">22</b></p>", serialize<EditingStrategy>())
<< "00 and 33 aren't appeared since they aren't distributed.";
- EXPECT_EQ("<p id=\"host\"><a><b id=\"two\">22</b><b id=\"one\">11</b></a></p>", serialize<EditingInComposedTreeStrategy>())
+ EXPECT_EQ("<p id=\"host\"><a><b id=\"two\">22</b><b id=\"one\">11</b></a></p>", serialize<EditingInFlatTreeStrategy>())
<< "00 and 33 aren't appeared since they aren't distributed.";
}
@@ -143,7 +143,7 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeInput)
setShadowContent(shadowContent, "host");
EXPECT_EQ("<p id=\"host\"><b id=\"one\">11</b><b id=\"two\"><input value=\"22\"></b></p>", serialize<EditingStrategy>())
<< "00 and 33 aren't appeared since they aren't distributed.";
- EXPECT_EQ("<p id=\"host\"><a><b id=\"two\"><input value=\"22\"></b><b id=\"one\">11</b></a></p>", serialize<EditingInComposedTreeStrategy>())
+ EXPECT_EQ("<p id=\"host\"><a><b id=\"two\"><input value=\"22\"></b><b id=\"one\">11</b></a></p>", serialize<EditingInFlatTreeStrategy>())
<< "00 and 33 aren't appeared since they aren't distributed.";
}
@@ -158,7 +158,7 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeNested)
EXPECT_EQ("<p id=\"host\"><b id=\"one\">11</b><b id=\"two\">22</b></p>", serialize<EditingStrategy>())
<< "00 and 33 aren't appeared since they aren't distributed.";
- EXPECT_EQ("<p id=\"host\"><a><b id=\"two\">22</b><b id=\"host2\">NESTED</b><b id=\"one\">11</b></a></p>", serialize<EditingInComposedTreeStrategy>())
+ EXPECT_EQ("<p id=\"host\"><a><b id=\"two\">22</b><b id=\"host2\">NESTED</b><b id=\"one\">11</b></a></p>", serialize<EditingInFlatTreeStrategy>())
<< "00 and 33 aren't appeared since they aren't distributed.";
}
@@ -170,14 +170,14 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeInterchangedNewline)
setShadowContent(shadowContent, "host");
std::string resultFromDOMTree = serialize<EditingStrategy>(AnnotateForInterchange);
- std::string resultFromComposedTree = serialize<EditingInComposedTreeStrategy>(AnnotateForInterchange);
- size_t mismatchedIndex = mismatch(resultFromDOMTree, resultFromComposedTree);
+ std::string resultFromFlatTree = serialize<EditingInFlatTreeStrategy>(AnnotateForInterchange);
+ size_t mismatchedIndex = mismatch(resultFromDOMTree, resultFromFlatTree);
- // Note: We check difference between DOM tree result and composed tree
+ // Note: We check difference between DOM tree result and flat tree
// result, because results contain "style" attribute and this test
// doesn't care about actual value of "style" attribute.
EXPECT_EQ("/a>", resultFromDOMTree.substr(mismatchedIndex));
- EXPECT_EQ("div><br></div></a><br class=\"Apple-interchange-newline\">", resultFromComposedTree.substr(mismatchedIndex));
+ EXPECT_EQ("div><br></div></a><br class=\"Apple-interchange-newline\">", resultFromFlatTree.substr(mismatchedIndex));
}
TEST_F(StyledMarkupSerializerTest, StyleDisplayNone)
@@ -186,7 +186,7 @@ TEST_F(StyledMarkupSerializerTest, StyleDisplayNone)
setBodyContent(bodyContent);
const char* expectedResult = "<b>0022</b>";
EXPECT_EQ(expectedResult, serialize<EditingStrategy>());
- EXPECT_EQ(expectedResult, serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ(expectedResult, serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, StyleDisplayNoneAndNewLines)
@@ -194,7 +194,7 @@ TEST_F(StyledMarkupSerializerTest, StyleDisplayNoneAndNewLines)
const char* bodyContent = "<div style='display:none'>11</div>\n\n";
setBodyContent(bodyContent);
EXPECT_EQ("", serialize<EditingStrategy>());
- EXPECT_EQ("", serialize<EditingInComposedTreeStrategy>());
+ EXPECT_EQ("", serialize<EditingInFlatTreeStrategy>());
}
TEST_F(StyledMarkupSerializerTest, ShadowTreeStyle)
@@ -213,9 +213,9 @@ TEST_F(StyledMarkupSerializerTest, ShadowTreeStyle)
setShadowContent(shadowContent, "host");
one = document().getElementById("one");
text = toText(one->firstChild());
- PositionInComposedTree startICT(text, 0);
- PositionInComposedTree endICT(text, 2);
- const std::string& serializedICT = serializePart<EditingInComposedTreeStrategy>(startICT, endICT, AnnotateForInterchange);
+ PositionInFlatTree startICT(text, 0);
+ PositionInFlatTree endICT(text, 2);
+ const std::string& serializedICT = serializePart<EditingInFlatTreeStrategy>(startICT, endICT, AnnotateForInterchange);
EXPECT_EQ(serializedDOM, serializedICT);
}
@@ -238,9 +238,9 @@ TEST_F(StyledMarkupSerializerTest, AcrossShadow)
setShadowContent(shadowContent2, "host2");
one = document().getElementById("one");
two = document().getElementById("two");
- PositionInComposedTree startICT(toText(one->firstChild()), 0);
- PositionInComposedTree endICT(toText(two->firstChild()), 2);
- const std::string& serializedICT = serializePart<EditingInComposedTreeStrategy>(startICT, endICT, AnnotateForInterchange);
+ PositionInFlatTree startICT(toText(one->firstChild()), 0);
+ PositionInFlatTree endICT(toText(two->firstChild()), 2);
+ const std::string& serializedICT = serializePart<EditingInFlatTreeStrategy>(startICT, endICT, AnnotateForInterchange);
EXPECT_EQ(serializedDOM, serializedICT);
}
@@ -254,9 +254,9 @@ TEST_F(StyledMarkupSerializerTest, AcrossInvisibleElements)
Position startDOM = Position::firstPositionInNode(span1.get());
Position endDOM = Position::lastPositionInNode(span2.get());
EXPECT_EQ("", serializePart<EditingStrategy>(startDOM, endDOM));
- PositionInComposedTree startICT = PositionInComposedTree::firstPositionInNode(span1.get());
- PositionInComposedTree endICT = PositionInComposedTree::lastPositionInNode(span2.get());
- EXPECT_EQ("", serializePart<EditingInComposedTreeStrategy>(startICT, endICT));
+ PositionInFlatTree startICT = PositionInFlatTree::firstPositionInNode(span1.get());
+ PositionInFlatTree endICT = PositionInFlatTree::lastPositionInNode(span2.get());
+ EXPECT_EQ("", serializePart<EditingInFlatTreeStrategy>(startICT, endICT));
}
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698