<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="../resources/gesture-util.js"></script>
<body>
<script>
window.onload = async () => {
document.timeline.playbackRate = 0;
document.timeline.currentTime = 0;
async function waitForTransitionEnd() {
return new Promise(resolve => {
window.ontransitionend = resolve;
});
}
promise_test(async t => {
await waitForCompositorCommit();
const transitionPromise = waitForTransitionEnd();
document.body.style.transition = 'background 100ms';
document.body.style.background = 'green';
setTimeout(function() {
document.timeline.currentTime = 100;
document.body.offsetTop; // Forces a style recalc, on-demand timing update.
});
await transitionPromise;
}, 'Transition end event should fire even if it completes in an on-demand ' +
'timing update');
};
</script>