| OLD | NEW |
| 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/editing/SelectionAdjuster.h" | 5 #include "core/editing/SelectionAdjuster.h" |
| 6 | 6 |
| 7 #include "core/editing/EditingTestBase.h" | 7 #include "core/editing/EditingTestBase.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 class MockVisibleSelectionChangeObserver final : | 13 class MockVisibleSelectionChangeObserver final : |
| 14 public NoBaseWillBeGarbageCollectedFinalized<MockVisibleSelectionChangeObser
ver>, | 14 public GarbageCollectedFinalized<MockVisibleSelectionChangeObserver>, |
| 15 public VisibleSelectionChangeObserver { | 15 public VisibleSelectionChangeObserver { |
| 16 WTF_MAKE_NONCOPYABLE(MockVisibleSelectionChangeObserver); | 16 WTF_MAKE_NONCOPYABLE(MockVisibleSelectionChangeObserver); |
| 17 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MockVisibleSelectionChangeObserver); | 17 USING_GARBAGE_COLLECTED_MIXIN(MockVisibleSelectionChangeObserver); |
| 18 public: | 18 public: |
| 19 MockVisibleSelectionChangeObserver() = default; | 19 MockVisibleSelectionChangeObserver() = default; |
| 20 ~MockVisibleSelectionChangeObserver() final = default; | 20 ~MockVisibleSelectionChangeObserver() final = default; |
| 21 | 21 |
| 22 int callCounter() const { return m_callCounter; } | 22 int callCounter() const { return m_callCounter; } |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 // VisibleSelectionChangeObserver interface. | 25 // VisibleSelectionChangeObserver interface. |
| 26 void didChangeVisibleSelection() final { ++m_callCounter; } | 26 void didChangeVisibleSelection() final { ++m_callCounter; } |
| 27 | 27 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 VisibleSelectionInFlatTree selectionInFlatTree( | 63 VisibleSelectionInFlatTree selectionInFlatTree( |
| 64 PositionInFlatTree(foo, 0), | 64 PositionInFlatTree(foo, 0), |
| 65 PositionInFlatTree(foo, 3)); | 65 PositionInFlatTree(foo, 3)); |
| 66 SelectionAdjuster::adjustSelectionInDOMTree(&selection, selectionInFlatTree)
; | 66 SelectionAdjuster::adjustSelectionInDOMTree(&selection, selectionInFlatTree)
; |
| 67 EXPECT_EQ(Position(foo, 0), selection.start()); | 67 EXPECT_EQ(Position(foo, 0), selection.start()); |
| 68 EXPECT_EQ(Position(foo, 3), selection.end()); | 68 EXPECT_EQ(Position(foo, 3), selection.end()); |
| 69 EXPECT_EQ(1, selectionObserver.callCounter()) << "adjustSelectionInDOMTree()
should call didChangeVisibleSelection()"; | 69 EXPECT_EQ(1, selectionObserver.callCounter()) << "adjustSelectionInDOMTree()
should call didChangeVisibleSelection()"; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace blink | 72 } // namespace blink |
| OLD | NEW |