2 <script src=
"../resources/testharness.js"></script>
3 <script src=
"../resources/testharnessreport.js"></script>
7 var player
= document
.documentElement
.animate([], 100000);
8 assert_true(player
.ready
instanceof Promise
);
9 }, 'The ready attribute should be a Promise');
11 async_test(function(t
) {
12 var player
= document
.documentElement
.animate([], 100000);
14 player
.ready
.then(function(p
) {
16 assert_equals(p
, player
);
20 }, 'The ready promise should be resolved when a player is in the idle play state');
23 var player
= document
.documentElement
.animate([], 100000);
24 var promise
= player
.ready
;
26 assert_not_equals(player
.ready
, promise
);
27 }, 'The ready promise should be replaced when the player is cancelled');
30 var player
= document
.documentElement
.animate([], 100000);
32 var promise
= player
.ready
;
34 assert_not_equals(player
.ready
, promise
);
35 }, 'The ready promise should be replaced when the player enters the pending state');
37 async_test(function(t
) {
38 var player
= document
.documentElement
.animate([], 100000);
39 player
.ready
.then(function() {
45 assert_equals(e
.code
, DOMException
.ABORT_ERR
);
50 }, 'A pending ready promise should be rejected when the player is cancelled');
52 async_test(function(t
) {
53 var player
= document
.documentElement
.animate([], 100000);
54 var promise
= player
.ready
;
55 promise
.then(function(p
) {
57 assert_equals(p
, player
);
58 assert_equals(player
.ready
, promise
);
62 }, 'A pending ready promise should be resolved and not replaced when the player enters the running state');
64 async_test(function(t
) {
65 var player
= document
.documentElement
.animate([], 100000);
66 var promise
= player
.ready
;
68 promise
.then(function(p
) {
70 assert_equals(p
, player
);
71 assert_equals(player
.ready
, promise
);
75 }, 'A pending ready promise should be resolved and not replaced when the player enters the finished state');
77 async_test(function(t
) {
78 var player
= document
.documentElement
.animate([], 100000);
79 var promise
= player
.ready
;
81 promise
.then(function(p
) {
83 assert_equals(p
, player
);
84 assert_equals(player
.ready
, promise
);
88 }, 'A pending ready promise should be resolved and not replaced when the player enters the paused state');