Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 in shared workers</title> | 5 <title>window.performance.now in shared workers</title> |
| 6 <link rel="author" title="Google" href="http://www.google.com/" /> | 6 <link rel="author" title="Google" href="http://www.google.com/" /> |
| 7 <link rel="help" href="https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighRes olutionTime2/Overview.html"/> | 7 <link rel="help" href="https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighRes olutionTime2/Overview.html"/> |
| 8 <script src="/w3c/resources/testharness.js"></script> | 8 <script src="/w3c/resources/testharness.js"></script> |
| 9 <script src="/w3c/resources/testharnessreport.js"></script> | 9 <script src="/w3c/resources/testharnessreport.js"></script> |
| 10 <script src="/w3c/webperf/resources/webperftestharness.js"></script> | 10 <script src="/w3c/webperf/resources/webperftestharness.js"></script> |
| 11 <link rel="stylesheet" href="/w3c/resources/testharness.css" /> | 11 <link rel="stylesheet" href="/w3c/resources/testharness.css" /> |
| 12 <script> | 12 <script> |
| 13 setup({explicit_done: true, timeout:10000}); | 13 setup({explicit_done: true, timeout:10000}); |
| 14 | 14 |
| 15 var tests = [ | 15 var tests = [ |
| 16 '"performance" in self;', | 16 '"performance" in self;', |
| 17 '"now" in self.performance;', | 17 '"now" in self.performance;', |
| 18 'self.performance.now();', | 18 'self.performance.now();', |
| 19 ]; | 19 ]; |
| 20 | 20 |
| 21 var startTime = window.performance.now(); | 21 var startTime = window.performance.now(); |
| 22 var worker = new SharedWorker("/w3c/webperf/resources/worker.js"); | 22 var worker = new SharedWorker("/w3c/webperf/resources/worker.js"); |
| 23 | 23 |
| 24 worker.port.onmessage = function(event) { | 24 worker.port.onmessage = function(event) { |
| 25 var results = event.data; | 25 var results = JSON.parse(event.data); |
|
sof
2014/03/24 07:54:44
Revert
| |
| 26 assert_true(results.length == 3); | 26 assert_true(results.length == 3); |
| 27 test_true(results[0], "self.performance is defined"); | 27 test_true(results[0], "self.performance is defined"); |
| 28 test_true(results[1], "self.performance.now is defined"); | 28 test_true(results[1], "self.performance.now is defined"); |
| 29 test_greater_than(startTime, results[2], "Time since origin time should be g reater in the main document than the worker"); | 29 test_greater_than(startTime, results[2], "Time since origin time should be g reater in the main document than the worker"); |
| 30 setupIframe(); | 30 setupIframe(); |
| 31 } | 31 } |
| 32 | 32 |
| 33 window.iframeStartTime = 0; | 33 window.iframeStartTime = 0; |
| 34 window.test_iframe = function(event, iframeNow) { | 34 window.test_iframe = function(event, iframeNow) { |
| 35 var workerTime = event.data; | 35 var workerTime = JSON.parse(event.data); |
|
sof
2014/03/24 07:54:44
Revert
| |
| 36 test_greater_than(workerTime, window.iframeStartTime, "Time since origin tim e should be greater in the worker than the iframe", {}); | 36 test_greater_than(workerTime, window.iframeStartTime, "Time since origin tim e should be greater in the worker than the iframe", {}); |
| 37 worker.port.postMessage(["close();"]); | 37 worker.port.postMessage(["close();"]); |
| 38 done(); | 38 done(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 function start() { | 41 function start() { |
| 42 test_true("workerStart" in worker, "workerStart is defined on the SharedWork er object"); | 42 test_true("workerStart" in worker, "workerStart is defined on the SharedWork er object"); |
| 43 test_greater_than(worker.workerStart, 0, "Time of worker start was after the navigation start for the document"); | 43 test_greater_than(worker.workerStart, 0, "Time of worker start was after the navigation start for the document"); |
| 44 worker.port.postMessage(tests); | 44 worker.port.postMessage(tests); |
| 45 } | 45 } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 63 </script> | 63 </script> |
| 64 </head> | 64 </head> |
| 65 <body> | 65 <body> |
| 66 <h1>Description</h1> | 66 <h1>Description</h1> |
| 67 <p>This test validates that performance.now() exists in shared workers and repor ts reasonable times.</p> | 67 <p>This test validates that performance.now() exists in shared workers and repor ts reasonable times.</p> |
| 68 | 68 |
| 69 <div id="log"></div> | 69 <div id="log"></div> |
| 70 | 70 |
| 71 </body> | 71 </body> |
| 72 </html> | 72 </html> |
| OLD | NEW |