Chromium Code Reviews| Index: LayoutTests/web-animations-api/timeline-time.html |
| diff --git a/LayoutTests/web-animations-api/timeline-time.html b/LayoutTests/web-animations-api/timeline-time.html |
| index 359e22662fd636f74fc37d8e8e7173f7386501d4..d69cb4b346dc0dcee2626c07a612b53e7f420b0f 100644 |
| --- a/LayoutTests/web-animations-api/timeline-time.html |
| +++ b/LayoutTests/web-animations-api/timeline-time.html |
| @@ -2,25 +2,43 @@ |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| -<body> |
| - <div id='element'></div> |
| -</body> |
| - |
| <script> |
| -var element = document.getElementById('element'); |
| -var duration = 1; |
| - |
| -var animation = new Animation(element, |
| - [{opacity: '1', offset: 0}, |
| - {opacity: '0', offset: 1}], |
| - duration); |
| - |
| test(function() { |
| - var startTime = document.timeline.currentTime; |
| - var player = document.timeline.play(animation); |
| - player.finish(); |
| - var finishTime = document.timeline.currentTime; |
| - assert_greater_than_equal(startTime, 0); |
| - assert_equals(startTime, finishTime); |
| + var startTime = document.timeline.currentTime; |
| + assert_greater_than_equal(startTime, 0); |
| + var start = performance.now(); |
| + while (performance.now() < start + 250) |
| + /* wait */; |
| + assert_equals(document.timeline.currentTime, startTime); |
| }, 'document.timeline.currentTime should not change within a script block.'); |
| + |
| +(function() { |
| + var timeoutTest = async_test('document.timeline.currentTime time should change after a script timeout'); |
| + var startTime = document.timeline.currentTime; |
| + |
| + setTimeout(function() { |
| + timeoutTest.step(function() { |
| + assert_greater_than(document.timeline.currentTime, startTime); |
| + }); |
| + timeoutTest.done(); |
| + }, 100); |
| +})(); |
| + |
| +(function() { |
| + var rafTest = async_test('document.timeline.currentTime time should be the same for all RAF callbacks in a frame'); |
| + var firstRafTime; |
|
dstockwell
2014/04/30 12:07:22
I'm going to add a test to check the consistency b
|
| + |
| + requestAnimationFrame(function() { |
| + rafTest.step(function() { |
| + firstRafTime = document.timeline.currentTime; |
| + }); |
| + }); |
| + |
| + requestAnimationFrame(function() { |
| + rafTest.step(function() { |
| + assert_equals(document.timeline.currentTime, firstRafTime); |
| + }); |
| + rafTest.done(); |
| + }); |
| +})(); |
| </script> |