Commit b7532ee3 authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

Fix flakiness of ThumbnailTest.ShouldCaptureOnNavigatingAwaySlowPageLoad

Use NavigationAndFirstPaintWaiter to ensure we wait for the first paint.

Bug: 843921
Change-Id: Ia469d2460adf71f7151e2874bed034d6d3acbf10
Reviewed-on: https://chromium-review.googlesource.com/1101641Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Saman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567616}
parent f825aacd
...@@ -83,13 +83,6 @@ std::string MakeHtmlDocument(const std::string& background_color) { ...@@ -83,13 +83,6 @@ std::string MakeHtmlDocument(const std::string& background_color) {
background_color.c_str()); background_color.c_str());
} }
void Sleep(base::TimeDelta delta) {
base::RunLoop run_loop;
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, run_loop.QuitClosure(), delta);
run_loop.Run();
}
class MockThumbnailService : public ThumbnailService { class MockThumbnailService : public ThumbnailService {
public: public:
MOCK_METHOD2(SetPageThumbnail, MOCK_METHOD2(SetPageThumbnail,
...@@ -321,12 +314,12 @@ IN_PROC_BROWSER_TEST_F(ThumbnailTest, ...@@ -321,12 +314,12 @@ IN_PROC_BROWSER_TEST_F(ThumbnailTest,
.Times(0); .Times(0);
// Navigate to the red page. // Navigate to the red page.
ui_test_utils::NavigateToURL(browser(), red_url); {
NavigationAndFirstPaintWaiter waiter(
// Give the renderer process some time to actually paint it. Without this, browser()->tab_strip_model()->GetActiveWebContents());
// there's a chance we might attempt to take a screenshot before the first ui_test_utils::NavigateToURL(browser(), red_url);
// paint, which would fail. waiter.Wait();
Sleep(base::TimeDelta::FromMilliseconds(200)); }
// Before navigating away from the red page, we should take a thumbnail. // Before navigating away from the red page, we should take a thumbnail.
// Note that the page load is deliberately slowed down, so that the // Note that the page load is deliberately slowed down, so that the
......
...@@ -10,6 +10,3 @@ ...@@ -10,6 +10,3 @@
# Mac Flaking with missing browser. https://crbug.com/842664 # Mac Flaking with missing browser. https://crbug.com/842664
-IndependentOTRProfileManagerTest.DeleteImmediatelyWhenBrowsersAlreadyClosed -IndependentOTRProfileManagerTest.DeleteImmediatelyWhenBrowsersAlreadyClosed
# https://crbug.com/843921
-ThumbnailTest.ShouldCaptureOnNavigatingAwaySlowPageLoad
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment