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

Unified Diff: LayoutTests/fast/workers/worker-timeout-increasing-order.html

Issue 563203002: [Blink-WebWorkers] WorkerSharedTimer cancels extra delayed tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix for Linux ASAN crash. Created 6 years, 3 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/fast/workers/worker-timeout-increasing-order.html
diff --git a/LayoutTests/fast/workers/worker-timeout-increasing-order.html b/LayoutTests/fast/workers/worker-timeout-increasing-order.html
new file mode 100644
index 0000000000000000000000000000000000000000..3c40a306ada548df63fa349fff53aa213ee79b18
--- /dev/null
+++ b/LayoutTests/fast/workers/worker-timeout-increasing-order.html
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>Test setTimeOut,fired in increasing order in Web Workers.</p>
+<div id="result"></div>
+<script type="text/javascript">
+function log(message)
+{
+ document.getElementById("result").innerHTML += message + "</br>";
+}
+
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+}
+
+var worker = new Worker('resources/worker-timeout-increasing-order.js');
+var lastTestResult = 0;
+var testCounterLimit = 3;
+var timerLimit = 3;
+var testStarted = false;
+var testAlreadyFailed = false;
+
+worker.postMessage("TS");
+
+worker.onmessage = function(evt) {
+ if(testStarted) {
+ var currentNum = evt.data;
+ if(lastTestResult == currentNum - 1 && !testAlreadyFailed) {
+ lastTestResult = currentNum;
+ --timerLimit;
+ // we got all the results in order
+ if(lastTestResult == testCounterLimit && timerLimit == 0)
+ log("PASS: Timeouts executed in order.");
+ }
+ else {
+ testAlreadyFailed = true;
+ --timerLimit;
+ if(timerLimit == 0)
+ log("FAIL: PASS: Timeouts executed out of order.");
+ }
+ }
+ if(evt.data == "Test started.") {
+ log(evt.data);
+ testStarted = true;
+ }
+ if (evt.data == "DONE") {
+ log("DONE.");
+ if (window.testRunner)
+ testRunner.notifyDone();
+ }
+}
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698