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

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

Issue 2830213002: [DMC #1.911] Rename DocumentMarkerController::RemoveMarkers() to RemoveMarkersInRange() (Closed)
Patch Set: Remove dependency 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 Node* text = b_element->firstChild(); 271 Node* text = b_element->firstChild();
272 272
273 // Add marker under "abc" 273 // Add marker under "abc"
274 EphemeralRange marker_range = 274 EphemeralRange marker_range =
275 EphemeralRange(Position(text, 0), Position(text, 3)); 275 EphemeralRange(Position(text, 0), Position(text, 3));
276 GetDocument().Markers().AddTextMatchMarker( 276 GetDocument().Markers().AddTextMatchMarker(
277 marker_range, DocumentMarker::MatchStatus::kInactive); 277 marker_range, DocumentMarker::MatchStatus::kInactive);
278 278
279 // Remove markers that overlap "a" 279 // Remove markers that overlap "a"
280 marker_range = EphemeralRange(Position(text, 0), Position(text, 1)); 280 marker_range = EphemeralRange(Position(text, 0), Position(text, 1));
281 GetDocument().Markers().RemoveMarkers(marker_range, 281 GetDocument().Markers().RemoveMarkersInRange(marker_range,
282 DocumentMarker::AllMarkers()); 282 DocumentMarker::AllMarkers());
283 283
284 EXPECT_EQ(0u, MarkerController().Markers().size()); 284 EXPECT_EQ(0u, MarkerController().Markers().size());
285 } 285 }
286 286
287 TEST_F(DocumentMarkerControllerTest, RemoveMiddleOfMarker) { 287 TEST_F(DocumentMarkerControllerTest, RemoveMiddleOfMarker) {
288 SetBodyInnerHTML("<b>abc</b>"); 288 SetBodyInnerHTML("<b>abc</b>");
289 GetDocument().UpdateStyleAndLayout(); 289 GetDocument().UpdateStyleAndLayout();
290 Node* b_element = GetDocument().body()->FirstChild(); 290 Node* b_element = GetDocument().body()->FirstChild();
291 Node* text = b_element->firstChild(); 291 Node* text = b_element->firstChild();
292 292
293 // Add marker under "abc" 293 // Add marker under "abc"
294 EphemeralRange marker_range = 294 EphemeralRange marker_range =
295 EphemeralRange(Position(text, 0), Position(text, 3)); 295 EphemeralRange(Position(text, 0), Position(text, 3));
296 GetDocument().Markers().AddTextMatchMarker( 296 GetDocument().Markers().AddTextMatchMarker(
297 marker_range, DocumentMarker::MatchStatus::kInactive); 297 marker_range, DocumentMarker::MatchStatus::kInactive);
298 298
299 // Remove markers that overlap "b" 299 // Remove markers that overlap "b"
300 marker_range = EphemeralRange(Position(text, 1), Position(text, 2)); 300 marker_range = EphemeralRange(Position(text, 1), Position(text, 2));
301 GetDocument().Markers().RemoveMarkers(marker_range, 301 GetDocument().Markers().RemoveMarkersInRange(marker_range,
302 DocumentMarker::AllMarkers()); 302 DocumentMarker::AllMarkers());
303 303
304 EXPECT_EQ(0u, MarkerController().Markers().size()); 304 EXPECT_EQ(0u, MarkerController().Markers().size());
305 } 305 }
306 306
307 TEST_F(DocumentMarkerControllerTest, RemoveEndOfMarker) { 307 TEST_F(DocumentMarkerControllerTest, RemoveEndOfMarker) {
308 SetBodyInnerHTML("<b>abc</b>"); 308 SetBodyInnerHTML("<b>abc</b>");
309 GetDocument().UpdateStyleAndLayout(); 309 GetDocument().UpdateStyleAndLayout();
310 Node* b_element = GetDocument().body()->FirstChild(); 310 Node* b_element = GetDocument().body()->FirstChild();
311 Node* text = b_element->firstChild(); 311 Node* text = b_element->firstChild();
312 312
313 // Add marker under "abc" 313 // Add marker under "abc"
314 EphemeralRange marker_range = 314 EphemeralRange marker_range =
315 EphemeralRange(Position(text, 0), Position(text, 3)); 315 EphemeralRange(Position(text, 0), Position(text, 3));
316 GetDocument().Markers().AddTextMatchMarker( 316 GetDocument().Markers().AddTextMatchMarker(
317 marker_range, DocumentMarker::MatchStatus::kInactive); 317 marker_range, DocumentMarker::MatchStatus::kInactive);
318 318
319 // Remove markers that overlap "c" 319 // Remove markers that overlap "c"
320 marker_range = EphemeralRange(Position(text, 2), Position(text, 3)); 320 marker_range = EphemeralRange(Position(text, 2), Position(text, 3));
321 GetDocument().Markers().RemoveMarkers(marker_range, 321 GetDocument().Markers().RemoveMarkersInRange(marker_range,
322 DocumentMarker::AllMarkers()); 322 DocumentMarker::AllMarkers());
323 323
324 EXPECT_EQ(0u, MarkerController().Markers().size()); 324 EXPECT_EQ(0u, MarkerController().Markers().size());
325 } 325 }
326 326
327 } // namespace blink 327 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698