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

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

Issue 2736613003: Get rid of FrameSelection::setSelection() taking VisibleSelection (Closed)
Patch Set: 2017-03-07T13:53:20 rebase Created 3 years, 9 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 "bindings/core/v8/ExceptionState.h" 5 #include "bindings/core/v8/ExceptionState.h"
6 #include "core/dom/Document.h" 6 #include "core/dom/Document.h"
7 #include "core/dom/Element.h" 7 #include "core/dom/Element.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/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 dummyPageHolder().frame().settings()->setSelectionStrategy( 94 dummyPageHolder().frame().settings()->setSelectionStrategy(
95 SelectionStrategy::Direction); 95 SelectionStrategy::Direction);
96 } 96 }
97 97
98 Document& GranularityStrategyTest::document() const { 98 Document& GranularityStrategyTest::document() const {
99 return *m_document; 99 return *m_document;
100 } 100 }
101 101
102 void GranularityStrategyTest::setSelection( 102 void GranularityStrategyTest::setSelection(
103 const VisibleSelection& newSelection) { 103 const VisibleSelection& newSelection) {
104 m_dummyPageHolder->frame().selection().setSelection(newSelection); 104 m_dummyPageHolder->frame().selection().setSelection(
105 newSelection.asSelection());
105 } 106 }
106 107
107 FrameSelection& GranularityStrategyTest::selection() const { 108 FrameSelection& GranularityStrategyTest::selection() const {
108 return m_dummyPageHolder->frame().selection(); 109 return m_dummyPageHolder->frame().selection();
109 } 110 }
110 111
111 Text* GranularityStrategyTest::appendTextNode(const String& data) { 112 Text* GranularityStrategyTest::appendTextNode(const String& data) {
112 Text* text = document().createTextNode(data); 113 Text* text = document().createTextNode(data);
113 document().body()->appendChild(text); 114 document().body()->appendChild(text);
114 return text; 115 return text;
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 selection().setSelection( 702 selection().setSelection(
702 SelectionInDOMTree::Builder() 703 SelectionInDOMTree::Builder()
703 .setBaseAndExtent(Position(text, 15), Position(text, 22)) 704 .setBaseAndExtent(Position(text, 15), Position(text, 22))
704 .build()); 705 .build());
705 EXPECT_EQ_SELECTED_TEXT("mnopqr "); 706 EXPECT_EQ_SELECTED_TEXT("mnopqr ");
706 selection().moveRangeSelectionExtent(m_wordMiddles[4]); 707 selection().moveRangeSelectionExtent(m_wordMiddles[4]);
707 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin"); 708 EXPECT_EQ_SELECTED_TEXT("mnopqr iiin");
708 } 709 }
709 710
710 } // namespace blink 711 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698