| Index: LayoutTests/imported/web-platform-tests/hr-time/basic.html
|
| diff --git a/LayoutTests/http/tests/w3c/webperf/approved/HighResolutionTime/basic.html b/LayoutTests/imported/web-platform-tests/hr-time/basic.html
|
| similarity index 62%
|
| rename from LayoutTests/http/tests/w3c/webperf/approved/HighResolutionTime/basic.html
|
| rename to LayoutTests/imported/web-platform-tests/hr-time/basic.html
|
| index ffc88775ad54d7beb7ee0b2026ce1d708767e145..ff15cdc7c213a2bf54bbcb21b0c5f77b0c101afa 100644
|
| --- a/LayoutTests/http/tests/w3c/webperf/approved/HighResolutionTime/basic.html
|
| +++ b/LayoutTests/imported/web-platform-tests/hr-time/basic.html
|
| @@ -5,9 +5,9 @@
|
| <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="/w3c/resources/testharness.js"></script>
|
| -<script src="/w3c/resources/testharnessreport.js"></script>
|
| -<link rel="stylesheet" href="/w3c/resources/testharness.css" />
|
| +<script src="../../../resources/testharness.js"></script>
|
| +<script src="../../../resources/testharnessreport.js"></script>
|
| +<link rel="stylesheet" href="../../../resources/testharness.css" />
|
| <script>
|
| test(function() {
|
| assert_equals(typeof window.performance, "object");
|
| @@ -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>
|
|
|