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

Side by Side Diff: third_party/WebKit/Source/core/dom/shadow/FlatTreeTraversalTest.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/shadow/ComposedTreeTraversal.h" 5 #include "core/dom/shadow/FlatTreeTraversal.h"
6 6
7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/Element.h" 9 #include "core/dom/Element.h"
10 #include "core/dom/Node.h" 10 #include "core/dom/Node.h"
11 #include "core/dom/NodeTraversal.h" 11 #include "core/dom/NodeTraversal.h"
12 #include "core/dom/shadow/ShadowRoot.h" 12 #include "core/dom/shadow/ShadowRoot.h"
13 #include "core/frame/FrameView.h" 13 #include "core/frame/FrameView.h"
14 #include "core/html/HTMLDocument.h" 14 #include "core/html/HTMLDocument.h"
15 #include "core/html/HTMLElement.h" 15 #include "core/html/HTMLElement.h"
16 #include "core/testing/DummyPageHolder.h" 16 #include "core/testing/DummyPageHolder.h"
17 #include "platform/geometry/IntSize.h" 17 #include "platform/geometry/IntSize.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "wtf/Compiler.h" 19 #include "wtf/Compiler.h"
20 #include "wtf/OwnPtr.h" 20 #include "wtf/OwnPtr.h"
21 #include "wtf/PassRefPtr.h" 21 #include "wtf/PassRefPtr.h"
22 #include "wtf/RefPtr.h" 22 #include "wtf/RefPtr.h"
23 #include "wtf/StdLibExtras.h" 23 #include "wtf/StdLibExtras.h"
24 #include "wtf/Vector.h" 24 #include "wtf/Vector.h"
25 25
26 namespace blink { 26 namespace blink {
27 27
28 class ComposedTreeTraversalTest : public ::testing::Test { 28 class FlatTreeTraversalTest : public ::testing::Test {
29 protected: 29 protected:
30 HTMLDocument& document() const; 30 HTMLDocument& document() const;
31 31
32 // Sets |mainHTML| to BODY element with |innerHTML| property and attaches 32 // Sets |mainHTML| to BODY element with |innerHTML| property and attaches
33 // shadow root to child with |shadowHTML|, then update distribution for 33 // shadow root to child with |shadowHTML|, then update distribution for
34 // calling member functions in |ComposedTreeTraversal|. 34 // calling member functions in |FlatTreeTraversal|.
35 void setupSampleHTML(const char* mainHTML, const char* shadowHTML, unsigned) ; 35 void setupSampleHTML(const char* mainHTML, const char* shadowHTML, unsigned) ;
36 36
37 void setupDocumentTree(const char* mainHTML); 37 void setupDocumentTree(const char* mainHTML);
38 38
39 void attachV0ShadowRoot(Element& shadowHost, const char* shadowInnerHTML); 39 void attachV0ShadowRoot(Element& shadowHost, const char* shadowInnerHTML);
40 void attachOpenShadowRoot(Element& shadowHost, const char* shadowInnerHTML); 40 void attachOpenShadowRoot(Element& shadowHost, const char* shadowInnerHTML);
41 41
42 private: 42 private:
43 void SetUp() override; 43 void SetUp() override;
44 44
45 RefPtrWillBePersistent<HTMLDocument> m_document; 45 RefPtrWillBePersistent<HTMLDocument> m_document;
46 OwnPtr<DummyPageHolder> m_dummyPageHolder; 46 OwnPtr<DummyPageHolder> m_dummyPageHolder;
47 }; 47 };
48 48
49 void ComposedTreeTraversalTest::SetUp() 49 void FlatTreeTraversalTest::SetUp()
50 { 50 {
51 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600)); 51 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600));
52 m_document = toHTMLDocument(&m_dummyPageHolder->document()); 52 m_document = toHTMLDocument(&m_dummyPageHolder->document());
53 ASSERT(m_document); 53 ASSERT(m_document);
54 } 54 }
55 55
56 HTMLDocument& ComposedTreeTraversalTest::document() const 56 HTMLDocument& FlatTreeTraversalTest::document() const
57 { 57 {
58 return *m_document; 58 return *m_document;
59 } 59 }
60 60
61 void ComposedTreeTraversalTest::setupSampleHTML(const char* mainHTML, const char * shadowHTML, unsigned index) 61 void FlatTreeTraversalTest::setupSampleHTML(const char* mainHTML, const char* sh adowHTML, unsigned index)
62 { 62 {
63 RefPtrWillBeRawPtr<Element> body = document().body(); 63 RefPtrWillBeRawPtr<Element> body = document().body();
64 body->setInnerHTML(String::fromUTF8(mainHTML), ASSERT_NO_EXCEPTION); 64 body->setInnerHTML(String::fromUTF8(mainHTML), ASSERT_NO_EXCEPTION);
65 RefPtrWillBeRawPtr<Element> shadowHost = toElement(NodeTraversal::childAt(*b ody, index)); 65 RefPtrWillBeRawPtr<Element> shadowHost = toElement(NodeTraversal::childAt(*b ody, index));
66 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = shadowHost->createShadowRootInte rnal(ShadowRootType::V0, ASSERT_NO_EXCEPTION); 66 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = shadowHost->createShadowRootInte rnal(ShadowRootType::V0, ASSERT_NO_EXCEPTION);
67 shadowRoot->setInnerHTML(String::fromUTF8(shadowHTML), ASSERT_NO_EXCEPTION); 67 shadowRoot->setInnerHTML(String::fromUTF8(shadowHTML), ASSERT_NO_EXCEPTION);
68 body->updateDistribution(); 68 body->updateDistribution();
69 } 69 }
70 70
71 void ComposedTreeTraversalTest::setupDocumentTree(const char* mainHTML) 71 void FlatTreeTraversalTest::setupDocumentTree(const char* mainHTML)
72 { 72 {
73 RefPtrWillBeRawPtr<Element> body = document().body(); 73 RefPtrWillBeRawPtr<Element> body = document().body();
74 body->setInnerHTML(String::fromUTF8(mainHTML), ASSERT_NO_EXCEPTION); 74 body->setInnerHTML(String::fromUTF8(mainHTML), ASSERT_NO_EXCEPTION);
75 } 75 }
76 76
77 void ComposedTreeTraversalTest::attachV0ShadowRoot(Element& shadowHost, const ch ar* shadowInnerHTML) 77 void FlatTreeTraversalTest::attachV0ShadowRoot(Element& shadowHost, const char* shadowInnerHTML)
78 { 78 {
79 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = shadowHost.createShadowRootInter nal(ShadowRootType::V0, ASSERT_NO_EXCEPTION); 79 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = shadowHost.createShadowRootInter nal(ShadowRootType::V0, ASSERT_NO_EXCEPTION);
80 shadowRoot->setInnerHTML(String::fromUTF8(shadowInnerHTML), ASSERT_NO_EXCEPT ION); 80 shadowRoot->setInnerHTML(String::fromUTF8(shadowInnerHTML), ASSERT_NO_EXCEPT ION);
81 document().body()->updateDistribution(); 81 document().body()->updateDistribution();
82 } 82 }
83 83
84 void ComposedTreeTraversalTest::attachOpenShadowRoot(Element& shadowHost, const char* shadowInnerHTML) 84 void FlatTreeTraversalTest::attachOpenShadowRoot(Element& shadowHost, const char * shadowInnerHTML)
85 { 85 {
86 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = shadowHost.createShadowRootInter nal(ShadowRootType::Open, ASSERT_NO_EXCEPTION); 86 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = shadowHost.createShadowRootInter nal(ShadowRootType::Open, ASSERT_NO_EXCEPTION);
87 shadowRoot->setInnerHTML(String::fromUTF8(shadowInnerHTML), ASSERT_NO_EXCEPT ION); 87 shadowRoot->setInnerHTML(String::fromUTF8(shadowInnerHTML), ASSERT_NO_EXCEPT ION);
88 document().body()->updateDistribution(); 88 document().body()->updateDistribution();
89 } 89 }
90 90
91 void testCommonAncestor(Node* expectedResult, const Node& nodeA, const Node& nod eB) 91 void testCommonAncestor(Node* expectedResult, const Node& nodeA, const Node& nod eB)
92 { 92 {
93 Node* result1 = ComposedTreeTraversal::commonAncestor(nodeA, nodeB); 93 Node* result1 = FlatTreeTraversal::commonAncestor(nodeA, nodeB);
94 EXPECT_EQ(expectedResult, result1) << "commonAncestor(" << nodeA.textContent () << "," << nodeB.textContent() << ")"; 94 EXPECT_EQ(expectedResult, result1) << "commonAncestor(" << nodeA.textContent () << "," << nodeB.textContent() << ")";
95 Node* result2 = ComposedTreeTraversal::commonAncestor(nodeB, nodeA); 95 Node* result2 = FlatTreeTraversal::commonAncestor(nodeB, nodeA);
96 EXPECT_EQ(expectedResult, result2) << "commonAncestor(" << nodeB.textContent () << "," << nodeA.textContent() << ")"; 96 EXPECT_EQ(expectedResult, result2) << "commonAncestor(" << nodeB.textContent () << "," << nodeA.textContent() << ")";
97 } 97 }
98 98
99 // Test case for 99 // Test case for
100 // - childAt 100 // - childAt
101 // - countChildren 101 // - countChildren
102 // - hasChildren 102 // - hasChildren
103 // - index 103 // - index
104 // - isDescendantOf 104 // - isDescendantOf
105 TEST_F(ComposedTreeTraversalTest, childAt) 105 TEST_F(FlatTreeTraversalTest, childAt)
106 { 106 {
107 const char* mainHTML = 107 const char* mainHTML =
108 "<div id='m0'>" 108 "<div id='m0'>"
109 "<span id='m00'>m00</span>" 109 "<span id='m00'>m00</span>"
110 "<span id='m01'>m01</span>" 110 "<span id='m01'>m01</span>"
111 "</div>"; 111 "</div>";
112 const char* shadowHTML = 112 const char* shadowHTML =
113 "<a id='s00'>s00</a>" 113 "<a id='s00'>s00</a>"
114 "<content select='#m01'></content>" 114 "<content select='#m01'></content>"
115 "<a id='s02'>s02</a>" 115 "<a id='s02'>s02</a>"
116 "<a id='s03'><content select='#m00'></content></a>" 116 "<a id='s03'><content select='#m00'></content></a>"
117 "<a id='s04'>s04</a>"; 117 "<a id='s04'>s04</a>";
118 setupSampleHTML(mainHTML, shadowHTML, 0); 118 setupSampleHTML(mainHTML, shadowHTML, 0);
119 119
120 RefPtrWillBeRawPtr<Element> body = document().body(); 120 RefPtrWillBeRawPtr<Element> body = document().body();
121 RefPtrWillBeRawPtr<Element> m0 = body->querySelector("#m0", ASSERT_NO_EXCEPT ION); 121 RefPtrWillBeRawPtr<Element> m0 = body->querySelector("#m0", ASSERT_NO_EXCEPT ION);
122 RefPtrWillBeRawPtr<Element> m00 = m0->querySelector("#m00", ASSERT_NO_EXCEPT ION); 122 RefPtrWillBeRawPtr<Element> m00 = m0->querySelector("#m00", ASSERT_NO_EXCEPT ION);
123 RefPtrWillBeRawPtr<Element> m01 = m0->querySelector("#m01", ASSERT_NO_EXCEPT ION); 123 RefPtrWillBeRawPtr<Element> m01 = m0->querySelector("#m01", ASSERT_NO_EXCEPT ION);
124 124
125 RefPtrWillBeRawPtr<Element> shadowHost = m0; 125 RefPtrWillBeRawPtr<Element> shadowHost = m0;
126 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = shadowHost->openShadowRoot(); 126 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = shadowHost->openShadowRoot();
127 RefPtrWillBeRawPtr<Element> s00 = shadowRoot->querySelector("#s00", ASSERT_N O_EXCEPTION); 127 RefPtrWillBeRawPtr<Element> s00 = shadowRoot->querySelector("#s00", ASSERT_N O_EXCEPTION);
128 RefPtrWillBeRawPtr<Element> s02 = shadowRoot->querySelector("#s02", ASSERT_N O_EXCEPTION); 128 RefPtrWillBeRawPtr<Element> s02 = shadowRoot->querySelector("#s02", ASSERT_N O_EXCEPTION);
129 RefPtrWillBeRawPtr<Element> s03 = shadowRoot->querySelector("#s03", ASSERT_N O_EXCEPTION); 129 RefPtrWillBeRawPtr<Element> s03 = shadowRoot->querySelector("#s03", ASSERT_N O_EXCEPTION);
130 RefPtrWillBeRawPtr<Element> s04 = shadowRoot->querySelector("#s04", ASSERT_N O_EXCEPTION); 130 RefPtrWillBeRawPtr<Element> s04 = shadowRoot->querySelector("#s04", ASSERT_N O_EXCEPTION);
131 131
132 const unsigned numberOfChildNodes = 5; 132 const unsigned numberOfChildNodes = 5;
133 Node* expectedChildNodes[5] = { s00.get(), m01.get(), s02.get(), s03.get(), s04.get() }; 133 Node* expectedChildNodes[5] = { s00.get(), m01.get(), s02.get(), s03.get(), s04.get() };
134 134
135 ASSERT_EQ(numberOfChildNodes, ComposedTreeTraversal::countChildren(*shadowHo st)); 135 ASSERT_EQ(numberOfChildNodes, FlatTreeTraversal::countChildren(*shadowHost)) ;
136 EXPECT_TRUE(ComposedTreeTraversal::hasChildren(*shadowHost)); 136 EXPECT_TRUE(FlatTreeTraversal::hasChildren(*shadowHost));
137 137
138 for (unsigned index = 0; index < numberOfChildNodes; ++index) { 138 for (unsigned index = 0; index < numberOfChildNodes; ++index) {
139 Node* child = ComposedTreeTraversal::childAt(*shadowHost, index); 139 Node* child = FlatTreeTraversal::childAt(*shadowHost, index);
140 EXPECT_EQ(expectedChildNodes[index], child) 140 EXPECT_EQ(expectedChildNodes[index], child)
141 << "ComposedTreeTraversal::childAt(*shadowHost, " << index << ")"; 141 << "FlatTreeTraversal::childAt(*shadowHost, " << index << ")";
142 EXPECT_EQ(index, ComposedTreeTraversal::index(*child)) 142 EXPECT_EQ(index, FlatTreeTraversal::index(*child))
143 << "ComposedTreeTraversal::index(ComposedTreeTraversal(*shadowHost, " << index << "))"; 143 << "FlatTreeTraversal::index(FlatTreeTraversal(*shadowHost, " << ind ex << "))";
144 EXPECT_TRUE(ComposedTreeTraversal::isDescendantOf(*child, *shadowHost)) 144 EXPECT_TRUE(FlatTreeTraversal::isDescendantOf(*child, *shadowHost))
145 << "ComposedTreeTraversal::isDescendantOf(*ComposedTreeTraversal(*sh adowHost, " << index << "), *shadowHost)"; 145 << "FlatTreeTraversal::isDescendantOf(*FlatTreeTraversal(*shadowHost , " << index << "), *shadowHost)";
146 } 146 }
147 EXPECT_EQ(nullptr, ComposedTreeTraversal::childAt(*shadowHost, numberOfChild Nodes + 1)) 147 EXPECT_EQ(nullptr, FlatTreeTraversal::childAt(*shadowHost, numberOfChildNode s + 1))
148 << "Out of bounds childAt() returns nullptr."; 148 << "Out of bounds childAt() returns nullptr.";
149 149
150 // Distribute node |m00| is child of node in shadow tree |s03|. 150 // Distribute node |m00| is child of node in shadow tree |s03|.
151 EXPECT_EQ(m00.get(), ComposedTreeTraversal::childAt(*s03, 0)); 151 EXPECT_EQ(m00.get(), FlatTreeTraversal::childAt(*s03, 0));
152 } 152 }
153 153
154 // Test case for 154 // Test case for
155 // - commonAncestor 155 // - commonAncestor
156 // - isDescendantOf 156 // - isDescendantOf
157 TEST_F(ComposedTreeTraversalTest, commonAncestor) 157 TEST_F(FlatTreeTraversalTest, commonAncestor)
158 { 158 {
159 // We build following composed tree: 159 // We build following flat tree:
160 // ____BODY___ 160 // ____BODY___
161 // | | | 161 // | | |
162 // m0 m1 m2 m1 is shadow host having m10, m11, m12. 162 // m0 m1 m2 m1 is shadow host having m10, m11, m12.
163 // _|_ | __|__ 163 // _|_ | __|__
164 // | | | | | 164 // | | | | |
165 // m00 m01 | m20 m21 165 // m00 m01 | m20 m21
166 // _____|_____________ 166 // _____|_____________
167 // | | | | | 167 // | | | | |
168 // s10 s11 s12 s13 s14 168 // s10 s11 s12 s13 s14
169 // | 169 // |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 m20->remove(ASSERT_NO_EXCEPTION); 239 m20->remove(ASSERT_NO_EXCEPTION);
240 testCommonAncestor(m20.get(), *m20, *m20); 240 testCommonAncestor(m20.get(), *m20, *m20);
241 testCommonAncestor(nullptr, *m20, *s12); 241 testCommonAncestor(nullptr, *m20, *s12);
242 testCommonAncestor(nullptr, *m20, *m1); 242 testCommonAncestor(nullptr, *m20, *m1);
243 } 243 }
244 244
245 // Test case for 245 // Test case for
246 // - nextSkippingChildren 246 // - nextSkippingChildren
247 // - previousSkippingChildren 247 // - previousSkippingChildren
248 TEST_F(ComposedTreeTraversalTest, nextSkippingChildren) 248 TEST_F(FlatTreeTraversalTest, nextSkippingChildren)
249 { 249 {
250 const char* mainHTML = 250 const char* mainHTML =
251 "<div id='m0'>m0</div>" 251 "<div id='m0'>m0</div>"
252 "<div id='m1'>" 252 "<div id='m1'>"
253 "<span id='m10'>m10</span>" 253 "<span id='m10'>m10</span>"
254 "<span id='m11'>m11</span>" 254 "<span id='m11'>m11</span>"
255 "</div>" 255 "</div>"
256 "<div id='m2'>m2</div>"; 256 "<div id='m2'>m2</div>";
257 const char* shadowHTML = 257 const char* shadowHTML =
258 "<content select='#m11'></content>" 258 "<content select='#m11'></content>"
(...skipping 11 matching lines...) Expand all
270 270
271 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION); 271 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION);
272 RefPtrWillBeRawPtr<Element> m11 = body->querySelector("#m11", ASSERT_NO_EXCE PTION); 272 RefPtrWillBeRawPtr<Element> m11 = body->querySelector("#m11", ASSERT_NO_EXCE PTION);
273 273
274 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = m1->openShadowRoot(); 274 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = m1->openShadowRoot();
275 RefPtrWillBeRawPtr<Element> s11 = shadowRoot->querySelector("#s11", ASSERT_N O_EXCEPTION); 275 RefPtrWillBeRawPtr<Element> s11 = shadowRoot->querySelector("#s11", ASSERT_N O_EXCEPTION);
276 RefPtrWillBeRawPtr<Element> s12 = shadowRoot->querySelector("#s12", ASSERT_N O_EXCEPTION); 276 RefPtrWillBeRawPtr<Element> s12 = shadowRoot->querySelector("#s12", ASSERT_N O_EXCEPTION);
277 RefPtrWillBeRawPtr<Element> s120 = shadowRoot->querySelector("#s120", ASSERT _NO_EXCEPTION); 277 RefPtrWillBeRawPtr<Element> s120 = shadowRoot->querySelector("#s120", ASSERT _NO_EXCEPTION);
278 278
279 // Main tree node to main tree node 279 // Main tree node to main tree node
280 EXPECT_EQ(*m1, ComposedTreeTraversal::nextSkippingChildren(*m0)); 280 EXPECT_EQ(*m1, FlatTreeTraversal::nextSkippingChildren(*m0));
281 EXPECT_EQ(*m0, ComposedTreeTraversal::previousSkippingChildren(*m1)); 281 EXPECT_EQ(*m0, FlatTreeTraversal::previousSkippingChildren(*m1));
282 282
283 // Distribute node to main tree node 283 // Distribute node to main tree node
284 EXPECT_EQ(*m2, ComposedTreeTraversal::nextSkippingChildren(*m10)); 284 EXPECT_EQ(*m2, FlatTreeTraversal::nextSkippingChildren(*m10));
285 EXPECT_EQ(*m1, ComposedTreeTraversal::previousSkippingChildren(*m2)); 285 EXPECT_EQ(*m1, FlatTreeTraversal::previousSkippingChildren(*m2));
286 286
287 // Distribute node to node in shadow tree 287 // Distribute node to node in shadow tree
288 EXPECT_EQ(*s11, ComposedTreeTraversal::nextSkippingChildren(*m11)); 288 EXPECT_EQ(*s11, FlatTreeTraversal::nextSkippingChildren(*m11));
289 EXPECT_EQ(*m11, ComposedTreeTraversal::previousSkippingChildren(*s11)); 289 EXPECT_EQ(*m11, FlatTreeTraversal::previousSkippingChildren(*s11));
290 290
291 // Node in shadow tree to distributed node 291 // Node in shadow tree to distributed node
292 EXPECT_EQ(*s11, ComposedTreeTraversal::nextSkippingChildren(*m11)); 292 EXPECT_EQ(*s11, FlatTreeTraversal::nextSkippingChildren(*m11));
293 EXPECT_EQ(*m11, ComposedTreeTraversal::previousSkippingChildren(*s11)); 293 EXPECT_EQ(*m11, FlatTreeTraversal::previousSkippingChildren(*s11));
294 294
295 EXPECT_EQ(*m10, ComposedTreeTraversal::nextSkippingChildren(*s120)); 295 EXPECT_EQ(*m10, FlatTreeTraversal::nextSkippingChildren(*s120));
296 EXPECT_EQ(*s120, ComposedTreeTraversal::previousSkippingChildren(*m10)); 296 EXPECT_EQ(*s120, FlatTreeTraversal::previousSkippingChildren(*m10));
297 297
298 // Node in shadow tree to main tree 298 // Node in shadow tree to main tree
299 EXPECT_EQ(*m2, ComposedTreeTraversal::nextSkippingChildren(*s12)); 299 EXPECT_EQ(*m2, FlatTreeTraversal::nextSkippingChildren(*s12));
300 EXPECT_EQ(*m1, ComposedTreeTraversal::previousSkippingChildren(*m2)); 300 EXPECT_EQ(*m1, FlatTreeTraversal::previousSkippingChildren(*m2));
301 } 301 }
302 302
303 // Test case for 303 // Test case for
304 // - lastWithin 304 // - lastWithin
305 // - lastWithinOrSelf 305 // - lastWithinOrSelf
306 TEST_F(ComposedTreeTraversalTest, lastWithin) 306 TEST_F(FlatTreeTraversalTest, lastWithin)
307 { 307 {
308 const char* mainHTML = 308 const char* mainHTML =
309 "<div id='m0'>m0</div>" 309 "<div id='m0'>m0</div>"
310 "<div id='m1'>" 310 "<div id='m1'>"
311 "<span id='m10'>m10</span>" 311 "<span id='m10'>m10</span>"
312 "<span id='m11'>m11</span>" 312 "<span id='m11'>m11</span>"
313 "<span id='m12'>m12</span>" // #m12 is not distributed. 313 "<span id='m12'>m12</span>" // #m12 is not distributed.
314 "</div>" 314 "</div>"
315 "<div id='m2'></div>"; 315 "<div id='m2'></div>";
316 const char* shadowHTML = 316 const char* shadowHTML =
317 "<content select='#m11'></content>" 317 "<content select='#m11'></content>"
318 "<a id='s11'>s11</a>" 318 "<a id='s11'>s11</a>"
319 "<a id='s12'>" 319 "<a id='s12'>"
320 "<content select='#m10'></content>" 320 "<content select='#m10'></content>"
321 "</a>"; 321 "</a>";
322 setupSampleHTML(mainHTML, shadowHTML, 1); 322 setupSampleHTML(mainHTML, shadowHTML, 1);
323 323
324 RefPtrWillBeRawPtr<Element> body = document().body(); 324 RefPtrWillBeRawPtr<Element> body = document().body();
325 RefPtrWillBeRawPtr<Element> m0 = body->querySelector("#m0", ASSERT_NO_EXCEPT ION); 325 RefPtrWillBeRawPtr<Element> m0 = body->querySelector("#m0", ASSERT_NO_EXCEPT ION);
326 RefPtrWillBeRawPtr<Element> m1 = body->querySelector("#m1", ASSERT_NO_EXCEPT ION); 326 RefPtrWillBeRawPtr<Element> m1 = body->querySelector("#m1", ASSERT_NO_EXCEPT ION);
327 RefPtrWillBeRawPtr<Element> m2 = body->querySelector("#m2", ASSERT_NO_EXCEPT ION); 327 RefPtrWillBeRawPtr<Element> m2 = body->querySelector("#m2", ASSERT_NO_EXCEPT ION);
328 328
329 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION); 329 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION);
330 330
331 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = m1->openShadowRoot(); 331 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = m1->openShadowRoot();
332 RefPtrWillBeRawPtr<Element> s11 = shadowRoot->querySelector("#s11", ASSERT_N O_EXCEPTION); 332 RefPtrWillBeRawPtr<Element> s11 = shadowRoot->querySelector("#s11", ASSERT_N O_EXCEPTION);
333 RefPtrWillBeRawPtr<Element> s12 = shadowRoot->querySelector("#s12", ASSERT_N O_EXCEPTION); 333 RefPtrWillBeRawPtr<Element> s12 = shadowRoot->querySelector("#s12", ASSERT_N O_EXCEPTION);
334 334
335 EXPECT_EQ(m0->firstChild(), ComposedTreeTraversal::lastWithin(*m0)); 335 EXPECT_EQ(m0->firstChild(), FlatTreeTraversal::lastWithin(*m0));
336 EXPECT_EQ(*m0->firstChild(), ComposedTreeTraversal::lastWithinOrSelf(*m0)); 336 EXPECT_EQ(*m0->firstChild(), FlatTreeTraversal::lastWithinOrSelf(*m0));
337 337
338 EXPECT_EQ(m10->firstChild(), ComposedTreeTraversal::lastWithin(*m1)); 338 EXPECT_EQ(m10->firstChild(), FlatTreeTraversal::lastWithin(*m1));
339 EXPECT_EQ(*m10->firstChild(), ComposedTreeTraversal::lastWithinOrSelf(*m1)); 339 EXPECT_EQ(*m10->firstChild(), FlatTreeTraversal::lastWithinOrSelf(*m1));
340 340
341 EXPECT_EQ(nullptr, ComposedTreeTraversal::lastWithin(*m2)); 341 EXPECT_EQ(nullptr, FlatTreeTraversal::lastWithin(*m2));
342 EXPECT_EQ(*m2, ComposedTreeTraversal::lastWithinOrSelf(*m2)); 342 EXPECT_EQ(*m2, FlatTreeTraversal::lastWithinOrSelf(*m2));
343 343
344 EXPECT_EQ(s11->firstChild(), ComposedTreeTraversal::lastWithin(*s11)); 344 EXPECT_EQ(s11->firstChild(), FlatTreeTraversal::lastWithin(*s11));
345 EXPECT_EQ(*s11->firstChild(), ComposedTreeTraversal::lastWithinOrSelf(*s11)) ; 345 EXPECT_EQ(*s11->firstChild(), FlatTreeTraversal::lastWithinOrSelf(*s11));
346 346
347 EXPECT_EQ(m10->firstChild(), ComposedTreeTraversal::lastWithin(*s12)); 347 EXPECT_EQ(m10->firstChild(), FlatTreeTraversal::lastWithin(*s12));
348 EXPECT_EQ(*m10->firstChild(), ComposedTreeTraversal::lastWithinOrSelf(*s12)) ; 348 EXPECT_EQ(*m10->firstChild(), FlatTreeTraversal::lastWithinOrSelf(*s12));
349 } 349 }
350 350
351 TEST_F(ComposedTreeTraversalTest, previousPostOrder) 351 TEST_F(FlatTreeTraversalTest, previousPostOrder)
352 { 352 {
353 const char* mainHTML = 353 const char* mainHTML =
354 "<div id='m0'>m0</div>" 354 "<div id='m0'>m0</div>"
355 "<div id='m1'>" 355 "<div id='m1'>"
356 "<span id='m10'>m10</span>" 356 "<span id='m10'>m10</span>"
357 "<span id='m11'>m11</span>" 357 "<span id='m11'>m11</span>"
358 "</div>" 358 "</div>"
359 "<div id='m2'>m2</div>"; 359 "<div id='m2'>m2</div>";
360 const char* shadowHTML = 360 const char* shadowHTML =
361 "<content select='#m11'></content>" 361 "<content select='#m11'></content>"
(...skipping 10 matching lines...) Expand all
372 RefPtrWillBeRawPtr<Element> m2 = body->querySelector("#m2", ASSERT_NO_EXCEPT ION); 372 RefPtrWillBeRawPtr<Element> m2 = body->querySelector("#m2", ASSERT_NO_EXCEPT ION);
373 373
374 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION); 374 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION);
375 RefPtrWillBeRawPtr<Element> m11 = body->querySelector("#m11", ASSERT_NO_EXCE PTION); 375 RefPtrWillBeRawPtr<Element> m11 = body->querySelector("#m11", ASSERT_NO_EXCE PTION);
376 376
377 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = m1->openShadowRoot(); 377 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = m1->openShadowRoot();
378 RefPtrWillBeRawPtr<Element> s11 = shadowRoot->querySelector("#s11", ASSERT_N O_EXCEPTION); 378 RefPtrWillBeRawPtr<Element> s11 = shadowRoot->querySelector("#s11", ASSERT_N O_EXCEPTION);
379 RefPtrWillBeRawPtr<Element> s12 = shadowRoot->querySelector("#s12", ASSERT_N O_EXCEPTION); 379 RefPtrWillBeRawPtr<Element> s12 = shadowRoot->querySelector("#s12", ASSERT_N O_EXCEPTION);
380 RefPtrWillBeRawPtr<Element> s120 = shadowRoot->querySelector("#s120", ASSERT _NO_EXCEPTION); 380 RefPtrWillBeRawPtr<Element> s120 = shadowRoot->querySelector("#s120", ASSERT _NO_EXCEPTION);
381 381
382 EXPECT_EQ(*m0->firstChild(), ComposedTreeTraversal::previousPostOrder(*m0)); 382 EXPECT_EQ(*m0->firstChild(), FlatTreeTraversal::previousPostOrder(*m0));
383 EXPECT_EQ(*s12, ComposedTreeTraversal::previousPostOrder(*m1)); 383 EXPECT_EQ(*s12, FlatTreeTraversal::previousPostOrder(*m1));
384 EXPECT_EQ(*m10->firstChild(), ComposedTreeTraversal::previousPostOrder(*m10) ); 384 EXPECT_EQ(*m10->firstChild(), FlatTreeTraversal::previousPostOrder(*m10));
385 EXPECT_EQ(*s120, ComposedTreeTraversal::previousPostOrder(*m10->firstChild() )); 385 EXPECT_EQ(*s120, FlatTreeTraversal::previousPostOrder(*m10->firstChild()));
386 EXPECT_EQ(*s120, ComposedTreeTraversal::previousPostOrder(*m10->firstChild() , s12.get())); 386 EXPECT_EQ(*s120, FlatTreeTraversal::previousPostOrder(*m10->firstChild(), s1 2.get()));
387 EXPECT_EQ(*m11->firstChild(), ComposedTreeTraversal::previousPostOrder(*m11) ); 387 EXPECT_EQ(*m11->firstChild(), FlatTreeTraversal::previousPostOrder(*m11));
388 EXPECT_EQ(*m0, ComposedTreeTraversal::previousPostOrder(*m11->firstChild())) ; 388 EXPECT_EQ(*m0, FlatTreeTraversal::previousPostOrder(*m11->firstChild()));
389 EXPECT_EQ(nullptr, ComposedTreeTraversal::previousPostOrder(*m11->firstChild (), m11.get())); 389 EXPECT_EQ(nullptr, FlatTreeTraversal::previousPostOrder(*m11->firstChild(), m11.get()));
390 EXPECT_EQ(*m2->firstChild(), ComposedTreeTraversal::previousPostOrder(*m2)); 390 EXPECT_EQ(*m2->firstChild(), FlatTreeTraversal::previousPostOrder(*m2));
391 391
392 EXPECT_EQ(*s11->firstChild(), ComposedTreeTraversal::previousPostOrder(*s11) ); 392 EXPECT_EQ(*s11->firstChild(), FlatTreeTraversal::previousPostOrder(*s11));
393 EXPECT_EQ(*m10, ComposedTreeTraversal::previousPostOrder(*s12)); 393 EXPECT_EQ(*m10, FlatTreeTraversal::previousPostOrder(*s12));
394 EXPECT_EQ(*s120->firstChild(), ComposedTreeTraversal::previousPostOrder(*s12 0)); 394 EXPECT_EQ(*s120->firstChild(), FlatTreeTraversal::previousPostOrder(*s120));
395 EXPECT_EQ(*s11, ComposedTreeTraversal::previousPostOrder(*s120->firstChild() )); 395 EXPECT_EQ(*s11, FlatTreeTraversal::previousPostOrder(*s120->firstChild()));
396 EXPECT_EQ(nullptr, ComposedTreeTraversal::previousPostOrder(*s120->firstChil d(), s12.get())); 396 EXPECT_EQ(nullptr, FlatTreeTraversal::previousPostOrder(*s120->firstChild(), s12.get()));
397 } 397 }
398 398
399 TEST_F(ComposedTreeTraversalTest, nextSiblingNotInDocumentComposedTree) 399 TEST_F(FlatTreeTraversalTest, nextSiblingNotInDocumentFlatTree)
400 { 400 {
401 const char* mainHTML = 401 const char* mainHTML =
402 "<div id='m0'>m0</div>" 402 "<div id='m0'>m0</div>"
403 "<div id='m1'>" 403 "<div id='m1'>"
404 "<span id='m10'>m10</span>" 404 "<span id='m10'>m10</span>"
405 "<span id='m11'>m11</span>" 405 "<span id='m11'>m11</span>"
406 "</div>" 406 "</div>"
407 "<div id='m2'>m2</div>"; 407 "<div id='m2'>m2</div>";
408 const char* shadowHTML = 408 const char* shadowHTML =
409 "<content select='#m11'></content>"; 409 "<content select='#m11'></content>";
410 setupSampleHTML(mainHTML, shadowHTML, 1); 410 setupSampleHTML(mainHTML, shadowHTML, 1);
411 411
412 RefPtrWillBeRawPtr<Element> body = document().body(); 412 RefPtrWillBeRawPtr<Element> body = document().body();
413 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION); 413 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION);
414 414
415 EXPECT_EQ(nullptr, ComposedTreeTraversal::nextSibling(*m10)); 415 EXPECT_EQ(nullptr, FlatTreeTraversal::nextSibling(*m10));
416 EXPECT_EQ(nullptr, ComposedTreeTraversal::previousSibling(*m10)); 416 EXPECT_EQ(nullptr, FlatTreeTraversal::previousSibling(*m10));
417 } 417 }
418 418
419 TEST_F(ComposedTreeTraversalTest, redistribution) 419 TEST_F(FlatTreeTraversalTest, redistribution)
420 { 420 {
421 const char* mainHTML = 421 const char* mainHTML =
422 "<div id='m0'>m0</div>" 422 "<div id='m0'>m0</div>"
423 "<div id='m1'>" 423 "<div id='m1'>"
424 "<span id='m10'>m10</span>" 424 "<span id='m10'>m10</span>"
425 "<span id='m11'>m11</span>" 425 "<span id='m11'>m11</span>"
426 "</div>" 426 "</div>"
427 "<div id='m2'>m2</div>"; 427 "<div id='m2'>m2</div>";
428 const char* shadowHTML1 = 428 const char* shadowHTML1 =
429 "<div id='s1'>" 429 "<div id='s1'>"
(...skipping 13 matching lines...) Expand all
443 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION); 443 RefPtrWillBeRawPtr<Element> m10 = body->querySelector("#m10", ASSERT_NO_EXCE PTION);
444 444
445 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot1 = m1->openShadowRoot(); 445 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot1 = m1->openShadowRoot();
446 RefPtrWillBeRawPtr<Element> s1 = shadowRoot1->querySelector("#s1", ASSERT_NO _EXCEPTION); 446 RefPtrWillBeRawPtr<Element> s1 = shadowRoot1->querySelector("#s1", ASSERT_NO _EXCEPTION);
447 447
448 attachV0ShadowRoot(*s1, shadowHTML2); 448 attachV0ShadowRoot(*s1, shadowHTML2);
449 449
450 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot2 = s1->openShadowRoot(); 450 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot2 = s1->openShadowRoot();
451 RefPtrWillBeRawPtr<Element> s21 = shadowRoot2->querySelector("#s21", ASSERT_ NO_EXCEPTION); 451 RefPtrWillBeRawPtr<Element> s21 = shadowRoot2->querySelector("#s21", ASSERT_ NO_EXCEPTION);
452 452
453 EXPECT_EQ(s21.get(), ComposedTreeTraversal::nextSibling(*m10)); 453 EXPECT_EQ(s21.get(), FlatTreeTraversal::nextSibling(*m10));
454 EXPECT_EQ(m10.get(), ComposedTreeTraversal::previousSibling(*s21)); 454 EXPECT_EQ(m10.get(), FlatTreeTraversal::previousSibling(*s21));
455 455
456 // ComposedTreeTraversal::traverseSiblings does not work for a node which is not in a document composed tree. 456 // FlatTreeTraversal::traverseSiblings does not work for a node which is not in a document flat tree.
457 // e.g. The following test fails. The result of ComposedTreeTraversal::previ ousSibling(*m11)) will be #m10, instead of nullptr. 457 // e.g. The following test fails. The result of FlatTreeTraversal::previousS ibling(*m11)) will be #m10, instead of nullptr.
458 // RefPtrWillBeRawPtr<Element> m11 = body->querySelector("#m11", ASSERT_NO_E XCEPTION); 458 // RefPtrWillBeRawPtr<Element> m11 = body->querySelector("#m11", ASSERT_NO_E XCEPTION);
459 // EXPECT_EQ(nullptr, ComposedTreeTraversal::previousSibling(*m11)); 459 // EXPECT_EQ(nullptr, FlatTreeTraversal::previousSibling(*m11));
460 } 460 }
461 461
462 TEST_F(ComposedTreeTraversalTest, v1Simple) 462 TEST_F(FlatTreeTraversalTest, v1Simple)
463 { 463 {
464 const char* mainHTML = 464 const char* mainHTML =
465 "<div id='host'>" 465 "<div id='host'>"
466 "<div id='child1' slot='slot1'></div>" 466 "<div id='child1' slot='slot1'></div>"
467 "<div id='child2' slot='slot2'></div>" 467 "<div id='child2' slot='slot2'></div>"
468 "</div>"; 468 "</div>";
469 const char* shadowHTML = 469 const char* shadowHTML =
470 "<div id='shadow-child1'></div>" 470 "<div id='shadow-child1'></div>"
471 "<slot name='slot1'></slot>" 471 "<slot name='slot1'></slot>"
472 "<slot name='slot2'></slot>" 472 "<slot name='slot2'></slot>"
473 "<div id='shadow-child2'></div>"; 473 "<div id='shadow-child2'></div>";
474 474
475 setupDocumentTree(mainHTML); 475 setupDocumentTree(mainHTML);
476 RefPtrWillBeRawPtr<Element> body = document().body(); 476 RefPtrWillBeRawPtr<Element> body = document().body();
477 RefPtrWillBeRawPtr<Element> host = body->querySelector("#host", ASSERT_NO_EX CEPTION); 477 RefPtrWillBeRawPtr<Element> host = body->querySelector("#host", ASSERT_NO_EX CEPTION);
478 RefPtrWillBeRawPtr<Element> child1 = body->querySelector("#child1", ASSERT_N O_EXCEPTION); 478 RefPtrWillBeRawPtr<Element> child1 = body->querySelector("#child1", ASSERT_N O_EXCEPTION);
479 RefPtrWillBeRawPtr<Element> child2 = body->querySelector("#child2", ASSERT_N O_EXCEPTION); 479 RefPtrWillBeRawPtr<Element> child2 = body->querySelector("#child2", ASSERT_N O_EXCEPTION);
480 480
481 attachOpenShadowRoot(*host, shadowHTML); 481 attachOpenShadowRoot(*host, shadowHTML);
482 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = host->openShadowRoot(); 482 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = host->openShadowRoot();
483 RefPtrWillBeRawPtr<Element> slot1 = shadowRoot->querySelector("[name=slot1]" , ASSERT_NO_EXCEPTION); 483 RefPtrWillBeRawPtr<Element> slot1 = shadowRoot->querySelector("[name=slot1]" , ASSERT_NO_EXCEPTION);
484 RefPtrWillBeRawPtr<Element> slot2 = shadowRoot->querySelector("[name=slot2]" , ASSERT_NO_EXCEPTION); 484 RefPtrWillBeRawPtr<Element> slot2 = shadowRoot->querySelector("[name=slot2]" , ASSERT_NO_EXCEPTION);
485 RefPtrWillBeRawPtr<Element> shadowChild1 = shadowRoot->querySelector("#shado w-child1", ASSERT_NO_EXCEPTION); 485 RefPtrWillBeRawPtr<Element> shadowChild1 = shadowRoot->querySelector("#shado w-child1", ASSERT_NO_EXCEPTION);
486 RefPtrWillBeRawPtr<Element> shadowChild2 = shadowRoot->querySelector("#shado w-child2", ASSERT_NO_EXCEPTION); 486 RefPtrWillBeRawPtr<Element> shadowChild2 = shadowRoot->querySelector("#shado w-child2", ASSERT_NO_EXCEPTION);
487 487
488 EXPECT_TRUE(slot1); 488 EXPECT_TRUE(slot1);
489 EXPECT_TRUE(slot2); 489 EXPECT_TRUE(slot2);
490 EXPECT_EQ(shadowChild1.get(), ComposedTreeTraversal::firstChild(*host)); 490 EXPECT_EQ(shadowChild1.get(), FlatTreeTraversal::firstChild(*host));
491 EXPECT_EQ(child1.get(), ComposedTreeTraversal::nextSibling(*shadowChild1)); 491 EXPECT_EQ(child1.get(), FlatTreeTraversal::nextSibling(*shadowChild1));
492 EXPECT_EQ(child2.get(), ComposedTreeTraversal::nextSibling(*child1)); 492 EXPECT_EQ(child2.get(), FlatTreeTraversal::nextSibling(*child1));
493 EXPECT_EQ(shadowChild2.get(), ComposedTreeTraversal::nextSibling(*child2)); 493 EXPECT_EQ(shadowChild2.get(), FlatTreeTraversal::nextSibling(*child2));
494 } 494 }
495 495
496 TEST_F(ComposedTreeTraversalTest, v1Redistribution) 496 TEST_F(FlatTreeTraversalTest, v1Redistribution)
497 { 497 {
498 const char* mainHTML = 498 const char* mainHTML =
499 "<div id='d1'>" 499 "<div id='d1'>"
500 "<div id='d2' slot='d1-s1'></div>" 500 "<div id='d2' slot='d1-s1'></div>"
501 "<div id='d3' slot='d1-s2'></div>" 501 "<div id='d3' slot='d1-s2'></div>"
502 "<div id='d4' slot='nonexistent'></div>" 502 "<div id='d4' slot='nonexistent'></div>"
503 "<div id='d5'></div>" 503 "<div id='d5'></div>"
504 "</div>" 504 "</div>"
505 "<div id='d6'></div>"; 505 "<div id='d6'></div>";
506 const char* shadowHTML1 = 506 const char* shadowHTML1 =
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 RefPtrWillBeRawPtr<Element> d11s2 = shadowRoot2->querySelector("[name=d1-1-s 2]", ASSERT_NO_EXCEPTION); 546 RefPtrWillBeRawPtr<Element> d11s2 = shadowRoot2->querySelector("[name=d1-1-s 2]", ASSERT_NO_EXCEPTION);
547 547
548 EXPECT_TRUE(d5); 548 EXPECT_TRUE(d5);
549 EXPECT_TRUE(d12); 549 EXPECT_TRUE(d12);
550 EXPECT_TRUE(d13); 550 EXPECT_TRUE(d13);
551 EXPECT_TRUE(d1s0); 551 EXPECT_TRUE(d1s0);
552 EXPECT_TRUE(d1s1); 552 EXPECT_TRUE(d1s1);
553 EXPECT_TRUE(d1s2); 553 EXPECT_TRUE(d1s2);
554 EXPECT_TRUE(d11s1); 554 EXPECT_TRUE(d11s1);
555 EXPECT_TRUE(d11s2); 555 EXPECT_TRUE(d11s2);
556 EXPECT_EQ(d11.get(), ComposedTreeTraversal::next(*d1)); 556 EXPECT_EQ(d11.get(), FlatTreeTraversal::next(*d1));
557 EXPECT_EQ(d111.get(), ComposedTreeTraversal::next(*d11)); 557 EXPECT_EQ(d111.get(), FlatTreeTraversal::next(*d11));
558 EXPECT_EQ(d2.get(), ComposedTreeTraversal::next(*d111)); 558 EXPECT_EQ(d2.get(), FlatTreeTraversal::next(*d111));
559 EXPECT_EQ(d14.get(), ComposedTreeTraversal::next(*d2)); 559 EXPECT_EQ(d14.get(), FlatTreeTraversal::next(*d2));
560 EXPECT_EQ(d112.get(), ComposedTreeTraversal::next(*d14)); 560 EXPECT_EQ(d112.get(), FlatTreeTraversal::next(*d14));
561 EXPECT_EQ(d6.get(), ComposedTreeTraversal::next(*d112)); 561 EXPECT_EQ(d6.get(), FlatTreeTraversal::next(*d112));
562 562
563 EXPECT_EQ(d112.get(), ComposedTreeTraversal::previous(*d6)); 563 EXPECT_EQ(d112.get(), FlatTreeTraversal::previous(*d6));
564 564
565 EXPECT_EQ(d11.get(), ComposedTreeTraversal::parent(*d111)); 565 EXPECT_EQ(d11.get(), FlatTreeTraversal::parent(*d111));
566 EXPECT_EQ(d11.get(), ComposedTreeTraversal::parent(*d112)); 566 EXPECT_EQ(d11.get(), FlatTreeTraversal::parent(*d112));
567 EXPECT_EQ(d11.get(), ComposedTreeTraversal::parent(*d2)); 567 EXPECT_EQ(d11.get(), FlatTreeTraversal::parent(*d2));
568 EXPECT_EQ(d11.get(), ComposedTreeTraversal::parent(*d14)); 568 EXPECT_EQ(d11.get(), FlatTreeTraversal::parent(*d14));
569 EXPECT_EQ(nullptr, ComposedTreeTraversal::parent(*d3)); 569 EXPECT_EQ(nullptr, FlatTreeTraversal::parent(*d3));
570 EXPECT_EQ(nullptr, ComposedTreeTraversal::parent(*d4)); 570 EXPECT_EQ(nullptr, FlatTreeTraversal::parent(*d4));
571 } 571 }
572 572
573 } // namespace blink 573 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698