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/DocumentMarker.h" | 5 #include "core/editing/markers/DocumentMarker.h" |
6 | 6 |
7 #include "core/editing/markers/TextMatchMarker.h" | |
8 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
9 | 8 |
10 namespace blink { | 9 namespace blink { |
11 | 10 |
12 using MarkerOffsets = DocumentMarker::MarkerOffsets; | 11 using MarkerOffsets = DocumentMarker::MarkerOffsets; |
13 | 12 |
14 class DocumentMarkerTest : public ::testing::Test { | 13 class DocumentMarkerTest : public ::testing::Test { |
15 protected: | 14 protected: |
16 DocumentMarker* CreateMarker(unsigned startOffset, unsigned endOffset) { | 15 DocumentMarker* CreateMarker(unsigned startOffset, unsigned endOffset) { |
17 return new TextMatchMarker(startOffset, endOffset, | 16 return new DocumentMarker(startOffset, endOffset, |
18 DocumentMarker::MatchStatus::kInactive); | 17 DocumentMarker::MatchStatus::kInactive); |
19 } | 18 } |
20 }; | 19 }; |
21 | 20 |
22 TEST_F(DocumentMarkerTest, MarkerTypeIteratorEmpty) { | 21 TEST_F(DocumentMarkerTest, MarkerTypeIteratorEmpty) { |
23 DocumentMarker::MarkerTypes types(0); | 22 DocumentMarker::MarkerTypes types(0); |
24 EXPECT_TRUE(types.begin() == types.end()); | 23 EXPECT_TRUE(types.begin() == types.end()); |
25 } | 24 } |
26 | 25 |
27 TEST_F(DocumentMarkerTest, MarkerTypeIteratorOne) { | 26 TEST_F(DocumentMarkerTest, MarkerTypeIteratorOne) { |
28 DocumentMarker::MarkerTypes types(DocumentMarker::kSpelling); | 27 DocumentMarker::MarkerTypes types(DocumentMarker::kSpelling); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 EXPECT_EQ(WTF::nullopt, result); | 209 EXPECT_EQ(WTF::nullopt, result); |
211 } | 210 } |
212 | 211 |
213 TEST_F(DocumentMarkerTest, GetShiftedMarkerPosition_ReplaceBeforeAndEnd) { | 212 TEST_F(DocumentMarkerTest, GetShiftedMarkerPosition_ReplaceBeforeAndEnd) { |
214 DocumentMarker* marker = CreateMarker(5, 10); | 213 DocumentMarker* marker = CreateMarker(5, 10); |
215 Optional<MarkerOffsets> result = marker->ComputeOffsetsAfterShift(4, 6, 1); | 214 Optional<MarkerOffsets> result = marker->ComputeOffsetsAfterShift(4, 6, 1); |
216 EXPECT_EQ(WTF::nullopt, result); | 215 EXPECT_EQ(WTF::nullopt, result); |
217 } | 216 } |
218 | 217 |
219 } // namespace blink | 218 } // namespace blink |
OLD | NEW |