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.memory in dedicated workers</title> | 5 <title>window.performance.memory in dedicated workers</title> |
6 <script src="/w3c/resources/testharness.js"></script> | 6 <script src="/w3c/resources/testharness.js"></script> |
7 <script src="/w3c/resources/testharnessreport.js"></script> | 7 <script src="/w3c/resources/testharnessreport.js"></script> |
8 <link rel="stylesheet" href="/w3c/resources/testharness.css" /> | 8 <link rel="stylesheet" href="/w3c/resources/testharness.css" /> |
9 <script> | 9 <script> |
10 | 10 |
11 var tests = [ | 11 var tests = [ |
12 '"performance" in self;', | 12 '"performance" in self;', |
13 '"memory" in self.performance;', | 13 '"memory" in self.performance;', |
14 'JSON.stringify(self.performance.memory);', | 14 'stringifyDOMObject(self.performance.memory);', |
15 ]; | 15 ]; |
16 | 16 |
17 var t = async_test('window.performance.memory in dedicated workers'); | 17 var t = async_test('window.performance.memory in dedicated workers'); |
18 t.step(function() { | 18 t.step(function() { |
19 var worker = new Worker("/w3c/webperf/resources/worker.js"); | 19 var worker = new Worker("/w3c/webperf/resources/worker.js"); |
20 worker.postMessage(tests); | 20 worker.postMessage(tests); |
21 | 21 |
22 worker.onmessage = t.step_func(function(event) { | 22 worker.onmessage = t.step_func(function(event) { |
23 var results = event.data; | 23 var results = event.data; |
24 assert_equals(results.length, 3); | 24 assert_equals(results.length, 3); |
25 assert_true(results[0], "self.performance is defined"); | 25 assert_true(results[0], "self.performance is defined"); |
26 assert_true(results[1], "self.performance.memory is defined"); | 26 assert_true(results[1], "self.performance.memory is defined"); |
27 var jsHeap = JSON.parse(results[2]); | 27 var jsHeap = JSON.parse(results[2]); |
28 assert_greater_than_equal(jsHeap.jsHeapSizeLimit, jsHeap.totalJSHeapSize
, "jsHeapSizeLimit should be no less than totalJSHeapSize", {}); | 28 assert_greater_than_equal(jsHeap.jsHeapSizeLimit, jsHeap.totalJSHeapSize
, "jsHeapSizeLimit should be no less than totalJSHeapSize", {}); |
29 assert_greater_than_equal(jsHeap.totalJSHeapSize, jsHeap.usedJSHeapSize,
"totalJSHeapSize should be no less than usedJSHeapSize", {}); | 29 assert_greater_than_equal(jsHeap.totalJSHeapSize, jsHeap.usedJSHeapSize,
"totalJSHeapSize should be no less than usedJSHeapSize", {}); |
30 t.done(); | 30 t.done(); |
31 }); | 31 }); |
32 }); | 32 }); |
33 | 33 |
34 </script> | 34 </script> |
35 </head> | 35 </head> |
36 <body> | 36 <body> |
37 <h1>Description</h1> | 37 <h1>Description</h1> |
38 <p>This test validates that performance.memory exists in dedicated workers </p> | 38 <p>This test validates that performance.memory exists in dedicated workers </p> |
39 | 39 |
40 <div id="log"></div> | 40 <div id="log"></div> |
41 | 41 |
42 </body> | 42 </body> |
43 </html> | 43 </html> |
OLD | NEW |