-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
317d245
commit 328910a
Showing
4 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/webappapis.html#update-the-rendering"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<script> | ||
/* Coarsen to 5 microseconds or coarser */ | ||
const COARSE_RESOLUTION = 0.005; | ||
|
||
const CUSTOM_TIMELINE_DELTA = 0.002; | ||
const FLOATING_POINT_ERROR_EPSILON = 0.01; | ||
|
||
// Note that this test would fail if the platform introduces a jitter. | ||
// It is recommended that platforms that implement jitter run this test | ||
// with a flag that turns jitter off, if possible. | ||
|
||
const customTimeline = new DocumentTimeline({originTime: CUSTOM_TIMELINE_DELTA}); | ||
promise_test(async t => { | ||
for (let i = 0; i < 32; ++i) { | ||
const timestamp = await new Promise(resolve => requestAnimationFrame(ts => resolve(ts))); | ||
const coarse_timestamp = Math.round(timestamp / COARSE_RESOLUTION) * COARSE_RESOLUTION; | ||
assert_approx_equals(timestamp, coarse_timestamp, FLOATING_POINT_ERROR_EPSILON, | ||
"timestamp should be coarsened"); | ||
assert_approx_equals(timestamp, document.timeline.currentTime, FLOATING_POINT_ERROR_EPSILON, | ||
"document.timeline.currentTimeline should be the same as the rAF callback"); | ||
assert_approx_equals(customTimeline.currentTime + CUSTOM_TIMELINE_DELTA, | ||
timestamp, FLOATING_POINT_ERROR_EPSILON, | ||
"originTime for custom timeline should not be coarsened"); | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
2 changes: 2 additions & 0 deletions
2
test/fixtures/wpt/hr-time/raf-coarsened-time.https.html.headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Cross-Origin-Embedder-Policy: require-corp | ||
Cross-Origin-Opener-Policy: same-origin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters