summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/web-animations-api/time-consistent-across-frames.html
blob: f72f665680b54548a42dd5bfb15b8129a6e84445 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<iframe id=frame></iframe>

<script>
var handle = async_test('Animation time should tick consistently across frames');
var baseTime = document.timeline.currentTime;
var frameBaseTime = frame.contentDocument.timeline.currentTime;
setTimeout(function() {
  var start = performance.now();
  while (performance.now() - start < 30);
  var delta = document.timeline.currentTime - baseTime;

  var start = performance.now();
  while (performance.now() - start < 30);
  var frameDelta = frame.contentDocument.timeline.currentTime - frameBaseTime;

  handle.step(() => assert_equals(Math.round(delta), Math.round(frameDelta)));
  handle.done();
});
</script>