Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerListTest.cpp

Issue 2780313002: [WIP] Refactor DocumentMarker (Closed)
Patch Set: Move CompositionMarkerList::at() into this CL Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/DocumentMarkerList.h" 5 #include "core/editing/markers/DocumentMarkerList.h"
6 6
7 #include "core/editing/markers/CompositionMarker.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 DocumentMarkerListForTesting : public DocumentMarkerList { 13 class DocumentMarkerListForTesting : public DocumentMarkerList {
13 public: 14 public:
14 DocumentMarkerListForTesting() {} 15 DocumentMarkerListForTesting() {}
15 16
16 DocumentMarker::MarkerType allowedMarkerType() const final { 17 DocumentMarker::MarkerType allowedMarkerType() const final {
(...skipping 16 matching lines...) Expand all
33 bool markerListIsSorted() const final { return true; } 34 bool markerListIsSorted() const final { return true; }
34 }; 35 };
35 36
36 class DocumentMarkerListTest : public ::testing::Test { 37 class DocumentMarkerListTest : public ::testing::Test {
37 protected: 38 protected:
38 DocumentMarkerListTest() 39 DocumentMarkerListTest()
39 : m_markerList(new DocumentMarkerListForTesting()), 40 : m_markerList(new DocumentMarkerListForTesting()),
40 m_sortedMarkerList(new SortedDocumentMarkerListForTesting()) {} 41 m_sortedMarkerList(new SortedDocumentMarkerListForTesting()) {}
41 42
42 DocumentMarker* createMarker(unsigned startOffset, unsigned endOffset) { 43 DocumentMarker* createMarker(unsigned startOffset, unsigned endOffset) {
43 return new DocumentMarker(startOffset, endOffset, Color::black, false, 44 return new CompositionMarker(startOffset, endOffset, Color::black, false,
44 Color::black); 45 Color::black);
45 } 46 }
46 47
47 Persistent<DocumentMarkerListForTesting> m_markerList; 48 Persistent<DocumentMarkerListForTesting> m_markerList;
48 Persistent<SortedDocumentMarkerListForTesting> m_sortedMarkerList; 49 Persistent<SortedDocumentMarkerListForTesting> m_sortedMarkerList;
49 }; 50 };
50 51
51 TEST_F(DocumentMarkerListTest, 52 TEST_F(DocumentMarkerListTest,
52 RemoveMarkersDoRemovePartiallyOverlappingNoOpRemoval) { 53 RemoveMarkersDoRemovePartiallyOverlappingNoOpRemoval) {
53 m_markerList->add(createMarker(0, 5)); 54 m_markerList->add(createMarker(0, 5));
54 55
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 EXPECT_EQ(1u, dstList->at(0)->endOffset()); 253 EXPECT_EQ(1u, dstList->at(0)->endOffset());
253 254
254 EXPECT_EQ(2u, dstList->at(1)->startOffset()); 255 EXPECT_EQ(2u, dstList->at(1)->startOffset());
255 EXPECT_EQ(3u, dstList->at(1)->endOffset()); 256 EXPECT_EQ(3u, dstList->at(1)->endOffset());
256 257
257 EXPECT_EQ(4u, dstList->at(2)->startOffset()); 258 EXPECT_EQ(4u, dstList->at(2)->startOffset());
258 EXPECT_EQ(4u, dstList->at(2)->endOffset()); 259 EXPECT_EQ(4u, dstList->at(2)->endOffset());
259 } 260 }
260 261
261 } // namespace blink 262 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698