Chromium Code Reviews| Index: LayoutTests/http/tests/misc/performance-memory-in-dedicated-worker.html |
| diff --git a/LayoutTests/http/tests/misc/performance-memory-in-dedicated-worker.html b/LayoutTests/http/tests/misc/performance-memory-in-dedicated-worker.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9dfb50f97e3e897883d61c37a1cec694a7191f7d |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/misc/performance-memory-in-dedicated-worker.html |
| @@ -0,0 +1,46 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<meta charset="utf-8" /> |
| +<title>window.performance.memory in dedicated workers</title> |
| +<script src="/w3c/resources/testharness.js"></script> |
| +<script src="/w3c/resources/testharnessreport.js"></script> |
| +<script src="/w3c/webperf/resources/webperftestharness.js"></script> |
| +<link rel="stylesheet" href="/w3c/resources/testharness.css" /> |
| +<script> |
| +setup({explicit_done: true}); |
| + |
| +var tests = [ |
| + '"performance" in self;', |
| + '"memory" in self.performance;', |
| + 'self.performance.memory;', |
|
sof
2014/03/24 07:54:44
Change this to 'JSON.stringify(self.performance.me
|
| +]; |
| + |
| +var worker = new Worker("/w3c/webperf/resources/worker.js"); |
| + |
| +worker.onmessage = function(event) { |
| + var results = JSON.parse(event.data); |
| + var jsHeap = results[2]; |
|
sof
2014/03/24 07:54:44
Move this down to just before it is used & explici
|
| + assert_true(results.length == 3); |
| + test_true(results[0], "self.performance is defined"); |
| + test_true(results[1], "self.performance.memory is defined"); |
| + test_greater_or_equals(jsHeap.jsHeapSizeLimit, jsHeap.totalJSHeapSize, "jsHeapSizeLimit should be no less than totalJSHeapSize", {}); |
| + test_greater_or_equals(jsHeap.totalJSHeapSize, jsHeap.usedJSHeapSize, "totalJSHeapSize should be no less than usedJSHeapSize", {}); |
| + done(); |
| +} |
| + |
| +function start() { |
| + worker.postMessage(tests); |
| +} |
| + |
| +window.addEventListener("load", start); |
| +</script> |
| +</head> |
| +<body> |
| +<h1>Description</h1> |
| +<p>This test validates that performance.memory exists in dedicated workers </p> |
| + |
| +<div id="log"></div> |
| + |
| +</body> |
| +</html> |