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
.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
;
15 promise
.then(function(p
) {
17 assert_equals(promise
, player
.finished
);
21 }, 'The finished promise should not be replaced when the player finishes');
23 async_test(function(t
) {
24 var player
= document
.documentElement
.animate([], 100000);
26 player
.finished
.then(function(p
) {
28 assert_equals(p
, player
);
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
) {
38 assert_equals(e
.code
, DOMException
.ABORT_ERR
);
43 }, 'The finished promise should be rejected if the player is cancelled');
46 var player
= document
.documentElement
.animate([], 100000);
48 var promise
= player
.finished
;
50 assert_not_equals(player
.finished
, promise
);
51 }, 'A new finished promise should be created when a finished player is resumed');
54 var player
= document
.documentElement
.animate([], 100000);
55 var promise
= player
.finished
;
57 assert_not_equals(player
.finished
, promise
);
58 }, 'A new finished promise should be created when a running player is cancelled');
61 var player
= document
.documentElement
.animate([], 100000);
62 var promise
= player
.finished
;
65 assert_not_equals(player
.finished
, promise
);
66 }, 'A new finished promise should be created when a finished player is cancelled');