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

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

Issue 2706003002: Get rid of unused functions SelectionAdjuster::adjustSelectionIn{DOM,Flat}Tree (Closed)
Patch Set: 2017-02-20T18:17:58 Created 3 years, 10 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/editing/SelectionAdjuster.h"
6
7 #include "core/editing/EditingTestBase.h"
8
9 namespace blink {
10
11 class SelectionAdjusterTest : public EditingTestBase {};
12
13 TEST_F(SelectionAdjusterTest, adjustSelectionInFlatTree) {
14 setBodyContent("<div id=sample>foo</div>");
15 VisibleSelectionInFlatTree selectionInFlatTree;
16
17 Node* const sample = document().getElementById("sample");
18 Node* const foo = sample->firstChild();
19 // Select "foo"
20 VisibleSelection selection =
21 createVisibleSelection(SelectionInDOMTree::Builder()
22 .collapse(Position(foo, 0))
23 .extend(Position(foo, 3))
24 .build());
25 SelectionAdjuster::adjustSelectionInFlatTree(&selectionInFlatTree, selection);
26 EXPECT_EQ(PositionInFlatTree(foo, 0), selectionInFlatTree.start());
27 EXPECT_EQ(PositionInFlatTree(foo, 3), selectionInFlatTree.end());
28 }
29
30 TEST_F(SelectionAdjusterTest, adjustSelectionInDOMTree) {
31 setBodyContent("<div id=sample>foo</div>");
32 VisibleSelection selection;
33
34 Node* const sample = document().getElementById("sample");
35 Node* const foo = sample->firstChild();
36 // Select "foo"
37 VisibleSelectionInFlatTree selectionInFlatTree =
38 createVisibleSelection(SelectionInFlatTree::Builder()
39 .collapse(PositionInFlatTree(foo, 0))
40 .extend(PositionInFlatTree(foo, 3))
41 .build());
42 SelectionAdjuster::adjustSelectionInDOMTree(&selection, selectionInFlatTree);
43 EXPECT_EQ(Position(foo, 0), selection.start());
44 EXPECT_EQ(Position(foo, 3), selection.end());
45 }
46
47 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698