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

Unified Diff: LayoutTests/http/tests/misc/performance-memory-in-dedicated-worker.html

Issue 106353005: Expose performance.memory in workers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@Perf-Memory-SharedWorker
Patch Set: Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
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..c420d7bad4a14e759d874a25f8696aa80972c4e8
--- /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;',
+ 'JSON.stringify(self.performance.memory);',
+];
+
+var worker = new Worker("/w3c/webperf/resources/worker.js");
+
+worker.onmessage = function(event) {
+ var results = event.data;
+ assert_true(results.length == 3);
+ test_true(results[0], "self.performance is defined");
+ test_true(results[1], "self.performance.memory is defined");
+ var jsHeap = JSON.parse(results[2]);
+ 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>

Powered by Google App Engine
This is Rietveld 408576698