From 988481e5640394505a7be858b1ef213cdcb398e0 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Tue, 24 Mar 2015 09:21:08 +0900 Subject: [PATCH] Bug 1109390 part 2 - Remove some unneeded startTime tests; r=jwatt Now that we have separate tests for checking the initial state of startTime we can remove these checks from tests for setting the startTime. Also, while we're at it, we needn't check the playState and animationPlayState since these should be covered by other tests. --- .../test_animation-player-starttime.html | 46 +------------------ .../test_animation-player-starttime.html | 36 --------------- 2 files changed, 1 insertion(+), 81 deletions(-) diff --git a/dom/animation/test/css-animations/test_animation-player-starttime.html b/dom/animation/test/css-animations/test_animation-player-starttime.html index 848c2780821d..274e9db46659 100644 --- a/dom/animation/test/css-animations/test_animation-player-starttime.html +++ b/dom/animation/test/css-animations/test_animation-player-starttime.html @@ -199,27 +199,6 @@ function EventWatcher(watchedNode, eventTypes) // The former is the start of the start delay. The latter is the start of the // active interval. (If there is no delay, they are the same.) -// Called when startTime is set to the time the start delay would ideally -// start (not accounting for any delay to next paint tick). -function checkStateOnSettingStartTimeToAnimationCreationTime(player) -{ - // We don't test player.startTime since our caller just set it. - - assert_equals(player.playState, 'running', - 'AnimationPlayer.playState should be "running" at the start of ' + - 'the start delay'); - - assert_equals(player.source.target.style.animationPlayState, 'running', - 'AnimationPlayer.source.target.style.animationPlayState should be ' + - '"running" at the start of the start delay'); - - var div = player.source.target; - var marginLeft = parseFloat(getComputedStyle(div).marginLeft); - assert_equals(marginLeft, UNANIMATED_POSITION, - 'the computed value of margin-left should be unaffected ' + - 'at the beginning of the start delay'); -} - // Called when the ready Promise's callbacks should happen function checkStateOnReadyPromiseResolved(player) { @@ -372,37 +351,14 @@ async_test(function(t) test(function(t) { var div = addDiv(t, {'class': 'animated-div'}); - div.style.animation = ANIM_PROPERTY_VAL; var player = div.getAnimationPlayers()[0]; - - // Animations shouldn't start until the next paint tick, so: - assert_equals(player.startTime, null, - 'AnimationPlayer.startTime should be unresolved when an animation ' + - 'is initially created'); - - assert_equals(player.playState, "pending", - 'AnimationPlayer.playState should be "pending" when an animation ' + - 'is initially created'); - - assert_equals(player.source.target.style.animationPlayState, 'running', - 'AnimationPlayer.source.target.style.animationPlayState should be ' + - '"running" when an animation is initially created'); - - // XXX Ideally we would have a test to check the ready Promise is initially - // unresolved, but currently there is no Web API to do that. Waiting for the - // ready Promise with a timeout doesn't work because the resolved callback - // will be called (async) regardless of whether the Promise was resolved in - // the past or is resolved in the future. - var currentTime = player.timeline.currentTime; player.startTime = currentTime; assert_approx_equals(player.startTime, currentTime, 0.0001, // rounding error 'Check setting of startTime actually works'); - - checkStateOnSettingStartTimeToAnimationCreationTime(player); -}, 'Sanity test to check round-tripping assigning to new animation\'s ' + +}, 'Sanity test to check round-tripping assigning to a new animation\'s ' + 'startTime'); diff --git a/dom/animation/test/css-transitions/test_animation-player-starttime.html b/dom/animation/test/css-transitions/test_animation-player-starttime.html index f154c0040e58..a7ff736c264f 100644 --- a/dom/animation/test/css-transitions/test_animation-player-starttime.html +++ b/dom/animation/test/css-transitions/test_animation-player-starttime.html @@ -190,23 +190,6 @@ function EventWatcher(watchedNode, eventTypes) // The former is the start of the start delay. The latter is the start of the // active interval. (If there is no delay, they are the same.) -// Called when startTime is set to the time the start delay would ideally -// start (not accounting for any delay to next paint tick). -function checkStateOnSettingStartTimeToAnimationCreationTime(player) -{ - // We don't test player.startTime since our caller just set it. - - assert_equals(player.playState, 'running', - 'AnimationPlayer.playState should be "running" at the start of ' + - 'the start delay'); - - var div = player.source.target; - var marginLeft = parseFloat(getComputedStyle(div).marginLeft); - assert_equals(marginLeft, INITIAL_POSITION, - 'the computed value of margin-left should be unaffected ' + - 'at the beginning of the start delay'); -} - // Called when the ready Promise's callbacks should happen function checkStateOnReadyPromiseResolved(player) { @@ -282,33 +265,14 @@ test(function(t) test(function(t) { var div = addDiv(t, {'class': 'animated-div'}); - flushComputedStyle(div); div.style.marginLeft = '200px'; // initiate transition var player = div.getAnimationPlayers()[0]; - - // Animations shouldn't start until the next paint tick, so: - assert_equals(player.startTime, null, - 'AnimationPlayer.startTime should be unresolved when an animation ' + - 'is initially created'); - - assert_equals(player.playState, "pending", - 'AnimationPlayer.playState should be "pending" when an animation ' + - 'is initially created'); - - // XXX Ideally we would have a test to check the ready Promise is initially - // unresolved, but currently there is no Web API to do that. Waiting for the - // ready Promise with a timeout doesn't work because the resolved callback - // will be called (async) regardless of whether the Promise was resolved in - // the past or is resolved in the future. - var currentTime = player.timeline.currentTime; player.startTime = currentTime; assert_approx_equals(player.startTime, currentTime, 0.0001, // rounding error 'Check setting of startTime actually works'); - - checkStateOnSettingStartTimeToAnimationCreationTime(player); }, 'Sanity test to check round-tripping assigning to new animation\'s ' + 'startTime');