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

Unified Diff: content/public/test/browser_test_utils.cc

Issue 1582053002: Implement webview.captureVisibleRegion() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test so it waits for the first frame to be generated. Created 4 years, 11 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: 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(

Powered by Google App Engine
This is Rietveld 408576698