OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "config.h" | 5 #include "config.h" |
6 #include "web/TextFinder.h" | 6 #include "web/TextFinder.h" |
7 | 7 |
8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 8 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
10 #include "core/dom/NodeList.h" | 10 #include "core/dom/NodeList.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 bool wrapWithinFrame = true; | 181 bool wrapWithinFrame = true; |
182 WebRect* selectionRect = nullptr; | 182 WebRect* selectionRect = nullptr; |
183 | 183 |
184 EXPECT_FALSE(textFinder().find(identifier, searchText, findOptions, wrapWith
inFrame, selectionRect)); | 184 EXPECT_FALSE(textFinder().find(identifier, searchText, findOptions, wrapWith
inFrame, selectionRect)); |
185 EXPECT_FALSE(textFinder().activeMatch()); | 185 EXPECT_FALSE(textFinder().activeMatch()); |
186 } | 186 } |
187 | 187 |
188 TEST_F(TextFinderTest, FindTextInShadowDOM) | 188 TEST_F(TextFinderTest, FindTextInShadowDOM) |
189 { | 189 { |
190 document().body()->setInnerHTML("<b>FOO</b><i>foo</i>", ASSERT_NO_EXCEPTION)
; | 190 document().body()->setInnerHTML("<b>FOO</b><i>foo</i>", ASSERT_NO_EXCEPTION)
; |
191 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = document().body()->createShadowR
ootInternal(ShadowRootType::OpenByDefault, ASSERT_NO_EXCEPTION); | 191 RefPtrWillBeRawPtr<ShadowRoot> shadowRoot = document().body()->createShadowR
ootInternal(ShadowRootType::V0, ASSERT_NO_EXCEPTION); |
192 shadowRoot->setInnerHTML("<content select=\"i\"></content><u>Foo</u><content
></content>", ASSERT_NO_EXCEPTION); | 192 shadowRoot->setInnerHTML("<content select=\"i\"></content><u>Foo</u><content
></content>", ASSERT_NO_EXCEPTION); |
193 Node* textInBElement = document().body()->firstChild()->firstChild(); | 193 Node* textInBElement = document().body()->firstChild()->firstChild(); |
194 Node* textInIElement = document().body()->lastChild()->firstChild(); | 194 Node* textInIElement = document().body()->lastChild()->firstChild(); |
195 Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild(); | 195 Node* textInUElement = shadowRoot->childNodes()->item(1)->firstChild(); |
196 | 196 |
197 int identifier = 0; | 197 int identifier = 0; |
198 WebString searchText(String("foo")); | 198 WebString searchText(String("foo")); |
199 WebFindOptions findOptions; // Default. | 199 WebFindOptions findOptions; // Default. |
200 bool wrapWithinFrame = true; | 200 bool wrapWithinFrame = true; |
201 WebRect* selectionRect = nullptr; | 201 WebRect* selectionRect = nullptr; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 // There will be only one iteration before timeout, because increment | 504 // There will be only one iteration before timeout, because increment |
505 // of the TimeProxyPlatform timer is greater than timeout threshold. | 505 // of the TimeProxyPlatform timer is greater than timeout threshold. |
506 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); | 506 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); |
507 while (textFinder().scopingInProgress()) | 507 while (textFinder().scopingInProgress()) |
508 runPendingTasks(); | 508 runPendingTasks(); |
509 | 509 |
510 EXPECT_EQ(4, textFinder().totalMatchCount()); | 510 EXPECT_EQ(4, textFinder().totalMatchCount()); |
511 } | 511 } |
512 | 512 |
513 } // namespace blink | 513 } // namespace blink |
OLD | NEW |