Commit fc5cd59f authored by Yi Gu's avatar Yi Gu Committed by Commit Bot

[animation worklet] Fix incorrect use of testharness in a Layouttest

Currently there is a call to rAF inside step_func_done which means the
test will actually complete before the rAF fires and so the assert_true
will never run.

Bug: 887659
Change-Id: Ic3d017cb106994507cba995ccf41133902c0d101
Reviewed-on: https://chromium-review.googlesource.com/c/1333887
Commit-Queue: Yi Gu <yigu@chromium.org>
Reviewed-by: default avatarStephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607597}
parent 4849d9a1
...@@ -31,15 +31,15 @@ runInAnimationWorklet( ...@@ -31,15 +31,15 @@ runInAnimationWorklet(
assert_equals(first_opacity, '1'); assert_equals(first_opacity, '1');
animation.play(); animation.play();
waitTwoAnimationFrames(t.step_func_done(() => { waitTwoAnimationFrames(() => {
// waitTwoAnimationFrames guarantees a compositor frame that could update // waitTwoAnimationFrames guarantees a compositor frame that could update
// the opacity value in the worklet. Meanwhile, getComputedStyle needs an // the opacity value in the worklet. Meanwhile, getComputedStyle needs an
// extra frame to fetch the updated value. // extra frame to fetch the updated value.
window.requestAnimationFrame( _ => { window.requestAnimationFrame(t.step_func_done(() => {
const second_opacity = getComputedStyle(target).opacity; const second_opacity = getComputedStyle(target).opacity;
assert_true(second_opacity < first_opacity); assert_true(second_opacity < first_opacity);
}); }));
})); });
}); });
}, 'Opacity should change as the animation starts.'); }, 'Opacity should change as the animation starts.');
</script> </script>
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