OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <meta charset=utf-8> | |
3 <title>Document timeline is increasing</title> | |
4 <link rel="help" href="http://w3c.github.io/web-animations/#the-documents-defaul
t-timeline"> | |
5 <script src="../resources/testharness.js"></script> | |
6 <script src="../resources/testharnessreport.js"></script> | |
7 | |
8 <script> | |
9 test(function() { | |
10 var startTime = document.timeline.currentTime; | |
11 assert_greater_than_equal(startTime, 0); | |
12 var start = performance.now(); | |
13 while (performance.now() < start + 250) | |
14 /* wait */; | |
15 assert_equals(document.timeline.currentTime, startTime); | |
16 }, 'document.timeline.currentTime should not change within a script block.'); | |
17 | |
18 (function() { | |
19 var timeoutTest = async_test('document.timeline.currentTime time should change
after a script timeout'); | |
20 var startTime = document.timeline.currentTime; | |
21 | |
22 setTimeout(function() { | |
23 timeoutTest.step(function() { | |
24 assert_greater_than(document.timeline.currentTime, startTime); | |
25 }); | |
26 timeoutTest.done(); | |
27 }, 100); | |
28 })(); | |
29 | |
30 (function() { | |
31 var rafTest = async_test('document.timeline.currentTime time should be the sam
e for all RAF callbacks in a frame'); | |
32 var startTime = document.timeline.currentTime; | |
33 var firstRafTime; | |
34 | |
35 requestAnimationFrame(function() { | |
36 rafTest.step(function() { | |
37 assert_greater_than_equal(document.timeline.currentTime, startTime); | |
38 firstRafTime = document.timeline.currentTime; | |
39 }); | |
40 }); | |
41 | |
42 requestAnimationFrame(function() { | |
43 rafTest.step(function() { | |
44 assert_equals(document.timeline.currentTime, firstRafTime); | |
45 }); | |
46 rafTest.done(); | |
47 }); | |
48 })(); | |
49 | |
50 (function() { | |
51 var timeoutTest = async_test('document.timeline.currentTime time should use th
e same reference as performance.now()'); | |
52 | |
53 setTimeout(function() { | |
54 timeoutTest.step(function() { | |
55 assert_less_than(Math.abs(document.timeline.currentTime - performance.now(
)), 1000); | |
56 }); | |
57 timeoutTest.done(); | |
58 }, 0); | |
59 })(); | |
60 </script> | |
OLD | NEW |