Index: third_party/WebKit/LayoutTests/external/wpt/web-animations/interfaces/Animation/finished.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/web-animations/interfaces/Animation/finished.html b/third_party/WebKit/LayoutTests/external/wpt/web-animations/interfaces/Animation/finished.html |
index d56de1b0313b4c7148c0f9c547ff507ece881f90..006b54a0af3528410898dcddd62c957b05b0b3bf 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/web-animations/interfaces/Animation/finished.html |
+++ b/third_party/WebKit/LayoutTests/external/wpt/web-animations/interfaces/Animation/finished.html |
@@ -366,5 +366,55 @@ promise_test(function(t) { |
'falls out finished state even though the current finished ' + |
'promise is generated soon after animation state became finished'); |
+promise_test(function(t) { |
+ var animation = createDiv(t).animate(null, 100 * MS_PER_SEC); |
+ var ready = false; |
+ animation.ready.then( |
+ t.step_func(function() { |
+ ready = true; |
+ }), |
+ t.unreached_func('Ready promise must not be rejected') |
+ ); |
+ |
+ var testSuccess = animation.finished.then( |
+ t.step_func(function() { |
+ assert_true(ready, 'Ready promise has resolved'); |
+ }), |
+ t.unreached_func('Finished promise must not be rejected') |
+ ); |
+ |
+ var timeout = waitForAnimationFrames(3).then(function() { |
+ return Promise.reject('Finished promise did not arrive in time'); |
+ }); |
+ |
+ animation.finish(); |
+ return Promise.race([timeout, testSuccess]); |
+}, 'Finished promise should be resolved after the ready promise is resolved'); |
+ |
+promise_test(function(t) { |
+ var animation = createDiv(t).animate(null, 100 * MS_PER_SEC); |
+ var caught = false; |
+ animation.ready.then( |
+ t.unreached_func('Ready promise must not be resolved'), |
+ t.step_func(function() { |
+ caught = true; |
+ }) |
+ ); |
+ |
+ var testSuccess = animation.finished.then( |
+ t.unreached_func('Finished promise must not be resolved'), |
+ t.step_func(function() { |
+ assert_true(caught, 'Ready promise has been rejected'); |
+ }) |
+ ); |
+ |
+ var timeout = waitForAnimationFrames(3).then(function() { |
+ return Promise.reject('Finished promise was not rejected in time'); |
+ }); |
+ |
+ animation.cancel(); |
+ return Promise.race([timeout, testSuccess]); |
+}, 'Finished promise should be rejected after the ready promise is rejected'); |
+ |
</script> |
</body> |