| <html> | |
| <body> | |
| <p>Test EventSource constructor functionality. Should print a series of PASS messages followed by DONE.</p> | |
| <div id="result"></div> | |
| <script> | |
| function log(msg) { | |
| document.getElementById("result").innerHTML += msg + "<br>"; | |
| } | |
| if (window.testRunner) { | |
| testRunner.dumpAsText(); | |
| testRunner.waitUntilDone(); | |
| } | |
| try { | |
| new EventSource(); | |
| log("FAIL: no exception when trying to construct an EventSource without argument"); | |
| } | |
| catch (ex) { | |
| log("PASS: missing argument to EventSource constructor resulted in an exception (" + ex + ")"); | |
| } | |
| try { | |
| new EventSource(""); | |
| log("FAIL: no exception when passing an empty string to the EventSource constructor"); | |
| } | |
| catch (ex) { | |
| log("PASS: passing an empty string to the EventSource constructor resulted in an exception (" + ex + ")"); | |
| } | |
| try { | |
| new EventSource("http://webserver:eighty/"); | |
| log("FAIL: no exception when passing an invalid URL to the EventSource constructor"); | |
| } | |
| catch (ex) { | |
| log("PASS: passing an invalid URL to the EventSource constructor resulted in an exception (" + ex + ")"); | |
| log("DONE"); | |
| } | |
| if (window.testRunner) | |
| testRunner.notifyDone(); | |
| </script> | |
| </body> | |
| </html> |