Bug 1415346 - Use arrow function in file_event-dispatch.html. r?birtles draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Wed, 08 Nov 2017 12:14:59 +0900
changeset 694696 0fdb84505302750618baf7778dff37eb1746ab22
parent 694565 40df5dd35fdb7ce3652fe4448ac8961c075c928e
child 694697 cf9a72a56123fcc3aec00defb4e3a5e2dc2f007c
push id88205
push userhikezoe@mozilla.com
push dateWed, 08 Nov 2017 03:47:13 +0000
reviewersbirtles
bugs1415346
milestone58.0a1
Bug 1415346 - Use arrow function in file_event-dispatch.html. r?birtles MozReview-Commit-ID: 7bYYDIOLqv6
dom/animation/test/css-animations/file_event-dispatch.html
dom/animation/test/css-transitions/file_event-dispatch.html
--- a/dom/animation/test/css-animations/file_event-dispatch.html
+++ b/dom/animation/test/css-animations/file_event-dispatch.html
@@ -29,17 +29,17 @@ function AnimationEventHandler(target) {
   };
   this.target.onanimationend = evt => {
     this.animationend = evt.elapsedTime;
   };
   this.target.onanimationcancel = evt => {
     this.animationcancel = evt.elapsedTime;
   };
 }
-AnimationEventHandler.prototype.clear = function() {
+AnimationEventHandler.prototype.clear = () => {
   this.animationstart     = undefined;
   this.animationiteration = undefined;
   this.animationend       = undefined;
   this.animationcancel    = undefined;
 }
 
 function setupAnimation(t, animationStyle) {
   var div = addDiv(t, { style: "animation: " + animationStyle });
@@ -47,333 +47,333 @@ function setupAnimation(t, animationStyl
                                            'animationiteration',
                                            'animationend',
                                            'animationcancel' ]);
   var animation = div.getAnimations()[0];
 
   return [animation, watcher, div];
 }
 
-promise_test(function(t) {
+promise_test(t => {
   // Add 1ms delay to ensure that the delay is not included in the elapsedTime.
   const [animation, watcher] = setupAnimation(t, 'anim 100s 1ms');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Idle -> Active');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher, div] = setupAnimation(t, 'anim 100s');
   const handler = new AnimationEventHandler(div);
 
   // Seek to After phase.
   animation.finish();
   return watcher.wait_for([ 'animationstart',
-                            'animationend' ]).then(function() {
+                            'animationend' ]).then(() => {
     assert_equals(handler.animationstart, 0.0);
     assert_equals(handler.animationend, 100);
   });
 }, 'Idle -> After');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] =
     setupAnimation(t, 'anim 100s 100s paused');
 
-  return animation.ready.then(function() {
+  return animation.ready.then(() => {
     // Seek to Active phase.
     animation.currentTime = 100 * MS_PER_SEC;
     return watcher.wait_for('animationstart');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Before -> Active');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher, div] =
     setupAnimation(t, 'anim 100s 100s paused');
   const handler = new AnimationEventHandler(div);
 
-  return animation.ready.then(function() {
+  return animation.ready.then(() => {
     // Seek to After phase.
     animation.finish();
     return watcher.wait_for([ 'animationstart', 'animationend' ]);
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(handler.animationstart, 0.0);
     assert_equals(handler.animationend, 100.0);
   });
 }, 'Before -> After');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher, div] = setupAnimation(t, 'anim 100s paused');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     // Make idle
     div.style.display = 'none';
     return watcher.wait_for('animationcancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Idle, display: none');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher, div] = setupAnimation(t, 'anim 100s');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     animation.currentTime = 100.0;
     // Make idle
     animation.timeline = null;
     return watcher.wait_for('animationcancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_times_equal(evt.elapsedTime, 0.1);
   });
 }, 'Active -> Idle, setting Animation.timeline = null');
 
-promise_test(function(t) {
+promise_test(t => {
   // we should NOT pause animation since calling cancel synchronously.
   const [animation, watcher, div] = setupAnimation(t, 'anim 100s');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     animation.currentTime = 50.0;
     animation.cancel();
     return watcher.wait_for('animationcancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_times_equal(evt.elapsedTime, 0.05);
   });
 }, 'Active -> Idle, calling Animation.cancel()');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] =
     setupAnimation(t, 'anim 100s 100s paused');
 
   // Seek to Active phase.
   animation.currentTime = 100 * MS_PER_SEC;
