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

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

Issue 1605863002: Restart search in page when new text is found. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added default value for local var Created 4 years, 10 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 setBodyInnerHTML("<div style='margin: 100px'>foo</div>"); 246 setBodyInnerHTML("<div style='margin: 100px'>foo</div>");
247 RefPtrWillBeRawPtr<Node> text = document().body()->firstChild()->firstChild( ); 247 RefPtrWillBeRawPtr<Node> text = document().body()->firstChild()->firstChild( );
248 document().updateLayout(); 248 document().updateLayout();
249 markerController().addCompositionMarker(Position(text, 0), Position(text, 1) , Color::black, false, Color::black); 249 markerController().addCompositionMarker(Position(text, 0), Position(text, 1) , Color::black, false, Color::black);
250 markerController().addCompositionMarker(Position(text, 1), Position(text, 3) , Color::black, true, Color::black); 250 markerController().addCompositionMarker(Position(text, 1), Position(text, 3) , Color::black, true, Color::black);
251 251
252 EXPECT_EQ(2u, markerController().markers().size()); 252 EXPECT_EQ(2u, markerController().markers().size());
253 } 253 }
254 254
255 TEST_F(DocumentMarkerControllerTest, SetMarkerActiveTest)
256 {
257 setBodyInnerHTML("<b>foo</b>");
258 RefPtrWillBeRawPtr<Element> bElement = toElement(document().body()->firstChi ld());
259 EphemeralRange ephemeralRange = EphemeralRange::rangeOfContents(*bElement);
260 Position startBElement = toPositionInDOMTree(ephemeralRange.startPosition()) ;
261 Position endBElement = toPositionInDOMTree(ephemeralRange.endPosition());
262 RefPtrWillBeRawPtr<Range> range = Range::create(document(), startBElement, e ndBElement);
263 // Try to make active a marker that doesn't exist.
264 EXPECT_FALSE(markerController().setMarkersActive(range.get(), true));
265
266 // Add a marker and try it once more.
267 markerController().addTextMatchMarker(range.get(), false);
268 EXPECT_EQ(1u, markerController().markers().size());
269 EXPECT_TRUE(markerController().setMarkersActive(range.get(), true));
270 }
271
255 } // namespace blink 272 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698