From cfd86b747d32ac22246a1aa908eaa720c63a88c1 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 7 Nov 2012 11:22:47 +0100 Subject: 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. --- Source/WebKit/chromium/tests/WebFrameTest.cpp | 37 ++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'Source/WebKit/chromium/tests/WebFrameTest.cpp') 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(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"); -- cgit v1.2.1