mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Timestamp fix for issue #5690
This commit is contained in:
parent
ad5846f2e1
commit
1612f723a8
4 changed files with 23 additions and 1 deletions
|
@ -24,6 +24,18 @@ test(function() {
|
|||
test(function() {
|
||||
assert_equals(typeof window.performance.now(), "number", "window.performance.now() returns a number");
|
||||
}, "window.performance.now() returns a number", {assert: "The now method MUST return a DOMHighResTimeStamp"});
|
||||
|
||||
async_test(function() {
|
||||
// Check whether the performance.now() method is close to Date() within 30ms (due to inaccuracies)
|
||||
var initial_hrt = performance.now();
|
||||
var initial_date = Date.now();
|
||||
setTimeout(this.step_func(function() {
|
||||
var final_hrt = performance.now();
|
||||
var final_date = Date.now();
|
||||
assert_approx_equals(final_hrt - initial_hrt, final_date - initial_date, 30, 'High resolution time value increased by approximately the same amount as time from date object');
|
||||
this.done();
|
||||
}), 2000);
|
||||
}, 'High resolution time has approximately the right relative magnitude');
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue