Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / dom / Window / setTimeout-setInterval-unique.html
blob455b57662b6273d0d9cef145517db13cd27dd4eb
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
9 description("This checks that setTimeout() and setInterval() return unique results within their script execution context.");
11 function checkTimeoutIDs(tID1, tID2, tID3)
13 debug("Checking the results of setTimeout:");
14 shouldBeTrue("tID1 > 0");
15 shouldBeTrue("tID2 > 0");
16 shouldBeTrue("tID3 > 0");
17 shouldBeTrue("tID1 !== tID2");
18 shouldBeTrue("tID1 !== tID3");
19 shouldBeTrue("tID2 !== tID3");
20 clearTimeout(tID1);
21 clearTimeout(tID2);
22 clearTimeout(tID3);
23 debug("");
26 function checkIntervalIDs(iID1, iID2, iID3)
28 debug("Checking the results of setInterval:");
29 shouldBeTrue("iID1 > 0");
30 shouldBeTrue("iID2 > 0");
31 shouldBeTrue("iID3 > 0");
32 shouldBeTrue("iID1 !== iID2");
33 shouldBeTrue("iID1 !== iID3");
34 shouldBeTrue("iID2 !== iID3");
35 clearInterval(iID1);
36 clearInterval(iID2);
37 clearInterval(iID3);
38 debug("");
41 var tID1 = setTimeout('echo("timeout 1")', 0);
42 var tID2 = setTimeout('echo("timeout 2")', 0);
43 var iID1 = setInterval('echo("interval 1")', 0);
44 var iID2 = setInterval('echo("interval 2")', 0);
45 var tID3 = setTimeout('echo("timeout 3")', 0);
46 var iID3 = setInterval('echo("interval 3")', 0);
48 checkTimeoutIDs(tID1, tID2, tID3);
49 checkIntervalIDs(iID1, iID2, iID3);
51 </script>
52 </body>
53 </html>