OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/markers/DocumentMarkerListEditor.h" | 5 #include "core/editing/markers/DocumentMarkerListEditor.h" |
6 | 6 |
| 7 #include "core/editing/markers/TextMatchMarker.h" |
7 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
8 | 9 |
9 namespace blink { | 10 namespace blink { |
10 | 11 |
11 class DocumentMarkerListEditorTest : public ::testing::Test { | 12 class DocumentMarkerListEditorTest : public ::testing::Test { |
12 protected: | 13 protected: |
13 DocumentMarker* CreateMarker(unsigned startOffset, unsigned endOffset) { | 14 DocumentMarker* CreateMarker(unsigned startOffset, unsigned endOffset) { |
14 return new DocumentMarker(startOffset, endOffset, | 15 return new TextMatchMarker(startOffset, endOffset, |
15 DocumentMarker::MatchStatus::kInactive); | 16 DocumentMarker::MatchStatus::kInactive); |
16 } | 17 } |
17 }; | 18 }; |
18 | 19 |
19 TEST_F(DocumentMarkerListEditorTest, | 20 TEST_F(DocumentMarkerListEditorTest, |
20 ContentDependentMarker_ReplaceStartOfMarker) { | 21 ContentDependentMarker_ReplaceStartOfMarker) { |
21 DocumentMarkerListEditor::MarkerList markers; | 22 DocumentMarkerListEditor::MarkerList markers; |
22 markers.push_back(CreateMarker(0, 10)); | 23 markers.push_back(CreateMarker(0, 10)); |
23 | 24 |
24 DocumentMarkerListEditor::ShiftMarkersContentDependent(&markers, 0, 5, 5); | 25 DocumentMarkerListEditor::ShiftMarkersContentDependent(&markers, 0, 5, 5); |
25 | 26 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 EXPECT_EQ(5u, markers[0]->EndOffset()); | 359 EXPECT_EQ(5u, markers[0]->EndOffset()); |
359 | 360 |
360 EXPECT_EQ(10u, markers[1]->StartOffset()); | 361 EXPECT_EQ(10u, markers[1]->StartOffset()); |
361 EXPECT_EQ(15u, markers[1]->EndOffset()); | 362 EXPECT_EQ(15u, markers[1]->EndOffset()); |
362 | 363 |
363 EXPECT_EQ(15u, markers[2]->StartOffset()); | 364 EXPECT_EQ(15u, markers[2]->StartOffset()); |
364 EXPECT_EQ(20u, markers[2]->EndOffset()); | 365 EXPECT_EQ(20u, markers[2]->EndOffset()); |
365 } | 366 } |
366 | 367 |
367 } // namespace blink | 368 } // namespace blink |
OLD | NEW |