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

Unified Diff: LayoutTests/http/tests/w3c/webperf/submission/Google/HighResolutionTime/worker-dedicated-basic.html

Issue 16434011: Support performance.now() in workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 7 years, 6 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/w3c/webperf/submission/Google/HighResolutionTime/worker-dedicated-basic.html
diff --git a/LayoutTests/http/tests/w3c/webperf/submission/Google/HighResolutionTime/worker-dedicated-basic.html b/LayoutTests/http/tests/w3c/webperf/submission/Google/HighResolutionTime/worker-dedicated-basic.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e4f179693948fbc532d8dae1e56475997e2e52c
--- /dev/null
+++ b/LayoutTests/http/tests/w3c/webperf/submission/Google/HighResolutionTime/worker-dedicated-basic.html
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8" />
+<title>window.performance.now in dedicated workers</title>
+<link rel="author" title="Google" href="http://www.google.com/" />
+<link rel="help" href="https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/HighResolutionTime2/Overview.html"/>
+<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;',
+ '"now" in self.performance;',
+ 'self.performance.now();',
+];
+
+var startTime = window.performance.now();
+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.now is defined");
+ test_greater_than(results[2], startTime, "Time in the worker should be after the startTime in the main document");
+ test_greater_than(window.performance.now(), results[2], "Time in the worker should be before the current time in the main document");
+ done();
+}
+
+function start() {
+ worker.postMessage(tests);
+}
+
+window.addEventListener("load", start);
+</script>
+</head>
+<body>
+<h1>Description</h1>
+<p>This test validates that performance.now() exists in dedicated workers and reports reasonable times.</p>
+
+<div id="log"></div>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698