Bug 1354501 - Rewrite promise_test in onfinish.html with async/await. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 03 Jul 2018 09:25:01 +0900
changeset 813412 b7cba8315aa1a4b0ece6367daa6d6d1565611d4c
parent 813360 7d20e7fae1039720f92db1a3a72bc2c7424b5f98
child 813413 278a5d291c93f83d6a4a819ef94777268de575eb
push id114891
push userhikezoe@mozilla.com
push dateTue, 03 Jul 2018 04:49:25 +0000
reviewersbirtles
bugs1354501
milestone63.0a1
Bug 1354501 - Rewrite promise_test in onfinish.html with async/await. r?birtles MozReview-Commit-ID: KUbb6wK96Ce
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/web-animations/interfaces/Animation/onfinish.html
--- 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>