Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / web-animations-api / player-finished-promise.html
blob22d806c2eb8eca8fdd20b4a2ce2ace8ba569cf6a
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
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');
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');
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');
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');
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');
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');
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>