Bug 1302007 part 1 - Use the promise_test in transition cancel tests. r?birtles draft
authorMantaroh Yoshinaga <mantaroh@gmail.com>
Mon, 12 Sep 2016 12:11:15 +0900
changeset 412480 492f37e2ae2e03e19458fb1d61a6b173faec4782
parent 412448 7e873393cc11d326338779e5a3ed2da031e30936
child 412481 7de7cfa6baf164bafae022bb6bf246c86618ddd6
child 412482 8e1e2959595e23c559a2bc056add09de496c99bc
child 412483 2506a0dbf307c7ed2506ac6ef604c682eebea298
child 412896 32fa6e5320af68f2775f6b80dea82ad7ea1bb4c0
child 412904 6c836aa2f4b714f39191b51d500bc8e799f9979b
child 412905 3ca7891e9a5d81fa992bb82800fe3b761d7481c0
push id29182
push usermantaroh@gmail.com
push dateMon, 12 Sep 2016 03:11:37 +0000
reviewersbirtles
bugs1302007
milestone51.0a1
Bug 1302007 part 1 - Use the promise_test in transition cancel tests. r?birtles MozReview-Commit-ID: 7cXfwkT7kaH
dom/animation/test/css-transitions/file_animation-cancel.html
--- a/dom/animation/test/css-transitions/file_animation-cancel.html
+++ b/dom/animation/test/css-transitions/file_animation-cancel.html
@@ -1,106 +1,101 @@
 <!doctype html>
 <meta charset=utf-8>
 <script src="../testcommon.js"></script>
 <body>
 <script>
 'use strict';
 
-async_test(function(t) {
+promise_test(function(t) {
   var div = addDiv(t, { style: 'margin-left: 0px' });
   flushComputedStyle(div);
 
   div.style.transition = 'margin-left 100s';
   div.style.marginLeft = '1000px';
   flushComputedStyle(div);
 
   var animation = div.getAnimations()[0];
-  animation.ready.then(waitForFrame).then(t.step_func(function() {
+  return animation.ready.then(waitForFrame).then(function() {
     assert_not_equals(getComputedStyle(div).marginLeft, '1000px',
                       'transform style is animated before cancelling');
     animation.cancel();
     assert_equals(getComputedStyle(div).marginLeft, div.style.marginLeft,
                   'transform style is no longer animated after cancelling');
-    t.done();
-  }));
+  });
 }, 'Animated style is cleared after cancelling a running CSS transition');
 
-async_test(function(t) {
+promise_test(function(t) {
   var div = addDiv(t, { style: 'margin-left: 0px' });
   flushComputedStyle(div);
 
   div.style.transition = 'margin-left 100s';
   div.style.marginLeft = '1000px';
   flushComputedStyle(div);
 
-  div.addEventListener('transitionend', t.step_func(function() {
+  div.addEventListener('transitionend', function() {
     assert_unreached('Got unexpected end event on cancelled transition');
-  }));
+  });
 
   var animation = div.getAnimations()[0];
-  animation.ready.then(t.step_func(function() {
+  return animation.ready.then(function() {
     // Seek to just before the end then cancel
     animation.currentTime = 99.9 * 1000;
     animation.cancel();
 
     // Then wait a couple of frames and check that no event was dispatched
     return waitForAnimationFrames(2);
-  })).then(t.step_func(function() {
-    t.done();
-  }));
+  });
 }, 'Cancelled CSS transitions do not dispatch events');
 
-async_test(function(t) {
+promise_test(function(t) {
   var div = addDiv(t, { style: 'margin-left: 0px' });
   flushComputedStyle(div);
 
   div.style.transition = 'margin-left 100s';
   div.style.marginLeft = '1000px';
   flushComputedStyle(div);
 
   var animation = div.getAnimations()[0];
-  animation.ready.then(t.step_func(function() {
+  return animation.ready.then(function() {
     animation.cancel();
     assert_equals(getComputedStyle(div).marginLeft, '1000px',
                   'margin-left style is not animated after cancelling');
     animation.play();
     assert_equals(getComputedStyle(div).marginLeft, '0px',
                   'margin-left style is animated after re-starting transition');
     return animation.ready;
-  })).then(t.step_func(function() {
+  }).then(function() {
     assert_equals(animation.playState, 'running',
                   'Transition succeeds in running after being re-started');
-    t.done();
-  }));
+  });
 }, 'After cancelling a transition, it can still be re-used');
 
-async_test(function(t) {
+promise_test(function(t) {
   var div = addDiv(t, { style: 'margin-left: 0px' });
   flushComputedStyle(div);
 
   div.style.transition = 'margin-left 100s';
   div.style.marginLeft = '1000px';
   flushComputedStyle(div);
 
   var animation = div.getAnimations()[0];
-  animation.ready.then(t.step_func(function() {
+  return animation.ready.then(function() {
     animation.finish();
     animation.cancel();
     assert_equals(getComputedStyle(div).marginLeft, '1000px',
                   'margin-left style is not animated after cancelling');
     animation.play();
     assert_equals(getComputedStyle(div).marginLeft, '0px',
                   'margin-left style is animated after re-starting transition');
     return animation.ready;
-  })).then(t.step_func(function() {
+  }).then(function() {
     assert_equals(animation.playState, 'running',
                   'Transition succeeds in running after being re-started');
-    t.done();
-  }));
+  });
 }, 'After cancelling a finished transition, it can still be re-used');
 
 test(function(t) {
   var div = addDiv(t, { style: 'margin-left: 0px' });
   flushComputedStyle(div);
 
   div.style.transition = 'margin-left 100s';
   div.style.marginLeft = '1000px';