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

Side by Side Diff: LayoutTests/web-animations-api/player-finished-promise.html

Issue 832713004: Web Animations: Implement the AnimationPlayer finished promise (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptPromiseProperties.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4
5 <script>
6 test(function() {
7 var player = document.documentElement.animate([], 100000);
8 assert_true(player.finished instanceof Promise);
9 }, 'The finished attribute should be a Promise');
10
11 async_test(function(t) {
12 var player = document.documentElement.animate([], 100000);
13 var promise = player.finished;
14 player.finish();
15 promise.then(function(p) {
16 t.step(function() {
17 assert_equals(promise, player.finished);
18 });
19 t.done();
20 });
21 }, 'The finished promise should not be replaced when the player finishes');
22
23 async_test(function(t) {
24 var player = document.documentElement.animate([], 100000);
25 player.finish();
26 player.finished.then(function(p) {
27 t.step(function() {
28 assert_equals(p, player);
29 });
30 t.done();
31 });
32 }, 'The finished promise should resolve when the player finishes');
33
34 async_test(function(t) {
35 var player = document.documentElement.animate([], 100000);
36 player.finished.then(function() {}, function(e) {
37 t.step(function() {
38 assert_equals(e.code, DOMException.ABORT_ERR);
39 });
40 t.done();
41 });
42 player.cancel();
43 }, 'The finished promise should be rejected if the player is cancelled');
44
45 test(function() {
46 var player = document.documentElement.animate([], 100000);
47 player.finish();
48 var promise = player.finished;
49 player.play();
50 assert_not_equals(player.finished, promise);
51 }, 'A new finished promise should be created when a finished player is resumed') ;
52
53 test(function() {
54 var player = document.documentElement.animate([], 100000);
55 var promise = player.finished;
56 player.cancel();
57 assert_not_equals(player.finished, promise);
58 }, 'A new finished promise should be created when a running player is cancelled' );
59
60 test(function() {
61 var player = document.documentElement.animate([], 100000);
62 var promise = player.finished;
63 player.finish();
64 player.cancel();
65 assert_not_equals(player.finished, promise);
66 }, 'A new finished promise should be created when a finished player is cancelled ');
67 </script>
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/ScriptPromiseProperties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698