summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/hr-time/basic.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /testing/web-platform/tests/hr-time/basic.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'testing/web-platform/tests/hr-time/basic.html')
-rw-r--r--testing/web-platform/tests/hr-time/basic.html47
1 files changed, 47 insertions, 0 deletions
diff --git a/testing/web-platform/tests/hr-time/basic.html b/testing/web-platform/tests/hr-time/basic.html
new file mode 100644
index 000000000..cc26d242f
--- /dev/null
+++ b/testing/web-platform/tests/hr-time/basic.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>window.performance.now exists</title>
+<link rel="author" title="W3C" href="http://www.w3.org/" />
+<link rel="help" href="http://www.w3.org/TR/hr-time/#sec-extenstions-performance-interface"/>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+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(window.performance.now, undefined, 'window.performance.now is defined');
+}, "High Resolution Time extension to the Performance interface", {assert: "window.performance.now exists"});
+
+test(function() {
+ assert_equals(typeof window.performance.now, "function", "window.performance.now is a function");
+}, "window.performance.now() function", {assert: "window.performance.now is a 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();
+ this.step_timeout(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>
+<h1>Description</h1>
+<p>This test validates that window.performance.now() exist and is a function.</p>
+
+<div id="log"></div>
+
+</body>
+</html>