Index: content/public/test/browser_test_utils.cc |
diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc |
index a15e0f08a8aab61a7346a4136e056af8cfc1a4a6..c7553f016cf824b0e7a5120adab9f2a30731f75c 100644 |
--- a/content/public/test/browser_test_utils.cc |
+++ b/content/public/test/browser_test_utils.cc |
@@ -1059,6 +1059,19 @@ bool WebContentsAddedObserver::RenderViewCreatedCalled() { |
return false; |
} |
+void WaitForFirstFrame(WebContents* web_contents) { |
+ RenderWidgetHostViewBase* rwhv_child = static_cast<RenderWidgetHostViewBase*>( |
+ web_contents->GetRenderWidgetHostView()); |
+ // TODO(wjmaclean): Find a better way to avoid sleeping like this. |
+ while (rwhv_child->RendererFrameNumber() <= 0) { |
+ base::RunLoop run_loop; |
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
+ FROM_HERE, run_loop.QuitClosure(), |
+ base::TimeDelta::FromMilliseconds(10)); |
+ run_loop.Run(); |
+ } |
+} |
+ |
bool RequestFrame(WebContents* web_contents) { |
DCHECK(web_contents); |
return RenderWidgetHostImpl::From( |