| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 119 |
| 120 findOptions.findNext = true; | 120 findOptions.findNext = true; |
| 121 ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithi
nFrame, selectionRect)); | 121 ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithi
nFrame, selectionRect)); |
| 122 activeMatch = textFinder().activeMatch(); | 122 activeMatch = textFinder().activeMatch(); |
| 123 ASSERT_TRUE(activeMatch); | 123 ASSERT_TRUE(activeMatch); |
| 124 EXPECT_EQ(textNode, activeMatch->startContainer()); | 124 EXPECT_EQ(textNode, activeMatch->startContainer()); |
| 125 EXPECT_EQ(4, activeMatch->startOffset()); | 125 EXPECT_EQ(4, activeMatch->startOffset()); |
| 126 EXPECT_EQ(textNode, activeMatch->endContainer()); | 126 EXPECT_EQ(textNode, activeMatch->endContainer()); |
| 127 EXPECT_EQ(10, activeMatch->endOffset()); | 127 EXPECT_EQ(10, activeMatch->endOffset()); |
| 128 | 128 |
| 129 // Wrap to the first match (last occurence in the document). | 129 // Wrap to the first match (last occurrence in the document). |
| 130 ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithi
nFrame, selectionRect)); | 130 ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithi
nFrame, selectionRect)); |
| 131 activeMatch = textFinder().activeMatch(); | 131 activeMatch = textFinder().activeMatch(); |
| 132 ASSERT_TRUE(activeMatch); | 132 ASSERT_TRUE(activeMatch); |
| 133 EXPECT_EQ(textNode, activeMatch->startContainer()); | 133 EXPECT_EQ(textNode, activeMatch->startContainer()); |
| 134 EXPECT_EQ(14, activeMatch->startOffset()); | 134 EXPECT_EQ(14, activeMatch->startOffset()); |
| 135 EXPECT_EQ(textNode, activeMatch->endContainer()); | 135 EXPECT_EQ(textNode, activeMatch->endContainer()); |
| 136 EXPECT_EQ(20, activeMatch->endOffset()); | 136 EXPECT_EQ(20, activeMatch->endOffset()); |
| 137 } | 137 } |
| 138 | 138 |
| 139 TEST_F(TextFinderTest, FindTextAutosizing) | 139 TEST_F(TextFinderTest, FindTextAutosizing) |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 // There will be only one iteration before timeout, because increment | 456 // There will be only one iteration before timeout, because increment |
| 457 // of the TimeProxyPlatform timer is greater than timeout threshold. | 457 // of the TimeProxyPlatform timer is greater than timeout threshold. |
| 458 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); | 458 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); |
| 459 while (textFinder().scopingInProgress()) | 459 while (textFinder().scopingInProgress()) |
| 460 runPendingTasks(); | 460 runPendingTasks(); |
| 461 | 461 |
| 462 EXPECT_EQ(4, textFinder().totalMatchCount()); | 462 EXPECT_EQ(4, textFinder().totalMatchCount()); |
| 463 } | 463 } |
| 464 | 464 |
| 465 } // namespace blink | 465 } // namespace blink |
| OLD | NEW |