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

Side by Side Diff: third_party/WebKit/Source/core/editing/PositionTest.cpp

Issue 2962473002: Make Position::LastPositionInNode() to take const Node& instead of Node* (Closed)
Patch Set: 2017-06-26T14:00:00 Created 3 years, 5 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/editing/Position.h" 5 #include "core/editing/Position.h"
6 6
7 #include "core/editing/EditingTestBase.h" 7 #include "core/editing/EditingTestBase.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 12 matching lines...) Expand all
23 Position::BeforeNode(*sample->firstChild()))); 23 Position::BeforeNode(*sample->firstChild())));
24 EXPECT_TRUE(Position(sample, 1).IsEquivalent( 24 EXPECT_TRUE(Position(sample, 1).IsEquivalent(
25 Position::AfterNode(*sample->firstChild()))); 25 Position::AfterNode(*sample->firstChild())));
26 EXPECT_TRUE(Position(sample, 1).IsEquivalent( 26 EXPECT_TRUE(Position(sample, 1).IsEquivalent(
27 Position::BeforeNode(*sample->firstChild()->nextSibling()))); 27 Position::BeforeNode(*sample->firstChild()->nextSibling())));
28 EXPECT_TRUE(Position(sample, 2).IsEquivalent( 28 EXPECT_TRUE(Position(sample, 2).IsEquivalent(
29 Position::BeforeNode(*sample->lastChild()))); 29 Position::BeforeNode(*sample->lastChild())));
30 EXPECT_TRUE(Position(sample, 3).IsEquivalent( 30 EXPECT_TRUE(Position(sample, 3).IsEquivalent(
31 Position::AfterNode(*sample->lastChild()))); 31 Position::AfterNode(*sample->lastChild())));
32 EXPECT_TRUE( 32 EXPECT_TRUE(
33 Position(sample, 3).IsEquivalent(Position::LastPositionInNode(sample))); 33 Position(sample, 3).IsEquivalent(Position::LastPositionInNode(*sample)));
34 34
35 EXPECT_FALSE(Position(sample, 0).IsEquivalent(Position(sample, 1))); 35 EXPECT_FALSE(Position(sample, 0).IsEquivalent(Position(sample, 1)));
36 EXPECT_FALSE( 36 EXPECT_FALSE(
37 Position(sample, 0).IsEquivalent(Position::LastPositionInNode(sample))); 37 Position(sample, 0).IsEquivalent(Position::LastPositionInNode(*sample)));
38 } 38 }
39 39
40 TEST_F(PositionTest, NodeAsRangeLastNodeNull) { 40 TEST_F(PositionTest, NodeAsRangeLastNodeNull) {
41 EXPECT_EQ(nullptr, Position().NodeAsRangeLastNode()); 41 EXPECT_EQ(nullptr, Position().NodeAsRangeLastNode());
42 EXPECT_EQ(nullptr, PositionInFlatTree().NodeAsRangeLastNode()); 42 EXPECT_EQ(nullptr, PositionInFlatTree().NodeAsRangeLastNode());
43 } 43 }
44 44
45 TEST_F(PositionTest, editingPositionOfWithEditingIgnoresContent) { 45 TEST_F(PositionTest, editingPositionOfWithEditingIgnoresContent) {
46 const char* body_content = 46 const char* body_content =
47 "<textarea id=textarea></textarea><a id=child1>1</a><b id=child2>2</b>"; 47 "<textarea id=textarea></textarea><a id=child1>1</a><b id=child2>2</b>";
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 const char* shadow_content = ""; 222 const char* shadow_content = "";
223 SetBodyContent(body_content); 223 SetBodyContent(body_content);
224 ShadowRoot* shadow_root = SetShadowContent(shadow_content, "host"); 224 ShadowRoot* shadow_root = SetShadowContent(shadow_content, "host");
225 Element* host = GetDocument().getElementById("host"); 225 Element* host = GetDocument().getElementById("host");
226 226
227 EXPECT_EQ(PositionInFlatTree(host, PositionAnchorType::kAfterChildren), 227 EXPECT_EQ(PositionInFlatTree(host, PositionAnchorType::kAfterChildren),
228 ToPositionInFlatTree(Position(shadow_root, 0))); 228 ToPositionInFlatTree(Position(shadow_root, 0)));
229 } 229 }
230 230
231 } // namespace blink 231 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698