Bug 1354501 - Rewrite promise_test in onfinish.html with async/await. r=birtles

MozReview-Commit-ID: KUbb6wK96Ce

--HG--
extra : rebase_source : c2db20aea338e7f3875496038b2cff74e359bbf3
This commit is contained in:
Hiroyuki Ikezoe 2018-07-03 09:25:01 +09:00
parent 92e15ae40f
commit f0d5d34469
2 changed files with 16 additions and 18 deletions

View File

@ -618558,7 +618558,7 @@
"testharness"
],
"web-animations/interfaces/Animation/onfinish.html": [
"db82fabeaf2b646647f134634fef30f05e5ec7f8",
"29b37a8ba9e653d2db88f628dd84bd99cb8be8db",
"testharness"
],
"web-animations/interfaces/Animation/pause.html": [

View File

@ -71,7 +71,7 @@ async_test(t => {
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);
@ -82,38 +82,36 @@ promise_test(t => {
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');