| 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 "web/TextFinder.h" | 5 #include "web/TextFinder.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 7 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/dom/NodeList.h" | 9 #include "core/dom/NodeList.h" |
| 10 #include "core/dom/Range.h" | 10 #include "core/dom/Range.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 { | 59 { |
| 60 return *m_textFinder; | 60 return *m_textFinder; |
| 61 } | 61 } |
| 62 | 62 |
| 63 WebFloatRect TextFinderTest::findInPageRect(Node* startContainer, int startOffse
t, Node* endContainer, int endOffset) | 63 WebFloatRect TextFinderTest::findInPageRect(Node* startContainer, int startOffse
t, Node* endContainer, int endOffset) |
| 64 { | 64 { |
| 65 RefPtrWillBeRawPtr<Range> range = Range::create(startContainer->document(),
startContainer, startOffset, endContainer, endOffset); | 65 RefPtrWillBeRawPtr<Range> range = Range::create(startContainer->document(),
startContainer, startOffset, endContainer, endOffset); |
| 66 return WebFloatRect(findInPageRectFromRange(range.get())); | 66 return WebFloatRect(findInPageRectFromRange(range.get())); |
| 67 } | 67 } |
| 68 | 68 |
| 69 TEST_F(TextFinderTest, FindTextSimple) | 69 /*TEST_F(TextFinderTest, FindTextSimple) |
| 70 { | 70 { |
| 71 document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPT
ION); | 71 document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ", ASSERT_NO_EXCEPT
ION); |
| 72 Node* textNode = document().body()->firstChild(); | 72 Node* textNode = document().body()->firstChild(); |
| 73 | 73 |
| 74 int identifier = 0; | 74 int identifier = 0; |
| 75 WebString searchText(String("FindMe")); | 75 WebString searchText(String("FindMe")); |
| 76 WebFindOptions findOptions; // Default. | 76 WebFindOptions findOptions; // Default. |
| 77 bool wrapWithinFrame = true; | 77 bool wrapWithinFrame = true; |
| 78 WebRect* selectionRect = nullptr; | 78 WebRect* selectionRect = nullptr; |
| 79 | 79 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 452 |
| 453 textFinder().resetMatchCount(); | 453 textFinder().resetMatchCount(); |
| 454 | 454 |
| 455 // There will be only one iteration before timeout, because increment | 455 // There will be only one iteration before timeout, because increment |
| 456 // of the TimeProxyPlatform timer is greater than timeout threshold. | 456 // of the TimeProxyPlatform timer is greater than timeout threshold. |
| 457 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); | 457 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); |
| 458 while (textFinder().scopingInProgress()) | 458 while (textFinder().scopingInProgress()) |
| 459 runPendingTasks(); | 459 runPendingTasks(); |
| 460 | 460 |
| 461 EXPECT_EQ(4, textFinder().totalMatchCount()); | 461 EXPECT_EQ(4, textFinder().totalMatchCount()); |
| 462 } | 462 }*/ |
| 463 | 463 |
| 464 } // namespace blink | 464 } // namespace blink |
| OLD | NEW |