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

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

Issue 2766003002: Add DocumentMarker::createCompositionMarker() (Closed)
Patch Set: Rebase 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/DocumentMarkerListTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/EditingMarkerList.h" 5 #include "core/editing/markers/EditingMarkerList.h"
6 6
7 #include "platform/heap/Handle.h" 7 #include "platform/heap/Handle.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 class EditingMarkerListForTesting : public EditingMarkerList { 12 class EditingMarkerListForTesting : public EditingMarkerList {
13 public: 13 public:
14 DocumentMarker::MarkerType allowedMarkerType() const final { 14 DocumentMarker::MarkerType allowedMarkerType() const final {
15 return DocumentMarker::Composition; 15 return DocumentMarker::Composition;
16 } 16 }
17 17
18 bool markerListIsSortedPublicForTesting() const { 18 bool markerListIsSortedPublicForTesting() const {
19 return markerListIsSorted(); 19 return markerListIsSorted();
20 } 20 }
21 }; 21 };
22 22
23 class EditingMarkerListTest : public ::testing::Test { 23 class EditingMarkerListTest : public ::testing::Test {
24 protected: 24 protected:
25 EditingMarkerListTest() : m_markerList(new EditingMarkerListForTesting()) {} 25 EditingMarkerListTest() : m_markerList(new EditingMarkerListForTesting()) {}
26 26
27 DocumentMarker* createMarker(unsigned startOffset, unsigned endOffset) { 27 DocumentMarker* createMarker(unsigned startOffset, unsigned endOffset) {
28 return new DocumentMarker(startOffset, endOffset, Color::black, false, 28 return DocumentMarker::createCompositionMarker(
29 Color::black); 29 startOffset, endOffset, Color::black, false, Color::black);
30 } 30 }
31 31
32 Persistent<EditingMarkerListForTesting> m_markerList; 32 Persistent<EditingMarkerListForTesting> m_markerList;
33 }; 33 };
34 34
35 TEST_F(EditingMarkerListTest, NewlyConstructedListIsSorted) { 35 TEST_F(EditingMarkerListTest, NewlyConstructedListIsSorted) {
36 EXPECT_TRUE(m_markerList->markerListIsSortedPublicForTesting()); 36 EXPECT_TRUE(m_markerList->markerListIsSortedPublicForTesting());
37 } 37 }
38 38
39 TEST_F(EditingMarkerListTest, InsertingMarkersInSortedOrderKeepsListSorted) { 39 TEST_F(EditingMarkerListTest, InsertingMarkersInSortedOrderKeepsListSorted) {
(...skipping 11 matching lines...) Expand all
51 51
52 TEST_F(EditingMarkerListTest, ClearingListMakesItSorted) { 52 TEST_F(EditingMarkerListTest, ClearingListMakesItSorted) {
53 m_markerList->add(createMarker(1, 2)); 53 m_markerList->add(createMarker(1, 2));
54 m_markerList->add(createMarker(0, 1)); 54 m_markerList->add(createMarker(0, 1));
55 EXPECT_FALSE(m_markerList->markerListIsSortedPublicForTesting()); 55 EXPECT_FALSE(m_markerList->markerListIsSortedPublicForTesting());
56 m_markerList->clear(); 56 m_markerList->clear();
57 EXPECT_TRUE(m_markerList->markerListIsSortedPublicForTesting()); 57 EXPECT_TRUE(m_markerList->markerListIsSortedPublicForTesting());
58 } 58 }
59 59
60 } // namespace blink 60 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/DocumentMarkerListTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698