Commit 51802238 authored by Kevin Ellis's avatar Kevin Ellis Committed by Commit Bot

Fix test flakiness in reverse-running-animation

The animation was often finishing before the screenshot resulting in a
failure. Extended the duration of the animation and starting the
animation from the midpoint should address the flakiness without
needlessly extending the run time of the test.

Bug: 1029543
Change-Id: I32e7794ff77a3b26e7d7f260f80d4b00bbc9d6f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986212Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728253}
parent 44057dc0
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<title>reverse running animation</title> <title>reverse running animation</title>
<link rel="match" href="reverse-running-animation-ref.html"> <link rel="match" href="reverse-running-animation-ref.html">
<script src="/common/reftest-wait.js"></script> <script src="/common/reftest-wait.js"></script>
<script src="../../testcommon.js"></script>
<style> <style>
#box, #overlay { #box, #overlay {
/* Add a border to ensure that anti-aliasing does not leak blue pixels /* Add a border to ensure that anti-aliasing does not leak blue pixels
...@@ -44,24 +45,25 @@ ...@@ -44,24 +45,25 @@
</p> </p>
</body> </body>
<script> <script>
onload = function() { onload = async function() {
// Double rAF to ensure that we are not bogged down during initialization // Double rAF to ensure that we are not bogged down during initialization
// and the compositor is ready. // and the compositor is ready.
requestAnimationFrame(() => { waitForAnimationFrames(2).then(() => {
requestAnimationFrame(() => { const elem = document.getElementById('box');
const elem = document.getElementById('box'); const anim = elem.animate([
const anim = elem.animate([ { transform: 'translateX(100px)' },
{ transform: 'translateX(100px)' }, { transform: 'translateX(100px)', offset: 0.49 },
{ transform: 'translateX(100px)' }, { transform: 'translateX(200px)', offset: 0.51 },
{ transform: 'translateX(200px)' }, { transform: 'translateX(200px)' }
{ transform: 'translateX(200px)' } ], {
], { duration: 10000,
duration: 1000 });
}); anim.ready.then(() => {
setTimeout(() => { anim.currentTime = 5000;
requestAnimationFrame(() => {
anim.reverse(); anim.reverse();
}, 500); takeScreenshotDelayed(1000);
takeScreenshotDelayed(900); });
}); });
}); });
}; };
......
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