Bug 1412765 - Update tests in dom/animation/tests to use new pending member; r=hiro
authorBrian Birtles <birtles@gmail.com>
Wed, 22 Nov 2017 14:13:36 +0900
changeset 438083 296a6477191df533e28eb072d61d7d3205302ecc
parent 438082 4e0084d3809ed28e0cde15e44caad8379965c6eb
child 438084 b08d7fc80de47d54d57920630978bfdb066cc1a9
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
reviewershiro
bugs1412765
milestone59.0a1
Bug 1412765 - Update tests in dom/animation/tests to use new pending member; r=hiro MozReview-Commit-ID: 2PDm9NaXChg
dom/animation/test/css-animations/file_animation-pausing.html
dom/animation/test/css-animations/file_animation-playstate.html
dom/animation/test/css-animations/file_animation-ready.html
dom/animation/test/css-animations/file_element-get-animations.html
dom/animation/test/css-animations/file_setting-effect.html
dom/animation/test/css-animations/test_animation-pausing.html
dom/animation/test/css-animations/test_animation-playstate.html
dom/animation/test/css-animations/test_animation-ready.html
dom/animation/test/css-animations/test_element-get-animations.html
dom/animation/test/css-animations/test_setting-effect.html
dom/animation/test/css-transitions/file_animation-ready.html
dom/animation/test/css-transitions/file_setting-effect.html
dom/animation/test/css-transitions/test_animation-ready.html
dom/animation/test/css-transitions/test_setting-effect.html
--- a/dom/animation/test/css-animations/file_animation-pausing.html
+++ b/dom/animation/test/css-animations/file_animation-pausing.html
@@ -136,17 +136,18 @@ promise_test(function(t) {
 
 promise_test(function(t) {
   var div = addDiv(t, { style: 'animation: anim 1000s' });
   var animation = div.getAnimations()[0];
   var readyPromiseRun = false;
 
   return animation.ready.then(function() {
     div.style.animationPlayState = 'paused';
-    assert_equals(animation.playState, 'pending', 'Animation is pause pending');
+    assert_true(animation.pending && animation.playState === 'paused',
+                'Animation is pause-pending');
 
     // Set current time
     animation.currentTime = 5 * MS_PER_SEC;
     assert_equals(animation.playState, 'paused',
                   'Animation is paused immediately after setting currentTime');
     assert_equals(animation.startTime, null,
                   'Animation startTime is unresolved immediately after ' +
                   'setting currentTime');
--- a/dom/animation/test/css-animations/file_animation-playstate.html
+++ b/dom/animation/test/css-animations/file_animation-playstate.html
@@ -3,63 +3,51 @@
 <script src="../testcommon.js"></script>
 <style>
 @keyframes anim { }
 </style>
 <body>
 <script>
 'use strict';
 
-promise_test(function(t) {
+test(function(t) {
   var div = addDiv(t);
   var cs = getComputedStyle(div);
   div.style.animation = 'anim 1000s';
   var animation = div.getAnimations()[0];
-  assert_equals(animation.playState, 'pending');
-
-  return animation.ready.then(function() {
-    assert_equals(animation.playState, 'running');
-  });
+  assert_equals(animation.playState, 'running');
 }, 'Animation returns correct playState when running');
 
-promise_test(function(t) {
+test(function(t) {
   var div = addDiv(t);
   var cs = getComputedStyle(div);
   div.style.animation = 'anim 1000s paused';
   var animation = div.getAnimations()[0];
-  assert_equals(animation.playState, 'pending');
-
-  return animation.ready.then(function() {
-    assert_equals(animation.playState, 'paused');
-  });
+  assert_equals(animation.playState, 'paused');
 }, 'Animation returns correct playState when paused');
 
-promise_test(function(t) {
+test(function(t) {
   var div = addDiv(t);
   var cs = getComputedStyle(div);
   div.style.animation = 'anim 1000s';
   var animation = div.getAnimations()[0];
   animation.pause();
-  assert_equals(animation.playState, 'pending');
-
-  return animation.ready.then(function() {
-    assert_equals(animation.playState, 'paused');
-  });
+  assert_equals(animation.playState, 'paused');
 }, 'Animation.playState updates when paused by script');
 
 test(function(t) {
   var div = addDiv(t);
   var cs = getComputedStyle(div);
   div.style.animation = 'anim 1000s paused';
   var animation = div.getAnimations()[0];
   div.style.animationPlayState = 'running';
 
   // This test also checks that calling playState flushes style
-  assert_equals(animation.playState, 'pending',
-                'Animation.playState reports pending after updating'
+  assert_equals(animation.playState, 'running',
+                'Animation.playState reports running after updating'
                 + ' animation-play-state (got: ' + animation.playState + ')');
 }, 'Animation.playState updates when resumed by setting style');
 
 test(function(t) {
   var div = addDiv(t);
   div.style.animation = 'anim 1000s';
   var animation = div.getAnimations()[0];
   animation.cancel();
--- a/dom/animation/test/css-animations/file_animation-ready.html
+++ b/dom/animation/test/css-animations/file_animation-ready.html
@@ -25,47 +25,45 @@ promise_test(function(t) {
 }, 'A new ready promise is created when setting animation-play-state: running');
 
 promise_test(function(t) {
   var div = addDiv(t);
 
   // Set up pending animation
   div.style.animation = 'abc 100s';
   var animation = div.getAnimations()[0];
-  assert_equals(animation.playState, 'pending',
-               'Animation is initially pending');
+  assert_true(animation.pending, 'Animation is initially pending');
 
   // Set up listeners on ready promise
   var retPromise = animation.ready.then(function() {
     assert_unreached('ready promise is fulfilled');
   }).catch(function(err) {
     assert_equals(err.name, 'AbortError',
                   'ready promise is rejected with AbortError');
   });
 
   // Now cancel the animation and flush styles
   div.style.animation = '';
   getComputedStyle(div).animation;
 
   return retPromise;
-}, 'ready promise is rejected when an animation is cancelled by resetting'
+}, 'ready promise is rejected when an animation is canceled by resetting'
    + ' the animation property');
 
 promise_test(function(t) {
   var div = addDiv(t);
 
   // As before, but this time instead of removing all animations, simply update
   // the list of animations. At least for Firefox, updating is a different
   // code path.
 
   // Set up pending animation
   div.style.animation = 'abc 100s';
   var animation = div.getAnimations()[0];
-  assert_equals(animation.playState, 'pending',
-                'Animation is initially pending');
+  assert_true(animation.pending, 'Animation is initially pending');
 
   // Set up listeners on ready promise
   var retPromise = animation.ready.then(function() {
     assert_unreached('ready promise was fulfilled');
   }).catch(function(err) {
     assert_equals(err.name, 'AbortError',
                   'ready promise is rejected with AbortError');
   });
@@ -107,30 +105,30 @@ promise_test(function(t) {
 promise_test(function(t) {
   var div = addDiv(t, { style: 'animation: abc 100s' });
   var animation = div.getAnimations()[0];
 
   return animation.ready.then(function() {
     div.style.animationPlayState = 'paused';
 
     // Flush style and verify we're pending at the same time
-    assert_equals(animation.playState, 'pending', 'Animation is pending');
+    assert_true(animation.pending, 'Animation is pending');
     var pauseReadyPromise = animation.ready;
 
     // Now play again immediately
     div.style.animationPlayState = 'running';
-    assert_equals(animation.playState, 'pending', 'Animation is still pending');
+    assert_true(animation.pending, 'Animation is still pending');
     assert_equals(animation.ready, pauseReadyPromise,
                   'The pause Promise is re-used when playing while waiting'
                   + ' to pause');
 
     return animation.ready;
   }).then(function() {
-    assert_equals(animation.playState, 'running',
-                  'Animation is running after aborting a pause');
+    assert_true(!animation.pending && animation.playState === 'running',
+                'Animation is running after aborting a pause');
   });
 }, 'If a pause operation is interrupted, the ready promise is reused');
 
 promise_test(function(t) {
   var div = addDiv(t, { style: 'animation: abc 100s' });
   var animation = div.getAnimations()[0];
 
   return animation.ready.then(function() {
--- a/dom/animation/test/css-animations/file_element-get-animations.html
+++ b/dom/animation/test/css-animations/file_element-get-animations.html
@@ -236,17 +236,17 @@ test(function(t) {
 test(function(t) {
   var div = addDiv(t);
   div.style.animation = 'anim1 100s';
   var originalAnimation = div.getAnimations()[0];
 
   // Update pause state (an Animation change)
   div.style.animationPlayState = 'paused';
   var pendingAnimation = div.getAnimations()[0];
-  assert_equals(pendingAnimation.playState, 'pending',
+  assert_equals(pendingAnimation.playState, 'paused',
                 'animation\'s play state is updated');
   assert_equals(originalAnimation, pendingAnimation,
                 'getAnimations returns the same objects even when their'
                 + ' play state changes');
 
   // Update duration (an Animation change)
   div.style.animationDuration = '200s';
   var extendedAnimation = div.getAnimations()[0];
--- a/dom/animation/test/css-animations/file_setting-effect.html
+++ b/dom/animation/test/css-animations/file_setting-effect.html
@@ -63,25 +63,25 @@ promise_test(function(t) {
 }, 'Replacing an animation\'s effect with a shorter one that should have ' +
    'already finished, the animation finishes immediately');
 
 promise_test(function(t) {
   var div = addDiv(t);
   div.style.animation = 'anim 100s';
 
   var animation = div.getAnimations()[0];
-  assert_equals(animation.playState, 'pending');
+  assert_true(animation.pending);
 
   animation.effect = new KeyframeEffect(div,
                                         { left: [ '0px' , '100px'] },
                                         100 * MS_PER_SEC);
-  assert_equals(animation.playState, 'pending');
+  assert_true(animation.pending);
 
   return animation.ready.then(function() {
-    assert_equals(animation.playState, 'running');
+    assert_false(animation.pending);
   });
 }, 'A play-pending animation\'s effect whose effect is replaced still exits ' +
    'the pending state');
 
 promise_test(function(t) {
   var div1 = addDiv(t);
   var div2 = addDiv(t);
 
--- a/dom/animation/test/css-animations/test_animation-pausing.html
+++ b/dom/animation/test/css-animations/test_animation-pausing.html
@@ -2,14 +2,15 @@
 <meta charset=utf-8>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
 'use strict';
 setup({explicit_done: true});
 SpecialPowers.pushPrefEnv(
-  { "set": [["dom.animations-api.core.enabled", true]]},
+  { "set": [["dom.animations-api.core.enabled", true],
+            ["dom.animations-api.pending-member.enabled", true]]},
   function() {
     window.open("file_animation-pausing.html");
   });
 </script>
 </html>
--- a/dom/animation/test/css-animations/test_animation-playstate.html
+++ b/dom/animation/test/css-animations/test_animation-playstate.html
@@ -2,14 +2,15 @@
 <meta charset=utf-8>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
 'use strict';
 setup({explicit_done: true});
 SpecialPowers.pushPrefEnv(
-  { "set": [["dom.animations-api.core.enabled", true]]},
+  { "set": [["dom.animations-api.core.enabled", true],
+            ["dom.animations-api.pending-member.enabled", true]]},
   function() {
     window.open("file_animation-playstate.html");
   });
 </script>
 </html>
--- a/dom/animation/test/css-animations/test_animation-ready.html
+++ b/dom/animation/test/css-animations/test_animation-ready.html
@@ -2,14 +2,15 @@
 <meta charset=utf-8>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
 'use strict';
 setup({explicit_done: true});
 SpecialPowers.pushPrefEnv(
-  { "set": [["dom.animations-api.core.enabled", true]]},
+  { "set": [["dom.animations-api.core.enabled", true],
+            ["dom.animations-api.pending-member.enabled", true]]},
   function() {
     window.open("file_animation-ready.html");
   });
 </script>
 </html>
--- a/dom/animation/test/css-animations/test_element-get-animations.html
+++ b/dom/animation/test/css-animations/test_element-get-animations.html
@@ -2,14 +2,15 @@
 <meta charset=utf-8>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
 'use strict';
 setup({explicit_done: true});
 SpecialPowers.pushPrefEnv(
-  { "set": [["dom.animations-api.core.enabled", true]]},
+  { "set": [["dom.animations-api.core.enabled", true],
+            ["dom.animations-api.pending-member.enabled", true]]},
   function() {
     window.open("file_element-get-animations.html");
   });
 </script>
 </html>
--- a/dom/animation/test/css-animations/test_setting-effect.html
+++ b/dom/animation/test/css-animations/test_setting-effect.html
@@ -2,13 +2,14 @@
 <meta charset=utf-8>
 <script src='/resources/testharness.js'></script>
 <script src='/resources/testharnessreport.js'></script>
 <div id='log'></div>
 <script>
 'use strict';
 setup({explicit_done: true});
 SpecialPowers.pushPrefEnv(
-  { 'set': [['dom.animations-api.core.enabled', true]]},
+  { "set": [["dom.animations-api.core.enabled", true],
+            ["dom.animations-api.pending-member.enabled", true]]},
   function() {
     window.open('file_setting-effect.html');
   });
 </script>
--- a/dom/animation/test/css-transitions/file_animation-ready.html
+++ b/dom/animation/test/css-transitions/file_animation-ready.html
@@ -33,17 +33,17 @@ async_test(function(t) {
   // Set up pending transition
   div.style.transform = 'translate(0px)';
   getComputedStyle(div).transform;
   div.style.transition = 'transform 100s';
   div.style.transform = 'translate(10px)';
   getComputedStyle(div).transform;
 
   var animation = div.getAnimations()[0];
-  assert_equals(animation.playState, 'pending', 'Animation is initially pending');
+  assert_true(animation.pending, 'Animation is initially pending');
 
   // Set up listeners on ready promise
   animation.ready.then(t.step_func(function() {
     assert_unreached('ready promise was fulfilled');
   })).catch(t.step_func(function(err) {
     assert_equals(err.name, 'AbortError',
                   'ready promise is rejected with AbortError');
     assert_equals(animation.playState, 'idle',
@@ -65,17 +65,17 @@ async_test(function(t) {
   // Set up pending transition
   div.style.marginLeft = '0px';
   getComputedStyle(div).marginLeft;
   div.style.transition = 'margin-left 100s';
   div.style.marginLeft = '100px';
   getComputedStyle(div).marginLeft;
 
   var animation = div.getAnimations()[0];
-  assert_equals(animation.playState, 'pending', 'Animation is initially pending');
+  assert_true(animation.pending, 'Animation is initially pending');
 
   // Set up listeners on ready promise
   animation.ready.then(t.step_func(function() {
     assert_unreached('ready promise was fulfilled');
   })).catch(t.step_func(function(err) {
     assert_equals(err.name, 'AbortError',
                   'ready promise is rejected with AbortError');
     assert_equals(animation.playState, 'idle',
--- a/dom/animation/test/css-transitions/file_setting-effect.html
+++ b/dom/animation/test/css-transitions/file_setting-effect.html
@@ -77,24 +77,24 @@ promise_test(function(t) {
   div.style.left = '0px';
   div.style.width = '0px';
 
   div.style.transition = 'left 100s';
   flushComputedStyle(div);
   div.style.left = '100px';
 
   var transition = div.getAnimations()[0];
-  assert_equals(transition.playState, 'pending');
+  assert_true(transition.pending);
 
   transition.effect = new KeyframeEffect(div,
                                          { marginLeft: [ '0px' , '100px'] },
                                          100 * MS_PER_SEC);
   assert_equals(transition.transitionProperty, 'left');
-  assert_equals(transition.playState, 'pending');
+  assert_true(transition.pending);
 
   return transition.ready.then(function() {
-    assert_equals(transition.playState, 'running');
+    assert_false(transition.pending);
   });
 }, 'Test for setting a new keyframe effect to a pending transition');
 
 done();
 </script>
 </body>
--- a/dom/animation/test/css-transitions/test_animation-ready.html
+++ b/dom/animation/test/css-transitions/test_animation-ready.html
@@ -2,13 +2,14 @@
 <meta charset=utf-8>
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <div id="log"></div>
 <script>
 'use strict';
 setup({explicit_done: true});
 SpecialPowers.pushPrefEnv(
-  { "set": [["dom.animations-api.core.enabled", true]]},
+  { "set": [["dom.animations-api.core.enabled", true],
+            ["dom.animations-api.pending-member.enabled", true]]},
   function() {
     window.open("file_animation-ready.html");
   });
 </script>
--- a/dom/animation/test/css-transitions/test_setting-effect.html
+++ b/dom/animation/test/css-transitions/test_setting-effect.html
@@ -2,13 +2,14 @@
 <meta charset=utf-8>
 <script src='/resources/testharness.js'></script>
 <script src='/resources/testharnessreport.js'></script>
 <div id='log'></div>
 <script>
 'use strict';
 setup({explicit_done: true});
 SpecialPowers.pushPrefEnv(
-  { 'set': [['dom.animations-api.core.enabled', true]]},
+  { "set": [["dom.animations-api.core.enabled", true],
+            ["dom.animations-api.pending-member.enabled", true]]},
   function() {
     window.open('file_setting-effect.html');
   });
 </script>