| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | |
| 2 <html> | |
| 3 <head> | |
| 4 <script src="/js-test-resources/js-test.js"></script> | |
| 5 </head> | |
| 6 <body> | |
| 7 <div id="description"></div> | |
| 8 <div id="console"></div> | |
| 9 <script type="text/javascript"> | |
| 10 description("WebSocket send test"); | |
| 11 | |
| 12 window.jsTestIsAsync = true; | |
| 13 | |
| 14 function endTest() | |
| 15 { | |
| 16 clearTimeout(timeoutID); | |
| 17 finishJSTest(); | |
| 18 } | |
| 19 | |
| 20 var ws = new WebSocket("ws://localhost:8880/send"); | |
| 21 | |
| 22 var FIRST_MESSAGE_TO_SEND = { | |
| 23 toString: function() { throw "Pickles"; } | |
| 24 }; | |
| 25 // data needs to be global to be accessbile from shouldBe(). | |
| 26 var data = ""; | |
| 27 | |
| 28 ws.onopen = function() | |
| 29 { | |
| 30 debug("Connected."); | |
| 31 try { | |
| 32 ws.send(FIRST_MESSAGE_TO_SEND); | |
| 33 } catch (ex) { | |
| 34 debug("Caught exception: " + ex); | |
| 35 } | |
| 36 ws.close(); | |
| 37 }; | |
| 38 | |
| 39 ws.onclose = function() | |
| 40 { | |
| 41 debug("Closed."); | |
| 42 endTest(); | |
| 43 }; | |
| 44 | |
| 45 function timeOutCallback() | |
| 46 { | |
| 47 testFailed("Timed out in state: " + ws.readyState); | |
| 48 endTest(); | |
| 49 } | |
| 50 | |
| 51 var timeoutID = setTimeout(timeOutCallback, 3000); | |
| 52 | |
| 53 </script> | |
| 54 </body> | |
| 55 </html> | |
| OLD | NEW |