Commit 0ef3f039 authored by loislo's avatar loislo Committed by Commit bot

Quick fix for windows try bots flakiness.

It was a race between animation scheduled by WebTestProxyBase and ResourceLoader which received the test script content.

In case of failure I see the next sequence of top level events:
1) RootGraphicsLayer was cleared
2) html resource arrived and animation was scheduled
3) js resource arrived, onload event handler was called and the test finished in the ASSERT

The expected sequence of top level events:
1) RootGraphicsLayer was cleared
2) html resource arrived and animation was scheduled
3) scheduled animation was executed
4) js resource arrived, onload event handler was called and the test finished successfully

The simplest solution is to run pending animations.

BUG=397321

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

Cr-Commit-Position: refs/heads/master@{#295938}
parent f07da397
......@@ -486,6 +486,11 @@ void WebTestProxyBase::SetAcceptLanguages(const std::string& accept_languages) {
void WebTestProxyBase::CopyImageAtAndCapturePixels(
int x, int y, const base::Callback<void(const SkBitmap&)>& callback) {
// It may happen that there is a scheduled animation and
// no rootGraphicsLayer yet. If so we would run it right now. Otherwise
// isAcceleratedCompositingActive will return false;
AnimateNow();
DCHECK(web_widget_->isAcceleratedCompositingActive());
DCHECK(!callback.is_null());
uint64_t sequence_number = blink::Platform::current()->clipboard()->
......@@ -566,6 +571,11 @@ void WebTestProxyBase::CapturePixelsAsync(
const base::Callback<void(const SkBitmap&)>& callback) {
TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync");
// It may happen that there is a scheduled animation and
// no rootGraphicsLayer yet. If so we would run it right now. Otherwise
// isAcceleratedCompositingActive will return false;
AnimateNow();
DCHECK(web_widget_->isAcceleratedCompositingActive());
DCHECK(!callback.is_null());
......@@ -613,6 +623,11 @@ void WebTestProxyBase::DidDisplayAsync(const base::Closure& callback,
void WebTestProxyBase::DisplayAsyncThen(const base::Closure& callback) {
TRACE_EVENT0("shell", "WebTestProxyBase::DisplayAsyncThen");
// It may happen that there is a scheduled animation and
// no rootGraphicsLayer yet. If so we would run it right now. Otherwise
// isAcceleratedCompositingActive will return false;
AnimateNow();
CHECK(web_widget_->isAcceleratedCompositingActive());
CapturePixelsAsync(base::Bind(
&WebTestProxyBase::DidDisplayAsync, base::Unretained(this), callback));
......
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