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

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

Issue 2908643002: [DMC #23] Add CompositionMarker (subclass of DocumentMarker) (Closed)
Patch Set: Attempt to fix Android build by using EXPECT_FALSE() 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/CompositionMarkerListImpl.h" 5 #include "core/editing/markers/CompositionMarkerListImpl.h"
6 6
7 #include "core/editing/EditingTestBase.h" 7 #include "core/editing/EditingTestBase.h"
8 #include "core/editing/markers/CompositionMarker.h"
8 9
9 namespace blink { 10 namespace blink {
10 11
11 class CompositionMarkerListImplTest : public EditingTestBase { 12 class CompositionMarkerListImplTest : public EditingTestBase {
12 protected: 13 protected:
13 CompositionMarkerListImplTest() 14 CompositionMarkerListImplTest()
14 : marker_list_(new CompositionMarkerListImpl()) {} 15 : marker_list_(new CompositionMarkerListImpl()) {}
15 16
16 DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) { 17 DocumentMarker* CreateMarker(unsigned start_offset, unsigned end_offset) {
17 return new DocumentMarker(start_offset, end_offset, Color::kBlack, false, 18 return new CompositionMarker(start_offset, end_offset, Color::kBlack, false,
18 Color::kBlack); 19 Color::kBlack);
19 } 20 }
20 21
21 Persistent<CompositionMarkerListImpl> marker_list_; 22 Persistent<CompositionMarkerListImpl> marker_list_;
22 }; 23 };
23 24
24 // CompositionMarkerListImpl shouldn't merge markers with touching endpoints 25 // CompositionMarkerListImpl shouldn't merge markers with touching endpoints
25 TEST_F(CompositionMarkerListImplTest, Add) { 26 TEST_F(CompositionMarkerListImplTest, Add) {
26 EXPECT_EQ(0u, marker_list_->GetMarkers().size()); 27 EXPECT_EQ(0u, marker_list_->GetMarkers().size());
27 28
28 marker_list_->Add(CreateMarker(0, 1)); 29 marker_list_->Add(CreateMarker(0, 1));
29 marker_list_->Add(CreateMarker(1, 2)); 30 marker_list_->Add(CreateMarker(1, 2));
30 31
31 EXPECT_EQ(2u, marker_list_->GetMarkers().size()); 32 EXPECT_EQ(2u, marker_list_->GetMarkers().size());
32 33
33 EXPECT_EQ(0u, marker_list_->GetMarkers()[0]->StartOffset()); 34 EXPECT_EQ(0u, marker_list_->GetMarkers()[0]->StartOffset());
34 EXPECT_EQ(1u, marker_list_->GetMarkers()[0]->EndOffset()); 35 EXPECT_EQ(1u, marker_list_->GetMarkers()[0]->EndOffset());
35 36
36 EXPECT_EQ(1u, marker_list_->GetMarkers()[1]->StartOffset()); 37 EXPECT_EQ(1u, marker_list_->GetMarkers()[1]->StartOffset());
37 EXPECT_EQ(2u, marker_list_->GetMarkers()[1]->EndOffset()); 38 EXPECT_EQ(2u, marker_list_->GetMarkers()[1]->EndOffset());
38 } 39 }
39 40
40 } // namespace blink 41 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698