| OLD | NEW |
| (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.ready instanceof Promise); | |
| 9 }, 'The ready attribute should be a Promise'); | |
| 10 | |
| 11 async_test(function(t) { | |
| 12 var player = document.documentElement.animate([], 100000); | |
| 13 player.cancel(); | |
| 14 player.ready.then(function(p) { | |
| 15 t.step(function() { | |
| 16 assert_equals(p, player); | |
| 17 }); | |
| 18 t.done(); | |
| 19 }); | |
| 20 }, 'The ready promise should be resolved when a player is in the idle play state
'); | |
| 21 | |
| 22 test(function() { | |
| 23 var player = document.documentElement.animate([], 100000); | |
| 24 var promise = player.ready; | |
| 25 player.cancel(); | |
| 26 assert_not_equals(player.ready, promise); | |
| 27 }, 'The ready promise should be replaced when the player is cancelled'); | |
| 28 | |
| 29 test(function() { | |
| 30 var player = document.documentElement.animate([], 100000); | |
| 31 player.cancel(); | |
| 32 var promise = player.ready; | |
| 33 player.play(); | |
| 34 assert_not_equals(player.ready, promise); | |
| 35 }, 'The ready promise should be replaced when the player enters the pending stat
e'); | |
| 36 | |
| 37 async_test(function(t) { | |
| 38 var player = document.documentElement.animate([], 100000); | |
| 39 player.ready.then(function() { | |
| 40 t.step(function() { | |
| 41 assert_unreached(); | |
| 42 }); | |
| 43 }, function(e) { | |
| 44 t.step(function() { | |
| 45 assert_equals(e.code, DOMException.ABORT_ERR); | |
| 46 }); | |
| 47 t.done(); | |
| 48 }); | |
| 49 player.cancel(); | |
| 50 }, 'A pending ready promise should be rejected when the player is cancelled'); | |
| 51 | |
| 52 async_test(function(t) { | |
| 53 var player = document.documentElement.animate([], 100000); | |
| 54 var promise = player.ready; | |
| 55 promise.then(function(p) { | |
| 56 t.step(function() { | |
| 57 assert_equals(p, player); | |
| 58 assert_equals(player.ready, promise); | |
| 59 }); | |
| 60 t.done(); | |
| 61 }); | |
| 62 }, 'A pending ready promise should be resolved and not replaced when the player
enters the running state'); | |
| 63 | |
| 64 async_test(function(t) { | |
| 65 var player = document.documentElement.animate([], 100000); | |
| 66 var promise = player.ready; | |
| 67 player.finish(); | |
| 68 promise.then(function(p) { | |
| 69 t.step(function() { | |
| 70 assert_equals(p, player); | |
| 71 assert_equals(player.ready, promise); | |
| 72 }); | |
| 73 t.done(); | |
| 74 }); | |
| 75 }, 'A pending ready promise should be resolved and not replaced when the player
enters the finished state'); | |
| 76 | |
| 77 async_test(function(t) { | |
| 78 var player = document.documentElement.animate([], 100000); | |
| 79 var promise = player.ready; | |
| 80 player.pause(); | |
| 81 promise.then(function(p) { | |
| 82 t.step(function() { | |
| 83 assert_equals(p, player); | |
| 84 assert_equals(player.ready, promise); | |
| 85 }); | |
| 86 t.done(); | |
| 87 }); | |
| 88 }, 'A pending ready promise should be resolved and not replaced when the player
enters the paused state'); | |
| 89 </script> | |
| OLD | NEW |