Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/animation/finish.html

Issue 1967303002: Import web-platform-tests@5c527917247fa5e21528f2e742717192976b2fac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/animation/finish.html
diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/animation/finish.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/animation/finish.html
index 8238b5081f7202864fd3f83a8373f746b8a316cf..6cce58dc8ffb1909dff9f49601d30fdf7719cd4d 100644
--- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/animation/finish.html
+++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/web-animations/animation/finish.html
@@ -96,11 +96,10 @@ promise_test(function(t) {
assert_equals(animation.playState, 'finished',
'The play state of a paused animation should become ' +
'"finished" after finish() is called');
- assert_approx_equals(animation.startTime,
- animation.timeline.currentTime - 100 * MS_PER_SEC,
- 0.0001,
- 'The start time of a paused animation should be set ' +
- 'after calling finish()');
+ assert_times_equal(animation.startTime,
+ animation.timeline.currentTime - 100 * MS_PER_SEC,
+ 'The start time of a paused animation should be set ' +
+ 'after calling finish()');
});
}, 'Test finish() while paused');
@@ -117,11 +116,10 @@ test(function(t) {
assert_equals(animation.playState, 'finished',
'The play state of a pause-pending animation should become ' +
'"finished" after finish() is called');
- assert_approx_equals(animation.startTime,
- animation.timeline.currentTime - 100 * MS_PER_SEC / 2,
- 0.0001,
- 'The start time of a pause-pending animation should ' +
- 'be set after calling finish()');
+ assert_times_equal(animation.startTime,
+ animation.timeline.currentTime - 100 * MS_PER_SEC / 2,
+ 'The start time of a pause-pending animation should ' +
+ 'be set after calling finish()');
}, 'Test finish() while pause-pending with positive playbackRate');
test(function(t) {
@@ -148,11 +146,10 @@ test(function(t) {
assert_equals(animation.playState, 'finished',
'The play state of a play-pending animation should become ' +
'"finished" after finish() is called');
- assert_approx_equals(animation.startTime,
- animation.timeline.currentTime - 100 * MS_PER_SEC / 0.5,
- 0.0001,
- 'The start time of a play-pending animation should ' +
- 'be set after calling finish()');
+ assert_times_equal(animation.startTime,
+ animation.timeline.currentTime - 100 * MS_PER_SEC / 0.5,
+ 'The start time of a play-pending animation should ' +
+ 'be set after calling finish()');
}, 'Test finish() while play-pending');
// FIXME: Add a test for when we are play-pending without an active timeline.
@@ -206,5 +203,45 @@ promise_test(function(t) {
'Animation.finish()');
});
}, 'Test finish() resolves finished promise synchronously');
+
+promise_test(function(t) {
+ var effect = new KeyframeEffectReadOnly(null, gKeyFrames, 100 * MS_PER_SEC);
+ var animation = new Animation(effect, document.timeline);
+ var resolvedFinished = false;
+ animation.finished.then(function() {
+ resolvedFinished = true;
+ });
+
+ return animation.ready.then(function() {
+ animation.finish();
+ }).then(function() {
+ assert_true(resolvedFinished,
+ 'Animation.finished should be resolved soon after ' +
+ 'Animation.finish()');
+ });
+}, 'Test finish() resolves finished promise synchronously with an animation ' +
+ 'without a target');
+
+promise_test(function(t) {
+ var effect = new KeyframeEffectReadOnly(null, gKeyFrames, 100 * MS_PER_SEC);
+ var animation = new Animation(effect, document.timeline);
+ animation.play();
+
+ var resolvedFinished = false;
+ animation.finished.then(function() {
+ resolvedFinished = true;
+ });
+
+ return animation.ready.then(function() {
+ animation.currentTime = animation.effect.getComputedTiming().endTime - 1;
+ return waitForAnimationFrames(2);
+ }).then(function() {
+ assert_true(resolvedFinished,
+ 'Animation.finished should be resolved soon after ' +
+ 'Animation finishes normally');
+ });
+}, 'Test normally finished animation resolves finished promise synchronously ' +
+ 'with an animation without a target');
+
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698