| OLD | NEW |
| 1 <html> | 1 <!DOCTYPE HTML> |
| 2 <body> | 2 <script src="/js-test-resources/js-test.js"></script> |
| 3 <p>Test EventSource retry time precision. Should print PASS followed by DONE.</p
> | 3 <script src="script-tests/eventsource-retry-precision.js"></script> |
| 4 <script> | |
| 5 function log(msg) { | |
| 6 document.body.innerHTML += msg + "<br>"; | |
| 7 } | |
| 8 | |
| 9 if (window.testRunner) { | |
| 10 testRunner.dumpAsText(); | |
| 11 testRunner.waitUntilDone(); | |
| 12 } | |
| 13 | |
| 14 var timeoutId = setTimeout(function () { | |
| 15 log("PASS: did not immediately reconnect"); | |
| 16 end(); | |
| 17 }, 500); | |
| 18 | |
| 19 var count = 0; | |
| 20 var es = new EventSource("resources/precise-retry.asis"); | |
| 21 es.onopen = function () { | |
| 22 if (count++ != 2) | |
| 23 return; | |
| 24 clearTimeout(timeoutId); | |
| 25 log("FAIL: reconnected too soon"); | |
| 26 end(); | |
| 27 }; | |
| 28 | |
| 29 function end() { | |
| 30 es.close(); | |
| 31 log("DONE"); | |
| 32 if (window.testRunner) | |
| 33 testRunner.notifyDone(); | |
| 34 } | |
| 35 </script> | |
| 36 </body> | |
| 37 </html> | |
| OLD | NEW |