| Index: content/browser/web_contents/web_contents_impl_browsertest.cc
|
| diff --git a/content/browser/web_contents/web_contents_impl_browsertest.cc b/content/browser/web_contents/web_contents_impl_browsertest.cc
|
| index 1f0586cd33dd4a7dcc04181c9f7ee76ed41225d2..14df17d619aa22553ae5891e5fb6586b91d039f1 100644
|
| --- a/content/browser/web_contents/web_contents_impl_browsertest.cc
|
| +++ b/content/browser/web_contents/web_contents_impl_browsertest.cc
|
| @@ -517,5 +517,38 @@ IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, LoadProgress) {
|
| EXPECT_EQ(1.0, *progresses.rbegin());
|
| }
|
|
|
| +struct FirstVisuallyNonEmptyPaintObserver : public WebContentsObserver {
|
| + FirstVisuallyNonEmptyPaintObserver(Shell* shell)
|
| + : WebContentsObserver(shell->web_contents()),
|
| + did_fist_visually_non_empty_paint_(false) {}
|
| +
|
| + virtual void DidFirstVisuallyNonEmptyPaint() OVERRIDE {
|
| + did_fist_visually_non_empty_paint_ = true;
|
| + on_did_first_visually_non_empty_paint_.Run();
|
| + }
|
| +
|
| + void WaitForDidFirstVisuallyNonEmptyPaint() {
|
| + if (did_fist_visually_non_empty_paint_)
|
| + return;
|
| + base::RunLoop run_loop;
|
| + on_did_first_visually_non_empty_paint_ = run_loop.QuitClosure();
|
| + run_loop.Run();
|
| + }
|
| +
|
| + base::Closure on_did_first_visually_non_empty_paint_;
|
| + bool did_fist_visually_non_empty_paint_;
|
| +};
|
| +
|
| +IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, FirstVisuallyNonEmptyPaint) {
|
| + ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
|
| + scoped_ptr<FirstVisuallyNonEmptyPaintObserver> observer(
|
| + new FirstVisuallyNonEmptyPaintObserver(shell()));
|
| +
|
| + NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
|
| +
|
| + observer->WaitForDidFirstVisuallyNonEmptyPaint();
|
| + ASSERT_TRUE(observer->did_fist_visually_non_empty_paint_);
|
| +}
|
| +
|
| } // namespace content
|
|
|
|
|