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.
This commit is contained in:
Brian Birtles 2015-03-24 09:21:08 +09:00
parent f00da8e1e6
commit 988481e564
2 changed files with 1 additions and 81 deletions

View File

@ -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');

View File

@ -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');