Home | History | Annotate | Download | only in blink
      1 <!DOCTYPE html>
      2 <script src="testharness/testharness.js"></script>
      3 <script src="testharness/testharnessreport.js"></script>
      4 <style>
      5 @keyframes test {
      6     from { opacity: 0; }
      7     to { opacity: 1; }
      8 }
      9 .cssAnimation {
     10     animation: test 2s;
     11 }
     12 </style>
     13 <div id='container'>
     14     <div id='element'></div>
     15 </div>
     16 
     17 <script>
     18 async_test(function(t) {
     19     assert_equals(document.timeline.getAnimationPlayers().length, 0);
     20     assert_equals(container.getAnimationPlayers().length, 0);
     21     assert_equals(element.getAnimationPlayers().length, 0);
     22 
     23     element.className = 'cssAnimation';
     24     onload = function () {
     25         t.step(function() {
     26             var players = document.timeline.getAnimationPlayers();
     27             assert_equals(players.length, 1);
     28             assert_equals(container.getAnimationPlayers().length, 0);
     29             assert_equals(element.getAnimationPlayers().length, 1);
     30 
     31             players[0].finish();
     32             assert_equals(document.timeline.getAnimationPlayers().length, 0);
     33             assert_equals(container.getAnimationPlayers().length, 0);
     34             assert_equals(element.getAnimationPlayers().length, 0);
     35             t.done();
     36         });
     37     }
     38 }, 'getAnimationPlayers() with cssanimations');
     39 
     40 </script>
     41