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

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

Issue 2905753002: [DMC #17] Make TextMatchMarkers constructible in single step (Closed)
Patch Set: Fix build error Created 3 years, 6 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/TextMatchMarkerListImpl.h" 5 #include "core/editing/markers/TextMatchMarkerListImpl.h"
6 6
7 #include "core/editing/EditingTestBase.h" 7 #include "core/editing/EditingTestBase.h"
8 #include "core/editing/markers/TextMatchMarker.h"
8 9
9 namespace blink { 10 namespace blink {
10 11
11 class TextMatchMarkerListImplTest : public EditingTestBase { 12 class TextMatchMarkerListImplTest : public EditingTestBase {
12 protected: 13 protected:
13 TextMatchMarkerListImplTest() : marker_list_(new TextMatchMarkerListImpl()) {} 14 TextMatchMarkerListImplTest() : marker_list_(new TextMatchMarkerListImpl()) {}
14 15
15 DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) { 16 DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) {
16 return new DocumentMarker(start_offset, end_offset, 17 return new TextMatchMarker(start_offset, end_offset,
17 DocumentMarker::MatchStatus::kInactive); 18 DocumentMarker::MatchStatus::kInactive);
18 } 19 }
19 20
20 Persistent<TextMatchMarkerListImpl> marker_list_; 21 Persistent<TextMatchMarkerListImpl> marker_list_;
21 }; 22 };
22 23
23 TEST_F(TextMatchMarkerListImplTest, MarkerType) { 24 TEST_F(TextMatchMarkerListImplTest, MarkerType) {
24 EXPECT_EQ(DocumentMarker::kTextMatch, marker_list_->MarkerType()); 25 EXPECT_EQ(DocumentMarker::kTextMatch, marker_list_->MarkerType());
25 } 26 }
26 27
27 TEST_F(TextMatchMarkerListImplTest, Add) { 28 TEST_F(TextMatchMarkerListImplTest, Add) {
28 EXPECT_EQ(0u, marker_list_->GetMarkers().size()); 29 EXPECT_EQ(0u, marker_list_->GetMarkers().size());
29 30
30 marker_list_->Add(CreateMarker(0, 1)); 31 marker_list_->Add(CreateMarker(0, 1));
31 marker_list_->Add(CreateMarker(1, 2)); 32 marker_list_->Add(CreateMarker(1, 2));
32 33
33 EXPECT_EQ(2u, marker_list_->GetMarkers().size()); 34 EXPECT_EQ(2u, marker_list_->GetMarkers().size());
34 35
35 EXPECT_EQ(0u, marker_list_->GetMarkers()[0]->StartOffset()); 36 EXPECT_EQ(0u, marker_list_->GetMarkers()[0]->StartOffset());
36 EXPECT_EQ(1u, marker_list_->GetMarkers()[0]->EndOffset()); 37 EXPECT_EQ(1u, marker_list_->GetMarkers()[0]->EndOffset());
37 38
38 EXPECT_EQ(1u, marker_list_->GetMarkers()[1]->StartOffset()); 39 EXPECT_EQ(1u, marker_list_->GetMarkers()[1]->StartOffset());
39 EXPECT_EQ(2u, marker_list_->GetMarkers()[1]->EndOffset()); 40 EXPECT_EQ(2u, marker_list_->GetMarkers()[1]->EndOffset());
40 } 41 }
41 42
42 } // namespace blink 43 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698