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

Unified Diff: third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditorTest.cpp

Issue 2922623002: Make DocumentMarkerListEditor::RemoveMarkers() more efficient (Closed)
Patch Set: Remove blank line 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditorTest.cpp
diff --git a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditorTest.cpp b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditorTest.cpp
index 2bf66f992c01c434e0b594209fe7f0e453282900..30c4bdfd771b0ec2938f291d2f276b266210a46f 100644
--- a/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditorTest.cpp
+++ b/third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditorTest.cpp
@@ -17,6 +17,40 @@ class DocumentMarkerListEditorTest : public ::testing::Test {
}
};
+TEST_F(DocumentMarkerListEditorTest, RemoveMarkersEmptyList) {
+ DocumentMarkerListEditor::MarkerList markers;
+ DocumentMarkerListEditor::RemoveMarkers(&markers, 0, 10);
+ EXPECT_EQ(0u, markers.size());
+}
+
+TEST_F(DocumentMarkerListEditorTest, RemoveMarkersTouchingEndpoints) {
+ DocumentMarkerListEditor::MarkerList markers;
+ markers.push_back(CreateMarker(0, 10));
+ markers.push_back(CreateMarker(10, 20));
+ markers.push_back(CreateMarker(20, 30));
+
+ DocumentMarkerListEditor::RemoveMarkers(&markers, 10, 10);
+
+ EXPECT_EQ(2u, markers.size());
+
+ EXPECT_EQ(0u, markers[0]->StartOffset());
+ EXPECT_EQ(10u, markers[0]->EndOffset());
+
+ EXPECT_EQ(20u, markers[1]->StartOffset());
+ EXPECT_EQ(30u, markers[1]->EndOffset());
+}
+
+TEST_F(DocumentMarkerListEditorTest, RemoveMarkersOneCharacterIntoInterior) {
+ DocumentMarkerListEditor::MarkerList markers;
+ markers.push_back(CreateMarker(0, 10));
+ markers.push_back(CreateMarker(10, 20));
+ markers.push_back(CreateMarker(20, 30));
+
+ DocumentMarkerListEditor::RemoveMarkers(&markers, 9, 12);
+
+ EXPECT_EQ(0u, markers.size());
+}
+
TEST_F(DocumentMarkerListEditorTest,
ContentDependentMarker_ReplaceStartOfMarker) {
DocumentMarkerListEditor::MarkerList markers;
« no previous file with comments | « third_party/WebKit/Source/core/editing/markers/DocumentMarkerListEditor.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698