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

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/Animation/finish.html

Issue 1999243002: Import wpt@5df9b57edb3307a87d5187804b29c8ddd2aa14e1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add expectations files (using run-webkit-tests --new-baseline) 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/wpt/web-animations/interfaces/Animation/finish.html
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/web-animations/animation/finish.html b/third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/Animation/finish.html
similarity index 74%
rename from third_party/WebKit/LayoutTests/imported/wpt/web-animations/animation/finish.html
rename to third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/Animation/finish.html
index 8238b5081f7202864fd3f83a8373f746b8a316cf..9a82c9f2cc65a273ffcf61a2805c15bf113920d4 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/web-animations/animation/finish.html
+++ b/third_party/WebKit/LayoutTests/imported/wpt/web-animations/interfaces/Animation/finish.html
@@ -2,10 +2,10 @@
<meta charset=utf-8>
<title>Animation.finish()</title>
<link rel="help" href="https://w3c.github.io/web-animations/#dom-animation-finish">
-<script src="../../../../resources/testharness.js"></script>
-<script src="../../../../resources/testharnessreport.js"></script>
-<script src="../testcommon.js"></script>
-<link rel="stylesheet" href="../../../../resources/testharness.css">
+<script src="../../../../../resources/testharness.js"></script>
+<script src="../../../../../resources/testharnessreport.js"></script>
+<script src="../../testcommon.js"></script>
+<link rel="stylesheet" href="../../../../../resources/testharness.css">
<body>
<div id="log"></div>
<script>
@@ -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