OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/SelectionController.h" | 5 #include "core/editing/SelectionController.h" |
6 | 6 |
7 #include "core/editing/EditingTestBase.h" | 7 #include "core/editing/EditingTestBase.h" |
8 #include "core/editing/FrameSelection.h" | 8 #include "core/editing/FrameSelection.h" |
9 #include "core/input/EventHandler.h" | 9 #include "core/input/EventHandler.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest); | 29 DISALLOW_COPY_AND_ASSIGN(SelectionControllerTest); |
30 }; | 30 }; |
31 | 31 |
32 void SelectionControllerTest::setNonDirectionalSelectionIfNeeded( | 32 void SelectionControllerTest::setNonDirectionalSelectionIfNeeded( |
33 const VisibleSelectionInFlatTree& newSelection, | 33 const VisibleSelectionInFlatTree& newSelection, |
34 TextGranularity granularity) { | 34 TextGranularity granularity) { |
35 frame() | 35 frame() |
36 .eventHandler() | 36 .eventHandler() |
37 .selectionController() | 37 .selectionController() |
38 .setNonDirectionalSelectionIfNeeded( | 38 .setNonDirectionalSelectionIfNeeded( |
39 newSelection, granularity, SelectionController::DoNotAdjustEndpoints); | 39 newSelection, granularity, SelectionController::DoNotAdjustEndpoints, |
| 40 HandleVisibility::NotVisible); |
40 } | 41 } |
41 | 42 |
42 TEST_F(SelectionControllerTest, setNonDirectionalSelectionIfNeeded) { | 43 TEST_F(SelectionControllerTest, setNonDirectionalSelectionIfNeeded) { |
43 const char* bodyContent = "<span id=top>top</span><span id=host></span>"; | 44 const char* bodyContent = "<span id=top>top</span><span id=host></span>"; |
44 const char* shadowContent = "<span id=bottom>bottom</span>"; | 45 const char* shadowContent = "<span id=bottom>bottom</span>"; |
45 setBodyContent(bodyContent); | 46 setBodyContent(bodyContent); |
46 ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host"); | 47 ShadowRoot* shadowRoot = setShadowContent(shadowContent, "host"); |
47 | 48 |
48 Node* top = document().getElementById("top")->firstChild(); | 49 Node* top = document().getElementById("top")->firstChild(); |
49 Node* bottom = shadowRoot->getElementById("bottom")->firstChild(); | 50 Node* bottom = shadowRoot->getElementById("bottom")->firstChild(); |
(...skipping 30 matching lines...) Expand all Loading... |
80 EXPECT_EQ(Position(bottom, 0), visibleSelectionInDOMTree().start()); | 81 EXPECT_EQ(Position(bottom, 0), visibleSelectionInDOMTree().start()); |
81 EXPECT_EQ(Position(bottom, 3), visibleSelectionInDOMTree().end()); | 82 EXPECT_EQ(Position(bottom, 3), visibleSelectionInDOMTree().end()); |
82 | 83 |
83 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().base()); | 84 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().base()); |
84 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().extent()); | 85 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().extent()); |
85 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().start()); | 86 EXPECT_EQ(PositionInFlatTree(top, 1), visibleSelectionInFlatTree().start()); |
86 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().end()); | 87 EXPECT_EQ(PositionInFlatTree(bottom, 3), visibleSelectionInFlatTree().end()); |
87 } | 88 } |
88 | 89 |
89 } // namespace blink | 90 } // namespace blink |
OLD | NEW |