4 <p>Test setTimeOut,fired in decreasing order in Web Workers.
</p>
5 <div id=
"result"></div>
6 <script type=
"text/javascript">
9 document
.getElementById("result").innerHTML
+= message
+ "</br>";
12 if (window
.testRunner
) {
13 testRunner
.dumpAsText();
14 testRunner
.waitUntilDone();
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;
22 var testStarted
= false;
23 var testAlreadyFailed
= false;
25 worker
.postMessage("TS");
27 worker
.onmessage = function(evt
) {
29 var currentNum
= evt
.data
;
30 if(lastTestResult
== currentNum
- 1 && !testAlreadyFailed
) {
31 lastTestResult
= currentNum
;
33 // we got all the results in order
34 if(lastTestResult
== testCounterLimit
&& timerLimit
== 0)
35 log("PASS: Timeouts executed in order.");
38 testAlreadyFailed
= true;
41 log("FAIL: Timeouts executed out of order.");
44 if(evt
.data
== "Test started.") {
48 if (evt
.data
== "DONE") {
50 if (window
.testRunner
)
51 testRunner
.notifyDone();