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

Side by Side Diff: LayoutTests/fast/workers/worker-timeout-decreasing-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, 2 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p>Test setTimeOut,fired in decreasing order in Web Workers.</p>
5 <div id="result"></div>
6 <script type="text/javascript">
7 function log(message)
8 {
9 document.getElementById("result").innerHTML += message + "</br>";
10 }
11
12 if (window.testRunner) {
13 testRunner.dumpAsText();
14 testRunner.waitUntilDone();
15 }
16
17 var worker = new Worker('resources/worker-timeout-decreasing-order.js');
18 // Start the first test of settimeout's
19 var lastTestResult = 0;
20 var testCounterLimit = 3;
21 var timerLimit = 3;
22 var testStarted = false;
23 var testAlreadyFailed = false;
24
25 worker.postMessage("TS");
26
27 worker.onmessage = function(evt) {
28 if(testStarted) {
29 var currentNum = evt.data;
30 if(lastTestResult == currentNum - 1 && !testAlreadyFailed) {
31 lastTestResult = currentNum;
32 --timerLimit;
33 // we got all the results in order
34 if(lastTestResult == testCounterLimit && timerLimit == 0)
35 log("PASS: Timeouts executed in order.");
36 }
37 else {
38 testAlreadyFailed = true;
39 --timerLimit;
40 if(timerLimit == 0)
41 log("FAIL: Timeouts executed out of order.");
42 }
43 }
44 if(evt.data == "Test started.") {
45 log(evt.data);
46 testStarted = true;
47 }
48 if (evt.data == "DONE") {
49 log("DONE.");
50 if (window.testRunner)
51 testRunner.notifyDone();
52 }
53 }
54 </script>
55 </body>
56 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698