Bug 1302648 part 7 - More simple animation event dispatch tests. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Fri, 10 Feb 2017 12:32:45 +0900
changeset 481639 2396a5cbc7c13b3a5f7b4b5c15744b37a676136e
parent 481638 ca5aa204837e3100bf98b123ce1370f53bdfdef7
child 481640 28a8bb9c048c323ecf532006ff7fb712e56c5c82
push id44889
push usermantaroh@gmail.com
push dateFri, 10 Feb 2017 08:41:14 +0000
reviewersbirtles
bugs1302648
milestone54.0a1
Bug 1302648 part 7 - More simple animation event dispatch tests. r?birtles MozReview-Commit-ID: 1fJD75QSkxf
dom/animation/test/css-animations/file_event-dispatch.html
--- a/dom/animation/test/css-animations/file_event-dispatch.html
+++ b/dom/animation/test/css-animations/file_event-dispatch.html
@@ -37,135 +37,139 @@ AnimationEventHandler.prototype.clear = 
   this.animationend = undefined;
 }
 
 function setupAnimation(t, animationStyle) {
   var div = addDiv(t, { style: "animation: " + animationStyle });
   var watcher = new EventWatcher(t, div, [ 'animationstart',
                                            'animationiteration',
                                            'animationend' ]);
-  var handler = new AnimationEventHandler(div);
   var animation = div.getAnimations()[0];
 
-  return [animation, watcher, handler, div];
+  return [animation, watcher, div];
 }
 
 promise_test(function(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) {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Idle -> Active');
 
 promise_test(function(t) {
-  const [animation, watcher, handler] = setupAnimation(t, 'anim 100s');
+  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() {
     assert_equals(handler.animationstart, 0.0);
     assert_equals(handler.animationend, 100);
   });
 }, 'Idle -> After');
 
 promise_test(function(t) {
-  const [animation, watcher, handler] =
+  const [animation, watcher] =
     setupAnimation(t, 'anim 100s 100s paused');
 
   return animation.ready.then(function() {
     // Seek to Active phase.
     animation.currentTime = 100 * MS_PER_SEC;
     return watcher.wait_for('animationstart');
   }).then(function(evt) {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Before -> Active');
 
 promise_test(function(t) {
-  const [animation, watcher, handler] =
+  const [animation, watcher, div] =
     setupAnimation(t, 'anim 100s 100s paused');
+  const handler = new AnimationEventHandler(div);
 
   return animation.ready.then(function() {
     // Seek to After phase.
     animation.finish();
     return watcher.wait_for([ 'animationstart', 'animationend' ]);
   }).then(function(evt) {
     assert_equals(handler.animationstart, 0.0);
     assert_equals(handler.animationend, 100.0);
   });
 }, 'Before -> After');
 
 promise_test(function(t) {
-  const [animation, watcher, handler] =
+  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() {
     // Seek to Before phase.
     animation.currentTime = 0;
     return watcher.wait_for('animationend');
   }).then(function(evt) {
     assert_equals(evt.elapsedTime, 0.0);
   });
 }, 'Active -> Before');
 
 promise_test(function(t) {
-  const [animation, watcher, handler] = setupAnimation(t, 'anim 100s paused');
+  const [animation, watcher] = setupAnimation(t, 'anim 100s paused');
 
   return watcher.wait_for('animationstart').then(function(evt) {
     // Seek to After phase.
     animation.finish();
     return watcher.wait_for('animationend');
   }).then(function(evt) {
     assert_equals(evt.elapsedTime, 100.0);
   });
 }, 'Active -> After');
 
 promise_test(function(t) {
-  const [animation, watcher, handler] =
+  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() {
     // Seek to Before phase.
     animation.currentTime = 0;
     handler.clear();
     return watcher.wait_for([ 'animationstart', 'animationend' ]);
   }).then(function() {
     assert_equals(handler.animationstart, 100.0);
     assert_equals(handler.animationend, 0.0);
   });
 }, 'After -> Before');
 
 promise_test(function(t) {
-  const [animation, watcher, handler] =
+  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() {
     // Seek to Active phase.
     animation.currentTime = 100 * MS_PER_SEC;
     handler.clear();
     return watcher.wait_for('animationstart');
   }).then(function(evt) {
     assert_equals(evt.elapsedTime, 100.0);
   });
 }, 'After -> Active');
 
 promise_test(function(t) {
-  const [animation, watcher, handler]
+  const [animation, watcher, div]
     = setupAnimation(t, 'anim 100s 100s 3 paused');
+  const handler = new AnimationEventHandler(div);
 
   return animation.ready.then(function() {
     // Seek to iteration 0 (no animationiteration event should be dispatched)
     animation.currentTime = 100 * MS_PER_SEC;
     return watcher.wait_for('animationstart');
   }).then(function(evt) {
     // Seek to iteration 2
     animation.currentTime = 300 * MS_PER_SEC;
@@ -177,17 +181,17 @@ promise_test(function(t) {
     animation.currentTime = 400 * MS_PER_SEC;
     return watcher.wait_for('animationend');
   }).then(function(evt) {
     assert_equals(evt.elapsedTime, 300);
   });
 }, 'Active -> Active (forwards)');
 
 promise_test(function(t) {
-  const [animation, watcher, handler] = setupAnimation(t, 'anim 100s 100s 3');
+  const [animation, watcher] = setupAnimation(t, 'anim 100s 100s 3');
 
   // Seek to After phase.
   animation.finish();
   return watcher.wait_for([ 'animationstart',
                             'animationend' ]).then(function() {
     // Seek to iteration 2 (no animationiteration event should be dispatched)
     animation.pause();
     animation.currentTime = 300 * MS_PER_SEC;
@@ -200,33 +204,33 @@ promise_test(function(t) {
     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) {
-  const [animation, watcher, handler, div] =
+  const [animation, watcher, div] =
     setupAnimation(t, 'anim 100s paused');
   return watcher.wait_for('animationstart').then(function(evt) {
     // Seek to Idle phase.
     div.style.display = 'none';
     flushComputedStyle(div);
 
     // FIXME: bug 1302648: Add test for animationcancel event here.
 
     // Restart this animation.
     div.style.display = '';
     return watcher.wait_for('animationstart');
   });
 }, 'Active -> Idle -> Active: animationstart is fired by restarting animation');
 
 promise_test(function(t) {
-  const [animation, watcher, handler, div] =
+  const [animation, watcher] =
     setupAnimation(t, 'anim 100s 100s 2 paused');
 
   // Make After.
   animation.finish();
   return watcher.wait_for([ 'animationstart',
                             'animationend' ]).then(function(evt) {
     animation.playbackRate = -1;
     return watcher.wait_for('animationstart');