| 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 | 6 |
| 7 #include "web/TextFinder.h" | 7 #include "web/TextFinder.h" |
| 8 | 8 |
| 9 #include "bindings/v8/ExceptionStatePlaceholder.h" | 9 #include "bindings/v8/ExceptionStatePlaceholder.h" |
| 10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 protected: | 27 protected: |
| 28 virtual void SetUp() OVERRIDE; | 28 virtual void SetUp() OVERRIDE; |
| 29 | 29 |
| 30 Document& document() const; | 30 Document& document() const; |
| 31 TextFinder& textFinder() const; | 31 TextFinder& textFinder() const; |
| 32 | 32 |
| 33 static WebFloatRect findInPageRect(Node* startContainer, int startOffset, No
de* endContainer, int endOffset); | 33 static WebFloatRect findInPageRect(Node* startContainer, int startOffset, No
de* endContainer, int endOffset); |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 FrameTestHelpers::WebViewHelper m_webViewHelper; | 36 FrameTestHelpers::WebViewHelper m_webViewHelper; |
| 37 RefPtr<Document> m_document; | 37 RefPtrWillBePersistent<Document> m_document; |
| 38 TextFinder* m_textFinder; | 38 TextFinder* m_textFinder; |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 void TextFinderTest::SetUp() | 41 void TextFinderTest::SetUp() |
| 42 { | 42 { |
| 43 m_webViewHelper.initialize(); | 43 m_webViewHelper.initialize(); |
| 44 WebLocalFrameImpl& frameImpl = *m_webViewHelper.webViewImpl()->mainFrameImpl
(); | 44 WebLocalFrameImpl& frameImpl = *m_webViewHelper.webViewImpl()->mainFrameImpl
(); |
| 45 frameImpl.viewImpl()->resize(WebSize(640, 480)); | 45 frameImpl.viewImpl()->resize(WebSize(640, 480)); |
| 46 m_document = PassRefPtr<Document>(frameImpl.document()); | 46 m_document = PassRefPtrWillBeRawPtr<Document>(frameImpl.document()); |
| 47 m_textFinder = &frameImpl.ensureTextFinder(); | 47 m_textFinder = &frameImpl.ensureTextFinder(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 Document& TextFinderTest::document() const | 50 Document& TextFinderTest::document() const |
| 51 { | 51 { |
| 52 return *m_document; | 52 return *m_document; |
| 53 } | 53 } |
| 54 | 54 |
| 55 TextFinder& TextFinderTest::textFinder() const | 55 TextFinder& TextFinderTest::textFinder() const |
| 56 { | 56 { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 EXPECT_EQ(3, textFinder().totalMatchCount()); | 282 EXPECT_EQ(3, textFinder().totalMatchCount()); |
| 283 WebVector<WebFloatRect> matchRects; | 283 WebVector<WebFloatRect> matchRects; |
| 284 textFinder().findMatchRects(matchRects); | 284 textFinder().findMatchRects(matchRects); |
| 285 ASSERT_EQ(3u, matchRects.size()); | 285 ASSERT_EQ(3u, matchRects.size()); |
| 286 EXPECT_EQ(findInPageRect(textInUElement, 0, textInUElement, 3), matchRects[0
]); | 286 EXPECT_EQ(findInPageRect(textInUElement, 0, textInUElement, 3), matchRects[0
]); |
| 287 EXPECT_EQ(findInPageRect(textInBElement, 0, textInBElement, 3), matchRects[1
]); | 287 EXPECT_EQ(findInPageRect(textInBElement, 0, textInBElement, 3), matchRects[1
]); |
| 288 EXPECT_EQ(findInPageRect(textInIElement, 0, textInIElement, 3), matchRects[2
]); | 288 EXPECT_EQ(findInPageRect(textInIElement, 0, textInIElement, 3), matchRects[2
]); |
| 289 } | 289 } |
| 290 | 290 |
| 291 } // namespace | 291 } // namespace |
| OLD | NEW |