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