OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Tests for current time</title> | 3 <title>Tests for current time</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#current-time"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#current-time"> |
5 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
7 <script src="../../testcommon.js"></script> | 7 <script src="../../testcommon.js"></script> |
8 <body> | 8 <body> |
9 <div id="log"></div> | 9 <div id="log"></div> |
10 <script> | 10 <script> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 animation.startTime = document.timeline.currentTime - 25 * MS_PER_SEC; | 54 animation.startTime = document.timeline.currentTime - 25 * MS_PER_SEC; |
55 | 55 |
56 var timelineTime = document.timeline.currentTime; | 56 var timelineTime = document.timeline.currentTime; |
57 var startTime = animation.startTime; | 57 var startTime = animation.startTime; |
58 var playbackRate = animation.playbackRate; | 58 var playbackRate = animation.playbackRate; |
59 assert_times_equal(animation.currentTime, | 59 assert_times_equal(animation.currentTime, |
60 (timelineTime - startTime) * playbackRate, | 60 (timelineTime - startTime) * playbackRate, |
61 'Animation has a unresolved start time'); | 61 'Animation has a unresolved start time'); |
62 }, 'The current time is calculated from the timeline time, start time and ' + | 62 }, 'The current time is calculated from the timeline time, start time and ' + |
63 'playback rate'); | 63 'playback rate'); |
| 64 |
| 65 promise_test(function(t) { |
| 66 var animation = createDiv(t).animate(null, 100 * MS_PER_SEC); |
| 67 animation.playbackRate = 0; |
| 68 |
| 69 return animation.ready.then(function() { |
| 70 return waitForAnimationFrames(1); |
| 71 }).then(function() { |
| 72 assert_times_equal(animation.currentTime, 0); |
| 73 }); |
| 74 }, 'The current time does not progress if playback rate is 0'); |
| 75 |
64 </script> | 76 </script> |
65 </body> | 77 </body> |
OLD | NEW |