Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / web-animations-api / player-ready-finished-ordering.html
blobf3f54126fe7a25b3616cc67f14c25eacfc6f0ffd
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
5 <script>
6 async_test(function(t) {
7 var player = document.documentElement.animate([], 100000);
8 var ready = false;
9 player.ready.then(function() {
10 t.step(function() {
11 ready = true;
12 });
13 });
14 player.finished.then(function() {
15 t.step(function() {
16 assert_true(ready);
17 });
18 t.done();
19 });
20 player.finish();
21 }, 'The ready promise should be resolved before the finished promise');
23 async_test(function(t) {
24 var player = document.documentElement.animate([], 100000);
25 var ready = false;
26 player.ready.then(null, function() {
27 t.step(function() {
28 ready = true;
29 });
30 });
31 player.finished.then(null, function() {
32 t.step(function() {
33 assert_true(ready);
34 });
35 t.done();
36 });
37 player.cancel();
38 }, 'The ready promise should be rejected before the finished promise');
39 </script>