| 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 "core/editing/TextFinder.h" | 5 #include "core/editing/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 13 matching lines...) Expand all Loading... |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 using blink::testing::RunPendingTasks; | 26 using blink::testing::RunPendingTasks; |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 class TextFinderTest : public ::testing::Test { | 30 class TextFinderTest : public ::testing::Test { |
| 31 protected: | 31 protected: |
| 32 TextFinderTest() { | 32 TextFinderTest() { |
| 33 web_view_helper_.Initialize(); | 33 web_view_helper_.Initialize(); |
| 34 WebLocalFrameBase& frame_impl = | 34 WebLocalFrameBase& frame_impl = *web_view_helper_.LocalMainFrame(); |
| 35 *web_view_helper_.WebView()->MainFrameImpl(); | |
| 36 frame_impl.ViewImpl()->Resize(WebSize(640, 480)); | 35 frame_impl.ViewImpl()->Resize(WebSize(640, 480)); |
| 37 frame_impl.ViewImpl()->UpdateAllLifecyclePhases(); | 36 frame_impl.ViewImpl()->UpdateAllLifecyclePhases(); |
| 38 document_ = static_cast<Document*>(frame_impl.GetDocument()); | 37 document_ = static_cast<Document*>(frame_impl.GetDocument()); |
| 39 text_finder_ = &frame_impl.EnsureTextFinder(); | 38 text_finder_ = &frame_impl.EnsureTextFinder(); |
| 40 } | 39 } |
| 41 | 40 |
| 42 Document& GetDocument() const; | 41 Document& GetDocument() const; |
| 43 TextFinder& GetTextFinder() const; | 42 TextFinder& GetTextFinder() const; |
| 44 | 43 |
| 45 static WebFloatRect FindInPageRect(Node* start_container, | 44 static WebFloatRect FindInPageRect(Node* start_container, |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 // of the TimeProxyPlatform timer is greater than timeout threshold. | 617 // of the TimeProxyPlatform timer is greater than timeout threshold. |
| 619 GetTextFinder().StartScopingStringMatches(identifier, search_pattern, | 618 GetTextFinder().StartScopingStringMatches(identifier, search_pattern, |
| 620 find_options); | 619 find_options); |
| 621 while (GetTextFinder().ScopingInProgress()) | 620 while (GetTextFinder().ScopingInProgress()) |
| 622 RunPendingTasks(); | 621 RunPendingTasks(); |
| 623 | 622 |
| 624 EXPECT_EQ(4, GetTextFinder().TotalMatchCount()); | 623 EXPECT_EQ(4, GetTextFinder().TotalMatchCount()); |
| 625 } | 624 } |
| 626 | 625 |
| 627 } // namespace blink | 626 } // namespace blink |
| OLD | NEW |