OLD | NEW |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 Text* DocumentMarkerControllerTest::createTextNode(const char* textContents) { | 66 Text* DocumentMarkerControllerTest::createTextNode(const char* textContents) { |
67 return document().createTextNode(String::fromUTF8(textContents)); | 67 return document().createTextNode(String::fromUTF8(textContents)); |
68 } | 68 } |
69 | 69 |
70 void DocumentMarkerControllerTest::markNodeContents(Node* node) { | 70 void DocumentMarkerControllerTest::markNodeContents(Node* node) { |
71 // Force layoutObjects to be created; TextIterator, which is used in | 71 // Force layoutObjects to be created; TextIterator, which is used in |
72 // DocumentMarkerControllerTest::addMarker(), needs them. | 72 // DocumentMarkerControllerTest::addMarker(), needs them. |
73 document().updateStyleAndLayout(); | 73 document().updateStyleAndLayout(); |
74 auto range = EphemeralRange::rangeOfContents(*node); | 74 auto range = EphemeralRange::rangeOfContents(*node); |
75 markerController().addMarker(range.startPosition(), range.endPosition(), | 75 markerController().addTextMatchMarker(range, false); |
76 DocumentMarker::TextMatch); | |
77 } | 76 } |
78 | 77 |
79 void DocumentMarkerControllerTest::setBodyInnerHTML(const char* bodyContent) { | 78 void DocumentMarkerControllerTest::setBodyInnerHTML(const char* bodyContent) { |
80 document().body()->setInnerHTML(String::fromUTF8(bodyContent)); | 79 document().body()->setInnerHTML(String::fromUTF8(bodyContent)); |
81 } | 80 } |
82 | 81 |
83 TEST_F(DocumentMarkerControllerTest, DidMoveToNewDocument) { | 82 TEST_F(DocumentMarkerControllerTest, DidMoveToNewDocument) { |
84 setBodyInnerHTML("<b><i>foo</i></b>"); | 83 setBodyInnerHTML("<b><i>foo</i></b>"); |
85 Element* parent = toElement(document().body()->firstChild()->firstChild()); | 84 Element* parent = toElement(document().body()->firstChild()->firstChild()); |
86 markNodeContents(parent); | 85 markNodeContents(parent); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 // Try to make active a marker that doesn't exist. | 222 // Try to make active a marker that doesn't exist. |
224 EXPECT_FALSE(markerController().setTextMatchMarkersActive(range, true)); | 223 EXPECT_FALSE(markerController().setTextMatchMarkersActive(range, true)); |
225 | 224 |
226 // Add a marker and try it once more. | 225 // Add a marker and try it once more. |
227 markerController().addTextMatchMarker(range, false); | 226 markerController().addTextMatchMarker(range, false); |
228 EXPECT_EQ(1u, markerController().markers().size()); | 227 EXPECT_EQ(1u, markerController().markers().size()); |
229 EXPECT_TRUE(markerController().setTextMatchMarkersActive(range, true)); | 228 EXPECT_TRUE(markerController().setTextMatchMarkersActive(range, true)); |
230 } | 229 } |
231 | 230 |
232 } // namespace blink | 231 } // namespace blink |
OLD | NEW |