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

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

Issue 2894393002: [DMC #10] Add type cast for TextMatchMarkerListImpl (Closed)
Patch Set: Rebase Created 3 years, 7 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/TextMatchMarkerListImpl.h ('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. 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/RenderedDocumentMarker.h" 8 #include "core/editing/markers/RenderedDocumentMarker.h"
9 9
10 namespace blink { 10 namespace blink {
11 11
12 class TextMatchMarkerListImplTest : public EditingTestBase { 12 class TextMatchMarkerListImplTest : public EditingTestBase {
13 protected: 13 protected:
14 TextMatchMarkerListImplTest() : marker_list_(new TextMatchMarkerListImpl()) {} 14 TextMatchMarkerListImplTest() : marker_list_(new TextMatchMarkerListImpl()) {}
15 15
16 DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) { 16 DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) {
17 return new DocumentMarker(start_offset, end_offset, 17 return new DocumentMarker(start_offset, end_offset,
18 DocumentMarker::MatchStatus::kInactive); 18 DocumentMarker::MatchStatus::kInactive);
19 } 19 }
20 20
21 Persistent<TextMatchMarkerListImpl> marker_list_; 21 Persistent<TextMatchMarkerListImpl> marker_list_;
22 }; 22 };
23 23
24 TEST_F(TextMatchMarkerListImplTest, MarkerType) {
25 EXPECT_EQ(DocumentMarker::kTextMatch, marker_list_->MarkerType());
26 }
27
24 TEST_F(TextMatchMarkerListImplTest, Add) { 28 TEST_F(TextMatchMarkerListImplTest, Add) {
25 EXPECT_EQ(0u, marker_list_->GetMarkers().size()); 29 EXPECT_EQ(0u, marker_list_->GetMarkers().size());
26 30
27 marker_list_->Add(CreateMarker(0, 1)); 31 marker_list_->Add(CreateMarker(0, 1));
28 marker_list_->Add(CreateMarker(1, 2)); 32 marker_list_->Add(CreateMarker(1, 2));
29 33
30 EXPECT_EQ(2u, marker_list_->GetMarkers().size()); 34 EXPECT_EQ(2u, marker_list_->GetMarkers().size());
31 35
32 EXPECT_EQ(0u, marker_list_->GetMarkers()[0]->StartOffset()); 36 EXPECT_EQ(0u, marker_list_->GetMarkers()[0]->StartOffset());
33 EXPECT_EQ(1u, marker_list_->GetMarkers()[0]->EndOffset()); 37 EXPECT_EQ(1u, marker_list_->GetMarkers()[0]->EndOffset());
34 38
35 EXPECT_EQ(1u, marker_list_->GetMarkers()[1]->StartOffset()); 39 EXPECT_EQ(1u, marker_list_->GetMarkers()[1]->StartOffset());
36 EXPECT_EQ(2u, marker_list_->GetMarkers()[1]->EndOffset()); 40 EXPECT_EQ(2u, marker_list_->GetMarkers()[1]->EndOffset());
37 } 41 }
38 42
39 } // namespace blink 43 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/TextMatchMarkerListImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698