| 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/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 TEST_F(TextFinderTest, FindTextAutosizing) { | 147 TEST_F(TextFinderTest, FindTextAutosizing) { |
| 148 document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); | 148 document().body()->setInnerHTML("XXXXFindMeYYYYfindmeZZZZ"); |
| 149 document().updateStyleAndLayout(); | 149 document().updateStyleAndLayout(); |
| 150 | 150 |
| 151 int identifier = 0; | 151 int identifier = 0; |
| 152 WebString searchText(String("FindMe")); | 152 WebString searchText(String("FindMe")); |
| 153 WebFindOptions findOptions; // Default. | 153 WebFindOptions findOptions; // Default. |
| 154 bool wrapWithinFrame = true; | 154 bool wrapWithinFrame = true; |
| 155 | 155 |
| 156 // Set viewport scale to 20 in order to simulate zoom-in | 156 // Set viewport scale to 20 in order to simulate zoom-in |
| 157 VisualViewport& visualViewport = | 157 VisualViewport& visualViewport = document().page()->visualViewport(); |
| 158 document().page()->frameHost().visualViewport(); | |
| 159 visualViewport.setScale(20); | 158 visualViewport.setScale(20); |
| 160 | 159 |
| 161 // Enforce autosizing | 160 // Enforce autosizing |
| 162 document().settings()->setTextAutosizingEnabled(true); | 161 document().settings()->setTextAutosizingEnabled(true); |
| 163 document().settings()->setTextAutosizingWindowSizeOverride(IntSize(20, 20)); | 162 document().settings()->setTextAutosizingWindowSizeOverride(IntSize(20, 20)); |
| 164 document().textAutosizer()->updatePageInfo(); | 163 document().textAutosizer()->updatePageInfo(); |
| 165 document().updateStyleAndLayout(); | 164 document().updateStyleAndLayout(); |
| 166 | 165 |
| 167 // In case of autosizing, scale _should_ change | 166 // In case of autosizing, scale _should_ change |
| 168 ASSERT_TRUE( | 167 ASSERT_TRUE( |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 // of the TimeProxyPlatform timer is greater than timeout threshold. | 604 // of the TimeProxyPlatform timer is greater than timeout threshold. |
| 606 textFinder().startScopingStringMatches(identifier, searchPattern, | 605 textFinder().startScopingStringMatches(identifier, searchPattern, |
| 607 findOptions); | 606 findOptions); |
| 608 while (textFinder().scopingInProgress()) | 607 while (textFinder().scopingInProgress()) |
| 609 runPendingTasks(); | 608 runPendingTasks(); |
| 610 | 609 |
| 611 EXPECT_EQ(4, textFinder().totalMatchCount()); | 610 EXPECT_EQ(4, textFinder().totalMatchCount()); |
| 612 } | 611 } |
| 613 | 612 |
| 614 } // namespace blink | 613 } // namespace blink |
| OLD | NEW |