Bug 1244635 - Part2 Add enddelay tests in dom/animation/test/chrome r=hiro

MozReview-Commit-ID: Kylwd6UJcXH

--HG--
extra : rebase_source : 0da2ed9e152e2e57a42f044be896e39e3f701bd3
This commit is contained in:
Ryo Motozawa 2016-03-08 10:31:28 +09:00
Родитель ec7074d1bf
Коммит 2c887f4afc
2 изменённых файлов: 103 добавлений и 0 удалений

Просмотреть файл

@ -1511,6 +1511,43 @@ addAsyncAnimTest("change_duration_and_currenttime",
yield await_frame();
});
addAsyncAnimTest("change_enddelay_and_currenttime",
{ observe: div, subtree: true }, function*() {
var anim = div.animate({ opacity: [ 0, 1 ] }, { duration: 100000 });
yield await_frame();
assert_records([{ added: [anim], changed: [], removed: [] }],
"records after animation is added");
anim.effect.timing.endDelay = 10000;
yield await_frame();
assert_records([{ added: [], changed: [anim], removed: [] }],
"records after endDelay is changed");
anim.effect.timing.endDelay = 10000;
yield await_frame();
assert_records([], "records after assigning same value");
anim.currentTime = 109000;
yield await_frame();
assert_records([{ added: [], changed: [], removed: [anim] }],
"records after currentTime during endDelay");
anim.effect.timing.endDelay = -110000;
yield await_frame();
assert_records([], "records after assigning negative value");
anim.cancel();
yield await_frame();
});
addAsyncAnimTest("change_enddelay_and_currenttime",
{ observe: div, subtree: true }, function*() {
var anim = div.animate({ opacity: [ 0, 1 ] },
{ duration: 100, endDelay: -100 });
yield await_frame();
assert_records([], "records after animation is added");
});
// Run the tests.
SimpleTest.requestLongerTimeout(2);
SimpleTest.waitForExplicitFinish();

Просмотреть файл

@ -327,6 +327,72 @@ promise_test(function(t) {
}, 'animation is added to compositor' +
' when timing.duration is made longer than the current time');
promise_test(function(t) {
var div = addDiv(t);
var animation = div.animate({ opacity: [ 0, 1 ] }, 10000);
return animation.ready.then(t.step_func(function() {
assert_equals(animation.isRunningOnCompositor, omtaEnabled,
'Animation reports that it is running on the compositor');
animation.effect.timing.endDelay = 10000;
assert_equals(animation.isRunningOnCompositor, omtaEnabled,
'Animation reports that it is running on the compositor'
+ ' when endDelay is changed');
animation.currentTime = 11000;
return waitForFrame();
})).then(t.step_func(function() {
assert_equals(animation.isRunningOnCompositor, false,
'Animation reports that it is NOT running on the compositor'
+ ' when currentTime is during endDelay');
}));
}, 'animation is removed from compositor' +
' when current time is made longer than the duration even during endDelay');
promise_test(function(t) {
var div = addDiv(t);
var animation = div.animate({ opacity: [ 0, 1 ] }, 10000);
return animation.ready.then(t.step_func(function() {
assert_equals(animation.isRunningOnCompositor, omtaEnabled,
'Animation reports that it is running on the compositor');
animation.effect.timing.endDelay = -20000;
return waitForFrame();
})).then(t.step_func(function() {
assert_equals(animation.isRunningOnCompositor, false,
'Animation reports that it is NOT running on the compositor'
+ ' when endTime is negative value');
}));
}, 'animation is removed from compositor' +
' when endTime is negative value');
promise_test(function(t) {
var div = addDiv(t);
var animation = div.animate({ opacity: [ 0, 1 ] }, 10000);
return animation.ready.then(t.step_func(function() {
assert_equals(animation.isRunningOnCompositor, omtaEnabled,
'Animation reports that it is running on the compositor');
animation.effect.timing.endDelay = -5000;
return waitForFrame();
})).then(t.step_func(function() {
assert_equals(animation.isRunningOnCompositor, omtaEnabled,
'Animation reports that it is running on the compositor'
+ ' when endTime is positive and endDelay is negative');
animation.currentTime = 6000;
return waitForFrame();
})).then(t.step_func(function() {
assert_equals(animation.isRunningOnCompositor, false,
'Animation reports that it is NOT running on the compositor'
+ ' when currentTime is after endTime');
}));
}, 'animation is NOT running on compositor' +
'when endTime is positive and endDelay is negative');
</script>
</script>
</body>