Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2720)

Unified Diff: Source/web/tests/WebFrameTest.cpp

Issue 229043004: Fixed crash in WebFrameImpl::resetMatchCount function. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added test Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/web/tests/WebFrameTest.cpp
diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
index 4e5a4419a0be810da4c691d04720ee690b39d537..52a53d68bfac1890674a357663f5848488deaf48 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -3437,6 +3437,35 @@ TEST_F(WebFrameTest, FindDetachFrameWhileScopingStrings)
holdSecondFrame.release();
}
+TEST_F(WebFrameTest, ResetMatchCount)
+{
+ registerMockedHttpURLLoad("find_in_generated_frame.html");
+
+ FindUpdateWebFrameClient client;
+ FrameTestHelpers::WebViewHelper webViewHelper;
+ webViewHelper.initializeAndLoad(m_baseURL + "find_in_generated_frame.html", true, &client);
+ webViewHelper.webView()->resize(WebSize(640, 480));
+ webViewHelper.webView()->layout();
+ runPendingTasks();
+
+ static const char* kFindString = "result";
+ static const int kFindIdentifier = 12345;
+
+ WebFindOptions options;
+ WebString searchText = WebString::fromUTF8(kFindString);
+ WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame());
+ // Check that frame was generated by script.
+ EXPECT_TRUE(!!mainFrame->traverseNext(false));
+
+ for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false))
yosin_UTC9 2014/05/19 05:26:22 nit: Please add "{}" to follow Blink coding standa
Andrey Kraynov 2014/05/20 21:34:46 Done.
+ EXPECT_FALSE(frame->find(kFindIdentifier, searchText, options, false, 0));
+
+ runPendingTasks();
+ EXPECT_FALSE(client.findResultsAreReady());
+
+ mainFrame->resetMatchCount();
+}
+
TEST_F(WebFrameTest, SetTickmarks)
{
registerMockedHttpURLLoad("find.html");

Powered by Google App Engine
This is Rietveld 408576698