Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Unified Diff: LayoutTests/imported/web-platform-tests/hr-time/basic.html

Issue 1191043004: Import hr-time and user-timing tests, remove redundant webperf copies (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add idlharness result Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>

Powered by Google App Engine
This is Rietveld 408576698