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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/wpt/hr-time/basic.html

Issue 2015623004: Import wpt@ed94c51f3dfaa5ff4c9c311add1a560408059c51 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <meta charset="utf-8" /> 4 <meta charset="utf-8" />
5 <title>window.performance.now exists</title> 5 <title>window.performance.now exists</title>
6 <link rel="author" title="W3C" href="http://www.w3.org/" /> 6 <link rel="author" title="W3C" href="http://www.w3.org/" />
7 <link rel="help" href="http://www.w3.org/TR/hr-time/#sec-extenstions-performance -interface"/> 7 <link rel="help" href="http://www.w3.org/TR/hr-time/#sec-extenstions-performance -interface"/>
8 <script src="../../../resources/testharness.js"></script> 8 <script src="../../../resources/testharness.js"></script>
9 <script src="../../../resources/testharnessreport.js"></script> 9 <script src="../../../resources/testharnessreport.js"></script>
10 <script> 10 <script>
(...skipping 10 matching lines...) Expand all
21 }, "window.performance.now() function", {assert: "window.performance.now is a fu nction"}); 21 }, "window.performance.now() function", {assert: "window.performance.now is a fu nction"});
22 22
23 test(function() { 23 test(function() {
24 assert_equals(typeof window.performance.now(), "number", "window.performance.n ow() returns a number"); 24 assert_equals(typeof window.performance.now(), "number", "window.performance.n ow() returns a number");
25 }, "window.performance.now() returns a number", {assert: "The now method MUST re turn a DOMHighResTimeStamp"}); 25 }, "window.performance.now() returns a number", {assert: "The now method MUST re turn a DOMHighResTimeStamp"});
26 26
27 async_test(function() { 27 async_test(function() {
28 // Check whether the performance.now() method is close to Date() within 30ms ( due to inaccuracies) 28 // Check whether the performance.now() method is close to Date() within 30ms ( due to inaccuracies)
29 var initial_hrt = performance.now(); 29 var initial_hrt = performance.now();
30 var initial_date = Date.now(); 30 var initial_date = Date.now();
31 setTimeout(this.step_func(function() { 31 this.step_timeout(function() {
32 var final_hrt = performance.now(); 32 var final_hrt = performance.now();
33 var final_date = Date.now(); 33 var final_date = Date.now();
34 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'); 34 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');
35 this.done(); 35 this.done();
36 }), 2000); 36 }, 2000);
37 }, 'High resolution time has approximately the right relative magnitude'); 37 }, 'High resolution time has approximately the right relative magnitude');
38 </script> 38 </script>
39 </head> 39 </head>
40 <body> 40 <body>
41 <h1>Description</h1> 41 <h1>Description</h1>
42 <p>This test validates that window.performance.now() exist and is a function.</p > 42 <p>This test validates that window.performance.now() exist and is a function.</p >
43 43
44 <div id="log"></div> 44 <div id="log"></div>
45 45
46 </body> 46 </body>
47 </html> 47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698