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

Side by Side Diff: Source/core/dom/PositionTest.cpp

Issue 1263033003: Make PositionAlgorithm<Strategy>::next() to use Strategy::index() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-08-03T16:32:43 Created 5 years, 4 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
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "config.h" 5 #include "config.h"
6 #include "core/dom/Position.h" 6 #include "core/dom/Position.h"
7 7
8 #include "core/editing/EditingTestBase.h" 8 #include "core/editing/EditingTestBase.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 class PositionTest : public EditingTestBase { 12 class PositionTest : public EditingTestBase {
13 }; 13 };
14 14
15 TEST_F(PositionTest, NextNodeIndex)
16 {
17 const char* bodyContent = "<p id='host'>00<b id='one'>11</b><b id='two'>22</ b>33</p>";
18 const char* shadowContent = "<content select=#two></content><content select= #one></content>";
19 setBodyContent(bodyContent);
20 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
21 Node* host = document().getElementById("host");
22 Node* two = document().getElementById("two");
23
24 EXPECT_EQ(Position(host, 3), Position(two, 2).next());
25 EXPECT_EQ(PositionInComposedTree(host, 1), PositionInComposedTree(two, 2).ne xt());
26 }
27
15 TEST_F(PositionTest, NodeAsRangeLastNodeNull) 28 TEST_F(PositionTest, NodeAsRangeLastNodeNull)
16 { 29 {
17 EXPECT_EQ(nullptr, Position().nodeAsRangeLastNode()); 30 EXPECT_EQ(nullptr, Position().nodeAsRangeLastNode());
18 EXPECT_EQ(nullptr, PositionInComposedTree().nodeAsRangeLastNode()); 31 EXPECT_EQ(nullptr, PositionInComposedTree().nodeAsRangeLastNode());
19 } 32 }
20 33
21 TEST_F(PositionTest, NodeAsRangeLastNode) 34 TEST_F(PositionTest, NodeAsRangeLastNode)
22 { 35 {
23 const char* bodyContent = "<p id='p1'>11</p><p id='p2'></p><p id='p3'>33</p> "; 36 const char* bodyContent = "<p id='p1'>11</p><p id='p2'></p><p id='p3'>33</p> ";
24 setBodyContent(bodyContent); 37 setBodyContent(bodyContent);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>"; 140 const char* bodyContent = "<p id='host'>00<b id='one'>11</b>22</p>";
128 const char* shadowContent = ""; 141 const char* shadowContent = "";
129 setBodyContent(bodyContent); 142 setBodyContent(bodyContent);
130 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent); 143 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = setShadowContent(shadowContent);
131 RefPtrWillBeRawPtr<Element> host = document().getElementById("host"); 144 RefPtrWillBeRawPtr<Element> host = document().getElementById("host");
132 145
133 EXPECT_EQ(PositionInComposedTree(host, PositionAnchorType::AfterChildren), t oPositionInComposedTree(positionInDOMTree(*shadowRoot, 0))); 146 EXPECT_EQ(PositionInComposedTree(host, PositionAnchorType::AfterChildren), t oPositionInComposedTree(positionInDOMTree(*shadowRoot, 0)));
134 } 147 }
135 148
136 } // namespace blink 149 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/dom/Position.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698