OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. Use of | 1 // Copyright 2017 The Chromium Authors. All rights reserved. Use of |
2 // this source code is governed by a BSD-style license that can be | 2 // 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/SpellCheckMarkerList.h" | 5 #include "core/editing/markers/SpellCheckMarkerList.h" |
6 | 6 |
| 7 #include "core/editing/markers/SpellCheckMarker.h" |
7 #include "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
9 | 10 |
10 namespace blink { | 11 namespace blink { |
11 | 12 |
12 class SpellCheckMarkerListTest : public ::testing::Test { | 13 class SpellCheckMarkerListTest : public ::testing::Test { |
13 protected: | 14 protected: |
14 SpellCheckMarkerListTest() | 15 SpellCheckMarkerListTest() |
15 : m_markerList(new SpellCheckMarkerList(DocumentMarker::Spelling)) {} | 16 : m_markerList(new SpellCheckMarkerList(DocumentMarker::Spelling)) {} |
16 | 17 |
17 DocumentMarker* createMarker(unsigned startOffset, unsigned endOffset) { | 18 DocumentMarker* createMarker(unsigned startOffset, unsigned endOffset) { |
18 return new DocumentMarker(DocumentMarker::Spelling, startOffset, endOffset, | 19 return new SpellCheckMarker(DocumentMarker::Spelling, startOffset, |
19 emptyString); | 20 endOffset, emptyString); |
20 } | 21 } |
21 | 22 |
22 Persistent<SpellCheckMarkerList> m_markerList; | 23 Persistent<SpellCheckMarkerList> m_markerList; |
23 }; | 24 }; |
24 | 25 |
25 TEST_F(SpellCheckMarkerListTest, AddSorting) { | 26 TEST_F(SpellCheckMarkerListTest, AddSorting) { |
26 // Insert some markers in an arbitrary order and verify that the list stays | 27 // Insert some markers in an arbitrary order and verify that the list stays |
27 // sorted | 28 // sorted |
28 m_markerList->add(createMarker(80, 85)); | 29 m_markerList->add(createMarker(80, 85)); |
29 m_markerList->add(createMarker(40, 45)); | 30 m_markerList->add(createMarker(40, 45)); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 EXPECT_EQ(2u, m_markerList->size()); | 136 EXPECT_EQ(2u, m_markerList->size()); |
136 | 137 |
137 EXPECT_EQ(0u, m_markerList->at(0)->startOffset()); | 138 EXPECT_EQ(0u, m_markerList->at(0)->startOffset()); |
138 EXPECT_EQ(3u, m_markerList->at(0)->endOffset()); | 139 EXPECT_EQ(3u, m_markerList->at(0)->endOffset()); |
139 | 140 |
140 EXPECT_EQ(9u, m_markerList->at(1)->startOffset()); | 141 EXPECT_EQ(9u, m_markerList->at(1)->startOffset()); |
141 EXPECT_EQ(14u, m_markerList->at(1)->endOffset()); | 142 EXPECT_EQ(14u, m_markerList->at(1)->endOffset()); |
142 } | 143 } |
143 | 144 |
144 } // namespace | 145 } // namespace |
OLD | NEW |