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

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 delay Created 6 years, 7 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 62992d996a65e768a79db90e8586d52ced11aed9..830ffe96cb2af98873019e317ac1700726594702 100644
--- a/Source/web/tests/WebFrameTest.cpp
+++ b/Source/web/tests/WebFrameTest.cpp
@@ -3415,6 +3415,47 @@ 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());
+
+ class DelayedTask : public WebThread::Task {
+ virtual void run()
+ {
+ Platform::current()->currentThread()->exitRunLoop();
+ }
+ };
+ // We should wait a bit until JS setTimeout() task is completed.
+ Platform::current()->currentThread()->postDelayedTask(new DelayedTask(), 100);
+ Platform::current()->currentThread()->enterRunLoop();
+
+ // Check that frame was generated by script.
+ EXPECT_TRUE(!!mainFrame->traverseNext(false));
+
+ for (WebFrame* frame = mainFrame; frame; frame = frame->traverseNext(false)) {
+ 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