diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
| commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
| tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit/chromium/tests/WebFrameTest.cpp | |
| parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
| download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz | |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit/chromium/tests/WebFrameTest.cpp')
| -rw-r--r-- | Source/WebKit/chromium/tests/WebFrameTest.cpp | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index d4bc4819e..ffed3c203 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -1045,19 +1045,23 @@ class FindUpdateWebFrameClient : public WebFrameClient { public: FindUpdateWebFrameClient() : m_findResultsAreReady(false) + , m_count(-1) { } - virtual void reportFindInPageMatchCount(int, int, bool finalUpdate) OVERRIDE + virtual void reportFindInPageMatchCount(int, int count, bool finalUpdate) OVERRIDE { + m_count = count; if (finalUpdate) m_findResultsAreReady = true; } bool findResultsAreReady() const { return m_findResultsAreReady; } + int count() const { return m_count; } private: bool m_findResultsAreReady; + int m_count; }; TEST_F(WebFrameTest, FindInPageMatchRects) @@ -1172,6 +1176,37 @@ TEST_F(WebFrameTest, FindInPageMatchRects) webView->close(); } +TEST_F(WebFrameTest, FindInPageSkipsHiddenFrames) +{ + registerMockedHttpURLLoad("find_in_hidden_frame.html"); + + FindUpdateWebFrameClient client; + WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "find_in_hidden_frame.html", true, &client); + webView->resize(WebSize(640, 480)); + webView->layout(); + webkit_support::RunAllPendingMessages(); + + static const char* kFindString = "hello"; + static const int kFindIdentifier = 12345; + static const int kNumResults = 1; + + WebFindOptions options; + WebString searchText = WebString::fromUTF8(kFindString); + WebFrameImpl* mainFrame = static_cast<WebFrameImpl*>(webView->mainFrame()); + EXPECT_TRUE(mainFrame->find(kFindIdentifier, searchText, options, false, 0)); + + mainFrame->resetMatchCount(); + + for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) + frame->scopeStringMatches(kFindIdentifier, searchText, options, true); + + webkit_support::RunAllPendingMessages(); + EXPECT_TRUE(client.findResultsAreReady()); + EXPECT_EQ(kNumResults, client.count()); + + webView->close(); +} + TEST_F(WebFrameTest, FindOnDetachedFrame) { registerMockedHttpURLLoad("find_in_page.html"); |
