2 <script src=
"../resources/testharness.js"></script>
3 <script src=
"../resources/testharnessreport.js"></script>
7 var startTime
= document
.timeline
.currentTime
;
8 assert_greater_than_equal(startTime
, 0);
9 var start
= performance
.now();
10 while (performance
.now() < start
+ 250)
12 assert_equals(document
.timeline
.currentTime
, startTime
);
13 }, 'document.timeline.currentTime should not change within a script block.');
16 var timeoutTest
= async_test('document.timeline.currentTime time should change after a script timeout');
17 var startTime
= document
.timeline
.currentTime
;
19 setTimeout(function() {
20 timeoutTest
.step(function() {
21 assert_greater_than(document
.timeline
.currentTime
, startTime
);
28 var rafTest
= async_test('document.timeline.currentTime time should be the same for all RAF callbacks in a frame');
29 var startTime
= document
.timeline
.currentTime
;
32 requestAnimationFrame(function() {
33 rafTest
.step(function() {
34 assert_greater_than_equal(document
.timeline
.currentTime
, startTime
);
35 firstRafTime
= document
.timeline
.currentTime
;
39 requestAnimationFrame(function() {
40 rafTest
.step(function() {
41 assert_equals(document
.timeline
.currentTime
, firstRafTime
);
48 var timeoutTest
= async_test('document.timeline.currentTime time should use the same reference as performance.now()');
50 setTimeout(function() {
51 timeoutTest
.step(function() {
52 assert_less_than(Math
.abs(document
.timeline
.currentTime
- performance
.now()), 1000);