| 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 13 matching lines...) Expand all Loading... |
| 24 #include "wtf/OwnPtr.h" | 24 #include "wtf/OwnPtr.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 { | 33 { |
| 34 m_webViewHelper.initialize(); | 34 // Explicitly navigate to about:blank to avoid operating on |
| 35 // initial empty document. |
| 36 m_webViewHelper.initializeAndLoad("about:blank"); |
| 37 |
| 35 WebLocalFrameImpl& frameImpl = *m_webViewHelper.webViewImpl()->mainFrame
Impl(); | 38 WebLocalFrameImpl& frameImpl = *m_webViewHelper.webViewImpl()->mainFrame
Impl(); |
| 36 frameImpl.viewImpl()->resize(WebSize(640, 480)); | 39 frameImpl.viewImpl()->resize(WebSize(640, 480)); |
| 37 frameImpl.viewImpl()->updateAllLifecyclePhases(); | 40 frameImpl.viewImpl()->updateAllLifecyclePhases(); |
| 38 m_document = PassRefPtrWillBeRawPtr<Document>(frameImpl.document()); | 41 m_document = PassRefPtrWillBeRawPtr<Document>(frameImpl.document()); |
| 39 m_textFinder = &frameImpl.ensureTextFinder(); | 42 m_textFinder = &frameImpl.ensureTextFinder(); |
| 40 } | 43 } |
| 41 | 44 |
| 42 Document& document() const; | 45 Document& document() const; |
| 43 TextFinder& textFinder() const; | 46 TextFinder& textFinder() const; |
| 44 | 47 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 // There will be only one iteration before timeout, because increment | 497 // There will be only one iteration before timeout, because increment |
| 495 // of the TimeProxyPlatform timer is greater than timeout threshold. | 498 // of the TimeProxyPlatform timer is greater than timeout threshold. |
| 496 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); | 499 textFinder().scopeStringMatches(identifier, searchPattern, findOptions, true
); |
| 497 while (textFinder().scopingInProgress()) | 500 while (textFinder().scopingInProgress()) |
| 498 runPendingTasks(); | 501 runPendingTasks(); |
| 499 | 502 |
| 500 EXPECT_EQ(4, textFinder().totalMatchCount()); | 503 EXPECT_EQ(4, textFinder().totalMatchCount()); |
| 501 } | 504 } |
| 502 | 505 |
| 503 } // namespace blink | 506 } // namespace blink |
| OLD | NEW |