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

Side by Side Diff: third_party/WebKit/LayoutTests/external/wpt/hr-time/window-worker-time-origin.html

Issue 2675133002: Import wpt@97e16bef6d6599ae805521e2007a9430a12aa144 (Closed)
Patch Set: Revert change to W3CImportExpectations Created 3 years, 10 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
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <title>performance.now() time origin</title>
6 <meta name="author" title="JosephPecoraro" href="mailto:joepeck@webkit.org">
7 <meta name="assert" content="Time origin in Worker should be Worker's moment of creation.">
8 <link rel="help" href="https://w3c.github.io/hr-time/#time-origin-1">
9 <script src="/resources/testharness.js"></script>
10 <script src="/resources/testharnessreport.js"></script>
11 <script>
12 async_test(function(t) {
13 this.step_timeout(function() {
14 var workerScript = 'postMessage({now: performance.now()})';
15 var blob = new Blob([workerScript]);
16 var worker = new Worker(URL.createObjectURL(blob));
17 var windowWorkerCreationTime = performance.now();
18 worker.addEventListener("message", t.step_func_done(function(event) {
19 var workerNow = event.data.now;
20
21 // We waited 1s to spawn the worker. So verify the worker timestamp is at least less then 0.5 seconds.
22 assert_less_than(workerNow, 500, "worker performance.now() must be very cl ose to its creation time");
23
24 // We waited 1s to spawn the worker. Window's now is ~1000, Worker's now w ill be much lower.
25 assert_greater_than(windowWorkerCreationTime - workerNow, 500, "window's t ime origin must be before worker's time origin");
26 }));
27 }, 1000);
28 }, 'Worker time origin is approximately its creation time');
29 </script>
30 </head>
31 <body>
32 <h1>Description</h1>
33 <p>This test validates that a Worker's time origin is its moment of creation and differs from its spawner's.</p>
34 <div id="log"></div>
35 </body>
36 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698