| <!DOCTYPE html> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <body> |
| <script> |
| function infiniteAnimation() { |
| var anim = document.body.animate([], |
| {duration: 1000, iterations: Infinity}); |
| anim.cancel(); |
| return anim; |
| } |
| |
| test(function() { |
| var anim = infiniteAnimation(); |
| try { |
| anim.finish(); |
| assert_unreached(); |
| } catch (e) { |
| assert_equals(e.code, DOMException.INVALID_STATE_ERR); |
| } |
| }, "finishing an infinite animation"); |
| |
| test(function() { |
| var anim = infiniteAnimation(); |
| anim.playbackRate = -1; |
| try { |
| anim.pause(); |
| assert_unreached(); |
| } catch (e) { |
| assert_equals(e.code, DOMException.INVALID_STATE_ERR); |
| } |
| }, "pausing a reversed infinite animation"); |
| |
| test(function() { |
| var anim = infiniteAnimation(); |
| anim.playbackRate = -1; |
| try { |
| anim.play(); |
| assert_unreached(); |
| } catch (e) { |
| assert_equals(e.code, DOMException.INVALID_STATE_ERR); |
| } |
| }, "playing a reversed infinite animation"); |
| |
| test(function() { |
| var anim = infiniteAnimation(); |
| try { |
| anim.reverse(); |
| assert_unreached(); |
| } catch (e) { |
| assert_equals(e.code, DOMException.INVALID_STATE_ERR); |
| } |
| }, "reversing an infinite animation"); |
| </script> |