| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <meta charset="utf-8" /> |
| 5 <title>window.performance.memory in shared workers</title> |
| 6 <script src="/w3c/resources/testharness.js"></script> |
| 7 <script src="/w3c/resources/testharnessreport.js"></script> |
| 8 <script src="/w3c/webperf/resources/webperftestharness.js"></script> |
| 9 <link rel="stylesheet" href="/w3c/resources/testharness.css" /> |
| 10 <script> |
| 11 setup({explicit_done: true, timeout:10000}); |
| 12 |
| 13 var tests = [ |
| 14 '"performance" in self;', |
| 15 '"memory" in self.performance;', |
| 16 'JSON.stringify(self.performance.memory);', |
| 17 ]; |
| 18 |
| 19 var worker = new SharedWorker("/w3c/webperf/resources/worker.js"); |
| 20 |
| 21 worker.port.onmessage = function(event) { |
| 22 var results = event.data; |
| 23 assert_true(results.length == 3); |
| 24 test_true(results[0], "self.performance is defined"); |
| 25 test_true(results[1], "self.performance.memory is defined"); |
| 26 var jsHeap = JSON.parse(results[2]); |
| 27 test_greater_or_equals(jsHeap.jsHeapSizeLimit, jsHeap.totalJSHeapSize, "jsHe
apSizeLimit should be no less than totalJSHeapSize", {}); |
| 28 test_greater_or_equals(jsHeap.totalJSHeapSize, jsHeap.usedJSHeapSize, "total
JSHeapSize should be no less than usedJSHeapSize", {}); |
| 29 worker.port.postMessage(["close();"]); |
| 30 done(); |
| 31 } |
| 32 |
| 33 |
| 34 function start() { |
| 35 worker.port.postMessage(tests); |
| 36 } |
| 37 |
| 38 window.addEventListener("load", start); |
| 39 </script> |
| 40 </head> |
| 41 <body> |
| 42 <h1>Description</h1> |
| 43 <p>This test validates that performance.memory exists in shared workers.</p> |
| 44 |
| 45 <div id="log"></div> |
| 46 |
| 47 </body> |
| 48 </html> |
| OLD | NEW |