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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 findOptions.findNext = true; | 121 findOptions.findNext = true; |
122 ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithi
nFrame, selectionRect)); | 122 ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithi
nFrame, selectionRect)); |
123 activeMatch = textFinder().activeMatch(); | 123 activeMatch = textFinder().activeMatch(); |
124 ASSERT_TRUE(activeMatch); | 124 ASSERT_TRUE(activeMatch); |
125 EXPECT_EQ(textNode, activeMatch->startContainer()); | 125 EXPECT_EQ(textNode, activeMatch->startContainer()); |
126 EXPECT_EQ(4, activeMatch->startOffset()); | 126 EXPECT_EQ(4, activeMatch->startOffset()); |
127 EXPECT_EQ(textNode, activeMatch->endContainer()); | 127 EXPECT_EQ(textNode, activeMatch->endContainer()); |
128 EXPECT_EQ(10, activeMatch->endOffset()); | 128 EXPECT_EQ(10, activeMatch->endOffset()); |
129 | 129 |
130 // Wrap to the first match (last occurence in the document). | 130 // Wrap to the first match (last occurrence in the document). |
131 ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithi
nFrame, selectionRect)); | 131 ASSERT_TRUE(textFinder().find(identifier, searchText, findOptions, wrapWithi
nFrame, selectionRect)); |
132 activeMatch = textFinder().activeMatch(); | 132 activeMatch = textFinder().activeMatch(); |
133 ASSERT_TRUE(activeMatch); | 133 ASSERT_TRUE(activeMatch); |
134 EXPECT_EQ(textNode, activeMatch->startContainer()); | 134 EXPECT_EQ(textNode, activeMatch->startContainer()); |
135 EXPECT_EQ(14, activeMatch->startOffset()); | 135 EXPECT_EQ(14, activeMatch->startOffset()); |
136 EXPECT_EQ(textNode, activeMatch->endContainer()); | 136 EXPECT_EQ(textNode, activeMatch->endContainer()); |
137 EXPECT_EQ(20, activeMatch->endOffset()); | 137 EXPECT_EQ(20, activeMatch->endOffset()); |
138 } | 138 } |
139 | 139 |
140 TEST_F(TextFinderTest, FindTextAutosizing) | 140 TEST_F(TextFinderTest, FindTextAutosizing) |
(...skipping 363 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 |