ProfileErrorBrowserTest should wait for layout.

The test was checking for the Startup.FirstWebContents.NonEmptyPaint
histogram metric which is recorded by the didFirstVisuallyNonEmptyLayout
client callback out of blink. The test doesn't actually wait until after
the page does a layout though so it'll randomly fail when it loses the
race. Currently blink issues this callback too early when loading pages,
but soon (https://codereview.chromium.org/1295053002) it will start
only issuing the callback after stylesheets have loaded and the page
has started painting matching the usage in Chromium where this callback
maps to painting, not to layout.

To fix the race we now wait for requestAnimationFrame to run which will
ensure that the blink pipeline has been run, and layout and paint
processed before testing for the values of the UMA metrics.

BUG=521692

Review URL: https://codereview.chromium.org/1284383007

Cr-Commit-Position: refs/heads/master@{#343796}
1 file changed