Bug 1354501 - Rewrite promise_test in onfinish.html with async/await. r?birtles
MozReview-Commit-ID: KUbb6wK96Ce
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -618553,17 +618553,17 @@
"e6fb57362e315021729a7a81b62fa383e51818e3",
"testharness"
],
"web-animations/interfaces/Animation/oncancel.html": [
"82abc08a0b416f5198239464fb4fc01d2edd6e1c",
"testharness"
],
"web-animations/interfaces/Animation/onfinish.html": [
- "db82fabeaf2b646647f134634fef30f05e5ec7f8",
+ "29b37a8ba9e653d2db88f628dd84bd99cb8be8db",
"testharness"
],
"web-animations/interfaces/Animation/pause.html": [
"f044cc7ac09c38f127e399f7d6f9a0714046aa8e",
"testharness"
],
"web-animations/interfaces/Animation/pending.html": [
"5677f7e8b076dc096d636aaaa4d4191c286f1d90",
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/onfinish.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/onfinish.html
@@ -66,56 +66,54 @@ async_test(t => {
assert_equals(event.timelineTime, finishedTimelineTime,
'event.timelineTime should equal to the animation timeline ' +
'when finished promise is resolved');
});
animation.finish();
}, 'onfinish event is fired when animation.finish() is called');
-promise_test(t => {
+promise_test(async t => {
const div = createDiv(t);
const animation = div.animate({}, 100 * MS_PER_SEC);
animation.onfinish = event => {
assert_unreached('onfinish event should not be fired');
};
animation.currentTime = 100 * MS_PER_SEC / 2;
animation.pause();
- return animation.ready.then(() => {
- animation.currentTime = 100 * MS_PER_SEC;
- return waitForAnimationFrames(2);
- });
+ await animation.ready;
+ animation.currentTime = 100 * MS_PER_SEC;
+ await waitForAnimationFrames(2);
}, 'onfinish event is not fired when paused');
-promise_test(t => {
+promise_test(async t => {
const div = createDiv(t);
const animation = div.animate({}, 100 * MS_PER_SEC);
animation.onfinish = event => {
assert_unreached('onfinish event should not be fired');
};
- return animation.ready.then(() => {
- animation.playbackRate = 0;
- animation.currentTime = 100 * MS_PER_SEC;
- return waitForAnimationFrames(2);
- });
+ await animation.ready;
+ animation.playbackRate = 0;
+ animation.currentTime = 100 * MS_PER_SEC;
+ await waitForAnimationFrames(2);
}, 'onfinish event is not fired when the playbackRate is zero');
-promise_test(t => {
+promise_test(async t => {
const div = createDiv(t);
const animation = div.animate({}, 100 * MS_PER_SEC);
+
animation.onfinish = event => {
assert_unreached('onfinish event should not be fired');
};
- return animation.ready.then(() => {
- animation.currentTime = 100 * MS_PER_SEC;
- animation.currentTime = 100 * MS_PER_SEC / 2;
- return waitForAnimationFrames(2);
- });
+ await animation.ready;
+ animation.currentTime = 100 * MS_PER_SEC;
+ animation.currentTime = 100 * MS_PER_SEC / 2;
+ await waitForAnimationFrames(2);
}, 'onfinish event is not fired when the animation falls out ' +
'finished state immediately');
</script>
</body>