| <!DOCTYPE html> |
| <body> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script> |
| var anim1 = document.body.animate([], 100000); |
| var anim2 = document.body.animate([], 100000); |
| |
| var cancelTest = async_test('Cancelling animation should create cancel event.'); |
| var fired = false; |
| |
| anim1.oncancel = function(event) { |
| cancelTest.step(function() { |
| assert_equals(event.target, anim1, 'Target of cancel event should be anim1.'); |
| assert_equals(event.currentTime, null, 'currentTime of cancel event should be null.'); |
| assert_equals(event.timelineTime, document.timeline.currentTime, 'Event timelineTime should be same as document.timeline.currentTime.'); |
| }); |
| fired = true; |
| }; |
| |
| anim2.onfinish = function() { |
| cancelTest.step(function() { |
| assert_true(fired, 'anim1.oncancel should be called.'); |
| }); |
| cancelTest.done(); |
| }; |
| |
| anim1.cancel(); |
| anim2.finish(); |
| </script> |
| </body> |