blob: aabdc55a706a917f73fb965acdd4a7879b086ce2 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8" />
<title> exists</title>
<link rel="author" title="W3C" href="" />
<link rel="help" href=""/>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="stylesheet" href="/resources/testharness.css" />
test(function() {
assert_equals(typeof window.performance, "object");
}, "window.performance is defined", {assert: "The window.performance attribute provides a hosting area for performance related attributes."});
test(function() {
assert_not_equals(, undefined, ' is defined');
}, "High Resolution Time extension to the Performance interface", {assert: " exists"});
test(function() {
assert_equals(typeof, "function", " is a function");
}, " function", {assert: " is a function"});
test(function() {
assert_equals(typeof, "number", " returns a number");
}, " returns a number", {assert: "The now method MUST return a DOMHighResTimeStamp"});
async_test(function() {
// Check whether the method is close to Date() within 30ms (due to inaccuracies)
var initial_hrt =;
var initial_date =;
setTimeout(this.step_func(function() {
var final_hrt =;
var final_date =;
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');
}), 2000);
}, 'High resolution time has approximately the right relative magnitude');
<p>This test validates that exist and is a function.</p>
<div id="log"></div>