-  return watcher.wait_for('animationstart').then(function() {
+  return watcher.wait_for('animationstart').then(() => {
     // Seek to Before phase.
     animation.currentTime = 0;
     return watcher.wait_for('animationend');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Before');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] = setupAnimation(t, 'anim 100s paused');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     // Seek to After phase.
     animation.finish();
     return watcher.wait_for('animationend');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 100.0);
   });
 }, 'Active -> After');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher, div] =
     setupAnimation(t, 'anim 100s 100s paused');
   const handler = new AnimationEventHandler(div);
 
   // Seek to After phase.
   animation.finish();
   return watcher.wait_for([ 'animationstart',
-                            'animationend' ]).then(function() {
+                            'animationend' ]).then(() => {
     // Seek to Before phase.
     animation.currentTime = 0;
     handler.clear();
     return watcher.wait_for([ 'animationstart', 'animationend' ]);
-  }).then(function() {
+  }).then(() => {
     assert_equals(handler.animationstart, 100.0);
     assert_equals(handler.animationend, 0.0);
   });
 }, 'After -> Before');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher, div] =
     setupAnimation(t, 'anim 100s 100s paused');
   const handler = new AnimationEventHandler(div);
 
   // Seek to After phase.
   animation.finish();
   return watcher.wait_for([ 'animationstart',
-                            'animationend' ]).then(function() {
+                            'animationend' ]).then(() => {
     // Seek to Active phase.
     animation.currentTime = 100 * MS_PER_SEC;
     handler.clear();
     return watcher.wait_for('animationstart');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 100.0);
   });
 }, 'After -> Active');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher, div]
     = setupAnimation(t, 'anim 100s 100s 3 paused');
   const handler = new AnimationEventHandler(div);
 
-  return animation.ready.then(function() {
+  return animation.ready.then(() => {
     // Seek to iteration 0 (no animationiteration event should be dispatched)
     animation.currentTime = 100 * MS_PER_SEC;
     return watcher.wait_for('animationstart');
-  }).then(function(evt) {
+  }).then(evt => {
     // Seek to iteration 2
     animation.currentTime = 300 * MS_PER_SEC;
     handler.clear();
     return watcher.wait_for('animationiteration');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 200);
     // Seek to After phase (no animationiteration event should be dispatched)
     animation.currentTime = 400 * MS_PER_SEC;
     return watcher.wait_for('animationend');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 300);
   });
 }, 'Active -> Active (forwards)');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] = setupAnimation(t, 'anim 100s 100s 3');
 
   // Seek to After phase.
   animation.finish();
   return watcher.wait_for([ 'animationstart',
-                            'animationend' ]).then(function() {
+                            'animationend' ]).then(() => {
     // Seek to iteration 2 (no animationiteration event should be dispatched)
     animation.pause();
     animation.currentTime = 300 * MS_PER_SEC;
     return watcher.wait_for('animationstart');
-  }).then(function() {
+  }).then(() => {
     // Seek to mid of iteration 0 phase.
     animation.currentTime = 200 * MS_PER_SEC;
     return watcher.wait_for('animationiteration');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 200.0);
     // Seek to before phase (no animationiteration event should be dispatched)
     animation.currentTime = 0;
     return watcher.wait_for('animationend');
   });
 }, 'Active -> Active (backwards)');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher, div] =
     setupAnimation(t, 'anim 100s paused');
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     // Seek to Idle phase.
     div.style.display = 'none';
     flushComputedStyle(div);
 
     return watcher.wait_for('animationcancel');
-  }).then(function() {
+  }).then(() => {
     // Restart this animation.
     div.style.display = '';
     return watcher.wait_for('animationstart');
   });
 }, 'Active -> Idle -> Active: animationstart is fired by restarting animation');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] =
     setupAnimation(t, 'anim 100s 100s 2 paused');
 
   // Make After.
   animation.finish();
   return watcher.wait_for([ 'animationstart',
-                            'animationend' ]).then(function(evt) {
+                            'animationend' ]).then(evt => {
     animation.playbackRate = -1;
     return watcher.wait_for('animationstart');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 200);
     // Seek to 1st iteration
     animation.currentTime = 200 * MS_PER_SEC - 1;
     return watcher.wait_for('animationiteration');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 100);
     // Seek to before
     animation.currentTime = 100 * MS_PER_SEC - 1;
     return watcher.wait_for('animationend');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0);
     assert_equals(animation.playState, 'running'); // delay
   });
 }, 'Negative playbackRate sanity test(Before -> Active -> Before)');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] = setupAnimation(t, 'anim 100s');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     // Make idle
     animation.cancel();
     return watcher.wait_for('animationcancel');
-  }).then(function(evt) {
+  }).then(evt => {
     animation.cancel();
     // Then wait a couple of frames and check that no event was dispatched.
     return waitForAnimationFrames(2);
   });
 }, 'Call Animation.cancel after cancelling animation.');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] = setupAnimation(t, 'anim 100s');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     // Make idle
     animation.cancel();
     animation.play();
     return watcher.wait_for([ 'animationcancel',
                               'animationstart' ]);
   });
 }, 'Restart animation after cancelling animation immediately.');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] = setupAnimation(t, 'anim 100s');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     // Make idle
     animation.cancel();
     animation.play();
     animation.cancel();
     return watcher.wait_for('animationcancel');
-  }).then(function(evt) {
+  }).then(evt => {
     // Then wait a couple of frames and check that no event was dispatched.
     return waitForAnimationFrames(2);
   });
 }, 'Call Animation.cancel after restarting animation immediately.');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] = setupAnimation(t, 'anim 100s');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     // Make idle
     animation.timeline = null;
     return watcher.wait_for('animationcancel');
-  }).then(function(evt) {
+  }).then(evt => {
     animation.timeline = document.timeline;
     animation.play();
     return watcher.wait_for('animationstart');
   });
 }, 'Set timeline and play transition after clearing the timeline.');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] = setupAnimation(t, 'anim 100s');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     // Make idle
     animation.cancel();
     return watcher.wait_for('animationcancel');
-  }).then(function(evt) {
+  }).then(evt => {
     animation.effect = null;
     // Then wait a couple of frames and check that no event was dispatched.
     return waitForAnimationFrames(2);
   });
 }, 'Set null target effect after cancelling the animation.');
 
-promise_test(function(t) {
+promise_test(t => {
   const [animation, watcher] = setupAnimation(t, 'anim 100s');
 
-  return watcher.wait_for('animationstart').then(function(evt) {
+  return watcher.wait_for('animationstart').then(evt => {
     animation.effect = null;
     return watcher.wait_for('animationend');
-  }).then(function(evt) {
+  }).then(evt => {
     animation.cancel();
     // Then wait a couple of frames and check that no event was dispatched.
     return waitForAnimationFrames(2);
   });
 }, 'Cancel the animation after clearing the target effect.');
 
 done();
 </script>
--- a/dom/animation/test/css-transitions/file_event-dispatch.html
+++ b/dom/animation/test/css-transitions/file_event-dispatch.html
@@ -24,17 +24,17 @@ function TransitionEventHandler(target) 
   this.target.ontransitionend = evt => {
     this.transitionend = evt.elapsedTime;
   };
   this.target.ontransitioncancel = evt => {
     this.transitioncancel = evt.elapsedTime;
   };
 }
 
-TransitionEventHandler.prototype.clear = function() {
+TransitionEventHandler.prototype.clear = () => {
   this.transitionrun    = undefined;
   this.transitionstart  = undefined;
   this.transitionend    = undefined;
   this.transitioncancel = undefined;
 };
 
 function setupTransition(t, transitionStyle) {
   var div = addDiv(t, { style: 'transition: ' + transitionStyle });
@@ -47,427 +47,427 @@ function setupTransition(t, transitionSt
   div.style.marginLeft = '100px';
   var transition = div.getAnimations()[0];
 
   return [transition, watcher, div];
 }
 
 // On the next frame (i.e. when events are queued), whether or not the
 // transition is still pending depends on the implementation.
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s 100s');
-  return watcher.wait_for('transitionrun').then(function(evt) {
+  return watcher.wait_for('transitionrun').then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Idle -> Pending or Before');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s 100s');
   // Force the transition to leave the idle phase
   transition.startTime = document.timeline.currentTime;
-  return watcher.wait_for('transitionrun').then(function(evt) {
+  return watcher.wait_for('transitionrun').then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Idle -> Before');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
   var handler = new TransitionEventHandler(div);
 
   // Seek to Active phase.
   transition.currentTime = 100 * MS_PER_SEC;
   transition.pause();
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     assert_equals(handler.transitionrun, 0.0);
     assert_equals(handler.transitionstart, 0.0);
   });
 }, 'Idle or Pending -> Active');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
   var handler = new TransitionEventHandler(div);
 
   // Seek to After phase.
   transition.finish();
   return watcher.wait_for([ 'transitionrun',
                             'transitionstart',
-                            'transitionend' ]).then(function(evt) {
+                            'transitionend' ]).then(evt => {
     assert_equals(handler.transitionrun, 0.0);
     assert_equals(handler.transitionstart, 0.0);
     assert_equals(handler.transitionend, 100.0);
   });
 }, 'Idle or Pending -> After');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
 
   return Promise.all([ watcher.wait_for('transitionrun'),
-                       transition.ready ]).then(function() {
+                       transition.ready ]).then(() => {
     // Make idle
     div.style.display = 'none';
     flushComputedStyle(div);
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Before -> Idle (display: none)');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s 100s');
 
   return Promise.all([ watcher.wait_for('transitionrun'),
-                       transition.ready ]).then(function() {
+                       transition.ready ]).then(() => {
     // Make idle
     transition.timeline = null;
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Before -> Idle (Animation.timeline = null)');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s 100s');
 
   return Promise.all([ watcher.wait_for('transitionrun'),
-                       transition.ready ]).then(function() {
+                       transition.ready ]).then(() => {
     transition.currentTime = 100 * MS_PER_SEC;
     return watcher.wait_for('transitionstart');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Before -> Active');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
   var handler = new TransitionEventHandler(div);
 
   return Promise.all([ watcher.wait_for('transitionrun'),
-                       transition.ready ]).then(function() {
+                       transition.ready ]).then(() => {
     // Seek to After phase.
     transition.currentTime = 200 * MS_PER_SEC;
     return watcher.wait_for([ 'transitionstart', 'transitionend' ]);
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(handler.transitionstart, 0.0);
     assert_equals(handler.transitionend, 100.0);
   });
 }, 'Before -> After');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s');
 
   // Seek to Active start position.
   transition.pause();
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Make idle
     div.style.display = 'none';
     flushComputedStyle(div);
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Idle, no delay (display: none)');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s');
 
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Make idle
     transition.currentTime = 0;
     transition.timeline = null;
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Idle, no delay (Animation.timeline = null)');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
   // Pause so the currentTime is fixed and we can accurately compare the event
   // time in transition cancel events.
   transition.pause();
 
   // Seek to Active phase.
   transition.currentTime = 100 * MS_PER_SEC;
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Make idle
     div.style.display = 'none';
     flushComputedStyle(div);
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Idle, with positive delay (display: none)');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s 100s');
 
   // Seek to Active phase.
   transition.currentTime = 100 * MS_PER_SEC;
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Make idle
     transition.currentTime = 100 * MS_PER_SEC;
     transition.timeline = null;
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Idle, with positive delay (Animation.timeline = null)');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s -50s');
 
   // Pause so the currentTime is fixed and we can accurately compare the event
   // time in transition cancel events.
   transition.pause();
 
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Make idle
     div.style.display = 'none';
     flushComputedStyle(div);
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 50.0);
   });
 }, 'Active -> Idle, with negative delay (display: none)');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s -50s');
 
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Make idle
     transition.currentTime = 50 * MS_PER_SEC;
     transition.timeline = null;
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Idle, with negative delay (Animation.timeline = null)');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s 100s');
   // Seek to Active phase.
   transition.currentTime = 100 * MS_PER_SEC;
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Seek to Before phase.
     transition.currentTime = 0;
     return watcher.wait_for('transitionend');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Before');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s 100s');
   // Seek to Active phase.
   transition.currentTime = 100 * MS_PER_SEC;
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Seek to After phase.
     transition.currentTime = 200 * MS_PER_SEC;
     return watcher.wait_for('transitionend');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 100.0);
   });
 }, 'Active -> After');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
   var handler = new TransitionEventHandler(div);
 
   // Seek to After phase.
   transition.finish();
   return watcher.wait_for([ 'transitionrun',
                             'transitionstart',
-                            'transitionend' ]).then(function(evt) {
+                            'transitionend' ]).then(evt => {
     // Seek to Before phase.
     transition.currentTime = 0;
     return watcher.wait_for([ 'transitionstart', 'transitionend' ]);
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(handler.transitionstart, 100.0);
     assert_equals(handler.transitionend, 0.0);
   });
 }, 'After -> Before');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s 100s');
   // Seek to After phase.
   transition.finish();
   return watcher.wait_for([ 'transitionrun',
                             'transitionstart',
-                            'transitionend' ]).then(function(evt) {
+                            'transitionend' ]).then(evt => {
     // Seek to Active phase.
     transition.currentTime = 100 * MS_PER_SEC;
     return watcher.wait_for('transitionstart');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 100.0);
   });
 }, 'After -> Active');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s -50s');
   var handler = new TransitionEventHandler(div);
 
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function() {
+                            'transitionstart' ]).then(() => {
     assert_equals(handler.transitionrun, 50.0);
     assert_equals(handler.transitionstart, 50.0);
     transition.finish();
     return watcher.wait_for('transitionend');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 100.0);
   });
 }, 'Calculating the interval start and end time with negative start delay.');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
   var handler = new TransitionEventHandler(div);
 
