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

Side by Side 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, 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 3419 matching lines...) Expand 10 before | Expand all | Expand 10 after
3430 3430
3431 // The first scopeStringMatches will have reset the state. Detach before it actually scopes. 3431 // The first scopeStringMatches will have reset the state. Detach before it actually scopes.
3432 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove()); 3432 EXPECT_TRUE(mainFrame->document().getElementById("frame").remove());
3433 3433
3434 runPendingTasks(); 3434 runPendingTasks();
3435 EXPECT_TRUE(client.findResultsAreReady()); 3435 EXPECT_TRUE(client.findResultsAreReady());
3436 3436
3437 holdSecondFrame.release(); 3437 holdSecondFrame.release();
3438 } 3438 }
3439 3439
3440 TEST_F(WebFrameTest, ResetMatchCount)
3441 {
3442 registerMockedHttpURLLoad("find_in_generated_frame.html");
3443
3444 FindUpdateWebFrameClient client;
3445 FrameTestHelpers::WebViewHelper webViewHelper;
3446 webViewHelper.initializeAndLoad(m_baseURL + "find_in_generated_frame.html", true, &client);
3447 webViewHelper.webView()->resize(WebSize(640, 480));
3448 webViewHelper.webView()->layout();
3449 runPendingTasks();
3450
3451 static const char* kFindString = "result";
3452 static const int kFindIdentifier = 12345;
3453
3454 WebFindOptions options;
3455 WebString searchText = WebString::fromUTF8(kFindString);
3456 WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(webViewHelper.webView()-> mainFrame());
3457 // Check that frame was generated by script.
3458 EXPECT_TRUE(!!mainFrame->traverseNext(false));
3459
3460 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.
3461 EXPECT_FALSE(frame->find(kFindIdentifier, searchText, options, false, 0) );
3462
3463 runPendingTasks();
3464 EXPECT_FALSE(client.findResultsAreReady());
3465
3466 mainFrame->resetMatchCount();
3467 }
3468
3440 TEST_F(WebFrameTest, SetTickmarks) 3469 TEST_F(WebFrameTest, SetTickmarks)
3441 { 3470 {
3442 registerMockedHttpURLLoad("find.html"); 3471 registerMockedHttpURLLoad("find.html");
3443 3472
3444 FindUpdateWebFrameClient client; 3473 FindUpdateWebFrameClient client;
3445 FrameTestHelpers::WebViewHelper webViewHelper; 3474 FrameTestHelpers::WebViewHelper webViewHelper;
3446 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client); 3475 webViewHelper.initializeAndLoad(m_baseURL + "find.html", true, &client);
3447 webViewHelper.webView()->resize(WebSize(640, 480)); 3476 webViewHelper.webView()->resize(WebSize(640, 480));
3448 webViewHelper.webView()->layout(); 3477 webViewHelper.webView()->layout();
3449 runPendingTasks(); 3478 runPendingTasks();
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
5407 EXPECT_EQ(2U, container->percentHeightDescendants()->size()); 5436 EXPECT_EQ(2U, container->percentHeightDescendants()->size());
5408 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous)); 5437 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightInA nonymous));
5409 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild)); 5438 EXPECT_TRUE(container->percentHeightDescendants()->contains(percentHeightDir ectChild));
5410 5439
5411 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB lock(); 5440 WebCore::RenderBlock* anonymousBlock = percentHeightInAnonymous->containingB lock();
5412 EXPECT_TRUE(anonymousBlock->isAnonymous()); 5441 EXPECT_TRUE(anonymousBlock->isAnonymous());
5413 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants()); 5442 EXPECT_FALSE(anonymousBlock->hasPercentHeightDescendants());
5414 } 5443 }
5415 5444
5416 } // namespace 5445 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698