blob: d9976ee4d80611ababbbb615ca1b077568569ceb [file] [log] [blame]
<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<style>
.animate {
animation: animate_width 10s;
}
@keyframes animate_width {
from { width: 100px; }
to { width: 200px; }
}
</style>
<div id="target"></div>
<script>
'use strict';
// Note that this test is only valid when DCHECK is enabled, as the underlying
// bug was DCHECK-only.
async_test(t => {
target.classList = 'animate';
// Grabbing the animation forces style clean, causing the Animation to be created.
let animation = target.getAnimations()[0];
// In http://crbug.com/838594 it was found that pausing a CSS animation and
// then setting the currentTime would cause it to DCHECK the next time style
// was cleaned (as long as the style clean was only from an animation update).
animation.pause();
animation.currentTime = 500;
// If we make it to the next frame without DCHECKing, we're good. Note that
// we double rAF to ensure that a new frame is produced.
window.requestAnimationFrame(function() {
window.requestAnimationFrame(t.step_func_done(() => {
// Ensure that the animation pause state was not incorrectly toggled.
assert_equals(animation.currentTime, 500);
}));
});
}, 'Pausing a CSS animation and then setting the currentTime should not ' +
'cause a DCHECK');
</script>