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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLTextFormControlElementTest.cpp

Issue 2341053002: Mark the createVisiblePosition overloads as deprecated (Closed)
Patch Set: minor revision Created 4 years, 3 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/html/HTMLTextFormControlElement.h" 5 #include "core/html/HTMLTextFormControlElement.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/dom/Text.h" 8 #include "core/dom/Text.h"
9 #include "core/editing/FrameSelection.h" 9 #include "core/editing/FrameSelection.h"
10 #include "core/editing/Position.h" 10 #include "core/editing/Position.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 EXPECT_EQ(startLayoutCount, layoutCount()); 122 EXPECT_EQ(startLayoutCount, layoutCount());
123 newCaretRect = LayoutRect(frameSelection.absoluteCaretBounds()); 123 newCaretRect = LayoutRect(frameSelection.absoluteCaretBounds());
124 EXPECT_NE(oldCaretRect, newCaretRect); 124 EXPECT_NE(oldCaretRect, newCaretRect);
125 } 125 }
126 126
127 typedef Position (*PositionFunction)(const Position&); 127 typedef Position (*PositionFunction)(const Position&);
128 typedef VisiblePosition(*VisblePositionFunction)(const VisiblePosition&); 128 typedef VisiblePosition(*VisblePositionFunction)(const VisiblePosition&);
129 129
130 void testFunctionEquivalence(const Position& position, PositionFunction position Function, VisblePositionFunction visibleFunction) 130 void testFunctionEquivalence(const Position& position, PositionFunction position Function, VisblePositionFunction visibleFunction)
131 { 131 {
132 VisiblePosition visiblePosition = createVisiblePosition(position); 132 VisiblePosition visiblePosition = createVisiblePositionDeprecated(position);
133 VisiblePosition expected = visibleFunction(visiblePosition); 133 VisiblePosition expected = visibleFunction(visiblePosition);
134 VisiblePosition actual = createVisiblePosition(positionFunction(position)); 134 VisiblePosition actual = createVisiblePositionDeprecated(positionFunction(po sition));
135 EXPECT_EQ(expected.deepEquivalent(), actual.deepEquivalent()); 135 EXPECT_EQ(expected.deepEquivalent(), actual.deepEquivalent());
136 } 136 }
137 137
138 static VisiblePosition startOfWord(const VisiblePosition& position) 138 static VisiblePosition startOfWord(const VisiblePosition& position)
139 { 139 {
140 return startOfWord(position, LeftWordIfOnBoundary); 140 return startOfWord(position, LeftWordIfOnBoundary);
141 } 141 }
142 142
143 static VisiblePosition endOfWord(const VisiblePosition& position) 143 static VisiblePosition endOfWord(const VisiblePosition& position)
144 { 144 {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 TEST_F(HTMLTextFormControlElementTest, IndexForPosition) 219 TEST_F(HTMLTextFormControlElementTest, IndexForPosition)
220 { 220 {
221 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu t")); 221 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu t"));
222 input->setValue("Hello"); 222 input->setValue("Hello");
223 HTMLElement* innerEditor = input->innerEditorElement(); 223 HTMLElement* innerEditor = input->innerEditorElement();
224 EXPECT_EQ(5, HTMLTextFormControlElement::indexForPosition(innerEditor, Posit ion(innerEditor, PositionAnchorType::AfterAnchor))); 224 EXPECT_EQ(5, HTMLTextFormControlElement::indexForPosition(innerEditor, Posit ion(innerEditor, PositionAnchorType::AfterAnchor)));
225 } 225 }
226 226
227 } // namespace blink 227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698