Commit 9f716d2f authored by Kevin Ellis's avatar Kevin Ellis Committed by Commit Bot

Address timeouts in composited CSS animations event dispatch test

There are no restrictions on how quickly the client agent needs to
respond to a pending play-state change. For non-composited animations
the ready promise is resolved on commit of the animation frame;
however, for a composited animation, the process is delayed until
receiving a start-time notification from the compositor. The event
dispatch test previously waited up to 2 animations frames, which is
adequate for non-composited tests since the events trigger on the next
frame. For composited tests, we need to first wait for the animation
to be ready if in a pending state. Once the ready promise is resolved,
a two frame time limit is sufficient for the remainder of the steps.

Tested with 300 repetitions of the flaking tests in the virtual/threaded
environment.

Bug: 1064065
Change-Id: Ic4975d5885d3513c5c1b53d755757c0adcc027c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2341803Reviewed-by: default avatarXida Chen <xidachen@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795918}
parent 94a967bd
...@@ -18,12 +18,14 @@ ...@@ -18,12 +18,14 @@
const setupAnimation = (t, animationStyle) => { const setupAnimation = (t, animationStyle) => {
const div = addDiv(t, { style: 'animation: ' + animationStyle }); const div = addDiv(t, { style: 'animation: ' + animationStyle });
const animation = div.getAnimations()[0];
const timeoutPromise = armTimeoutWhenReady(animation, fastEventsTimeout);
const watcher = new EventWatcher(t, div, [ 'animationstart', const watcher = new EventWatcher(t, div, [ 'animationstart',
'animationiteration', 'animationiteration',
'animationend', 'animationend',
'animationcancel' ], 'animationcancel' ],
fastEventsTimeout); timeoutPromise);
const animation = div.getAnimations()[0];
return { animation, watcher, div }; return { animation, watcher, div };
}; };
......
...@@ -201,6 +201,21 @@ function fastEventsTimeout() { ...@@ -201,6 +201,21 @@ function fastEventsTimeout() {
return waitForAnimationFrames(2); return waitForAnimationFrames(2);
}; };
/**
* Timeout function used for tests with EventWatchers. The client agent has no
* strict requirement for how long it takes to resolve the ready promise. Once
* the promise is resolved a secondary timeout promise is armed that may have
* a tight deadline measured in animation frames.
*/
function armTimeoutWhenReady(animation, timeoutPromise) {
return () => {
if (animation.pending)
return animation.ready.then(() => { return timeoutPromise(); });
else
return timeoutPromise();
};
}
/** /**
* Wrapper that takes a sequence of N animations and returns: * Wrapper that takes a sequence of N animations and returns:
* *
......
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