-  return watcher.wait_for('transitionrun').then(function(evt) {
+  return watcher.wait_for('transitionrun').then(evt => {
     // We can't set the end delay via generated effect timing.
     // Because CSS-Transition use the AnimationEffectTimingReadOnly.
     transition.effect = new KeyframeEffect(div,
                                            { marginleft: [ '0px', '100px' ]},
                                            { duration: 100 * MS_PER_SEC,
                                              endDelay: -50 * MS_PER_SEC });
     // Seek to Before and play.
     transition.cancel();
     transition.play();
     return watcher.wait_for([ 'transitioncancel',
                               'transitionrun',
                               'transitionstart' ]);
-  }).then(function() {
+  }).then(() => {
     assert_equals(handler.transitionstart, 0.0);
 
     // Seek to After phase.
     transition.finish();
     return watcher.wait_for('transitionend');
-  }).then(function(evt) {
+  }).then(evt => {
     assert_equals(evt.elapsedTime, 50.0);
   });
 }, 'Calculating the interval start and end time with negative end delay.');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
 
-  return watcher.wait_for('transitionrun').then(function() {
+  return watcher.wait_for('transitionrun').then(() => {
     // Make idle
     div.style.display = 'none';
     flushComputedStyle(div);
     return watcher.wait_for('transitioncancel');
-  }).then(function() {
+  }).then(() => {
     transition.cancel();
     // Then wait a couple of frames and check that no event was dispatched
     return waitForAnimationFrames(2);
   });
 }, 'Call Animation.cancel after cancelling transition.');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
 
-  return watcher.wait_for('transitionrun').then(function(evt) {
+  return watcher.wait_for('transitionrun').then(evt => {
     // Make idle
     div.style.display = 'none';
     flushComputedStyle(div);
     transition.play();
     watcher.wait_for([ 'transitioncancel',
                        'transitionrun',
                        'transitionstart' ]);
   });
 }, 'Restart transition after cancelling transition immediately');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s 100s');
 
-  return watcher.wait_for('transitionrun').then(function(evt) {
+  return watcher.wait_for('transitionrun').then(evt => {
     // Make idle
     div.style.display = 'none';
     flushComputedStyle(div);
     transition.play();
     transition.cancel();
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     // Then wait a couple of frames and check that no event was dispatched
     return waitForAnimationFrames(2);
   });
 }, 'Call Animation.cancel after restarting transition immediately');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher] =
     setupTransition(t, 'margin-left 100s');
 
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     // Make idle
     transition.timeline = null;
     return watcher.wait_for('transitioncancel');
-  }).then(function(evt) {
+  }).then(evt => {
     transition.timeline = document.timeline;
     transition.play();
 
     return watcher.wait_for(['transitionrun', 'transitionstart']);
   });
 }, 'Set timeline and play transition after clear the timeline');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s');
 
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function() {
+                            'transitionstart' ]).then(() => {
     transition.cancel();
     return watcher.wait_for('transitioncancel');
-  }).then(function() {
+  }).then(() => {
     // Make After phase
     transition.effect = null;
 
     // Then wait a couple of frames and check that no event was dispatched
     return waitForAnimationFrames(2);
   });
 }, 'Set null target effect after cancel the transition');
 
-promise_test(function(t) {
+promise_test(t => {
   var [transition, watcher, div] =
     setupTransition(t, 'margin-left 100s');
 
   return watcher.wait_for([ 'transitionrun',
-                            'transitionstart' ]).then(function(evt) {
+                            'transitionstart' ]).then(evt => {
     transition.effect = null;
     return watcher.wait_for('transitionend');
-  }).then(function(evt) {
+  }).then(evt => {
     transition.cancel();
 
     // Then wait a couple of frames and check that no event was dispatched
     return waitForAnimationFrames(2);
   });
 }, 'Cancel the transition after clearing the target effect');
 
 done();