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

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

Issue 2375383005: Prune CreateVisibleSelectionDeprecated from unit test files (Closed)
Patch Set: Created 4 years, 2 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 innerText->appendChild(Text::create(document(), "xt form.")); 196 innerText->appendChild(Text::create(document(), "xt form."));
197 testBoundary(document(), textControl()); 197 testBoundary(document(), textControl());
198 } 198 }
199 } 199 }
200 200
201 TEST_F(HTMLTextFormControlElementTest, SpellCheckDoesNotCauseUpdateLayout) 201 TEST_F(HTMLTextFormControlElementTest, SpellCheckDoesNotCauseUpdateLayout)
202 { 202 {
203 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu t")); 203 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu t"));
204 input->focus(); 204 input->focus();
205 input->setValue("Hello, input field"); 205 input->setValue("Hello, input field");
206 document().updateStyleAndLayout();
206 VisibleSelection oldSelection = document().frame()->selection().selection(); 207 VisibleSelection oldSelection = document().frame()->selection().selection();
207 208
208 Position newPosition(input->innerEditorElement()->firstChild(), 3); 209 Position newPosition(input->innerEditorElement()->firstChild(), 3);
209 VisibleSelection newSelection = createVisibleSelectionDeprecated(newPosition , TextAffinity::Downstream); 210 VisibleSelection newSelection = createVisibleSelection(newPosition, TextAffi nity::Downstream);
210 document().frame()->selection().setSelection(newSelection, FrameSelection::C loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea rance); 211 document().frame()->selection().setSelection(newSelection, FrameSelection::C loseTyping | FrameSelection::ClearTypingStyle | FrameSelection::DoNotUpdateAppea rance);
211 ASSERT_EQ(3, input->selectionStart()); 212 ASSERT_EQ(3, input->selectionStart());
212 213
213 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame())); 214 Persistent<SpellChecker> spellChecker(SpellChecker::create(page().frame()));
214 forceLayoutFlag(); 215 forceLayoutFlag();
215 int startCount = layoutCount(); 216 int startCount = layoutCount();
216 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT yping | FrameSelection::ClearTypingStyle); 217 spellChecker->respondToChangedSelection(oldSelection, FrameSelection::CloseT yping | FrameSelection::ClearTypingStyle);
217 EXPECT_EQ(startCount, layoutCount()); 218 EXPECT_EQ(startCount, layoutCount());
218 } 219 }
219 220
220 TEST_F(HTMLTextFormControlElementTest, IndexForPosition) 221 TEST_F(HTMLTextFormControlElementTest, IndexForPosition)
221 { 222 {
222 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu t")); 223 HTMLInputElement* input = toHTMLInputElement(document().getElementById("inpu t"));
223 input->setValue("Hello"); 224 input->setValue("Hello");
224 HTMLElement* innerEditor = input->innerEditorElement(); 225 HTMLElement* innerEditor = input->innerEditorElement();
225 EXPECT_EQ(5, HTMLTextFormControlElement::indexForPosition(innerEditor, Posit ion(innerEditor, PositionAnchorType::AfterAnchor))); 226 EXPECT_EQ(5, HTMLTextFormControlElement::indexForPosition(innerEditor, Posit ion(innerEditor, PositionAnchorType::AfterAnchor)));
226 } 227 }
227 228
228 } // namespace blink 229 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698