Changeset 90100 in webkit
- Timestamp:
- Jun 30, 2011 2:31:01 AM (13 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 32 deleted
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r90099 r90100 1 2011-06-30 Yuta Kitamura <yutak@chromium.org> 2 3 Reviewed by Kent Tamura. 4 5 WebSocket: Don't use script-tests for WebSocket tests 6 https://bugs.webkit.org/show_bug.cgi?id=63691 7 8 Move content of script-tests/XXX.js into XXX.html. 9 10 No changes were made to script code. Hence, these tests are not using 11 window.jsTestAsync and finishJSTest() for now. I will fix this later. 12 13 * http/tests/websocket/tests/alert-in-event-handler.html: 14 * http/tests/websocket/tests/bad-handshake-crash.html: 15 * http/tests/websocket/tests/bad-sub-protocol-control-chars.html: 16 * http/tests/websocket/tests/bad-sub-protocol-empty.html: 17 * http/tests/websocket/tests/bad-sub-protocol-non-ascii.html: 18 * http/tests/websocket/tests/bufferedAmount-after-close.html: 19 * http/tests/websocket/tests/cross-origin.html: 20 * http/tests/websocket/tests/error-detect.html: 21 * http/tests/websocket/tests/frame-length-longer-than-buffer.html: 22 * http/tests/websocket/tests/frame-length-skip.html: 23 * http/tests/websocket/tests/handshake-challenge-randomness.html: 24 * http/tests/websocket/tests/handshake-error.html: 25 * http/tests/websocket/tests/handshake-fail-by-cross-origin.html: 26 * http/tests/websocket/tests/handshake-fail-by-no-cr.html: 27 * http/tests/websocket/tests/handshake-fail-by-sub-protocol-mismatch.html: 28 * http/tests/websocket/tests/long-invalid-header.html: 29 * http/tests/websocket/tests/null-character.html: 30 * http/tests/websocket/tests/script-tests/TEMPLATE.html: Removed. 31 * http/tests/websocket/tests/script-tests/alert-in-event-handler.js: Removed. 32 * http/tests/websocket/tests/script-tests/bad-handshake-crash.js: Removed. 33 * http/tests/websocket/tests/script-tests/bad-sub-protocol-control-chars.js: Removed. 34 * http/tests/websocket/tests/script-tests/bad-sub-protocol-empty.js: Removed. 35 * http/tests/websocket/tests/script-tests/bad-sub-protocol-non-ascii.js: Removed. 36 * http/tests/websocket/tests/script-tests/bufferedAmount-after-close.js: Removed. 37 * http/tests/websocket/tests/script-tests/cross-origin.js: Removed. 38 * http/tests/websocket/tests/script-tests/error-detect.js: Removed. 39 * http/tests/websocket/tests/script-tests/frame-length-longer-than-buffer.js: Removed. 40 * http/tests/websocket/tests/script-tests/frame-length-skip.js: Removed. 41 * http/tests/websocket/tests/script-tests/handshake-challenge-randomness.js: Removed. 42 * http/tests/websocket/tests/script-tests/handshake-error.js: Removed. 43 * http/tests/websocket/tests/script-tests/handshake-fail-by-cross-origin.js: Removed. 44 * http/tests/websocket/tests/script-tests/handshake-fail-by-no-cr.js: Removed. 45 * http/tests/websocket/tests/script-tests/handshake-fail-by-sub-protocol-mismatch.js: Removed. 46 * http/tests/websocket/tests/script-tests/long-invalid-header.js: Removed. 47 * http/tests/websocket/tests/script-tests/null-character.js: Removed. 48 * http/tests/websocket/tests/script-tests/send-throw.js: Removed. 49 * http/tests/websocket/tests/script-tests/send.js: Removed. 50 * http/tests/websocket/tests/script-tests/simple.js: Removed. 51 * http/tests/websocket/tests/script-tests/sub-protocol-with-space.js: Removed. 52 * http/tests/websocket/tests/script-tests/sub-protocol.js: Removed. 53 * http/tests/websocket/tests/script-tests/unicode.js: Removed. 54 * http/tests/websocket/tests/script-tests/url-no-trailing-slash.js: Removed. 55 * http/tests/websocket/tests/script-tests/url-parsing.js: Removed. 56 * http/tests/websocket/tests/script-tests/url-with-credential.js: Removed. 57 * http/tests/websocket/tests/script-tests/url-with-empty-query.js: Removed. 58 * http/tests/websocket/tests/script-tests/url-with-query-for-no-query.js: Removed. 59 * http/tests/websocket/tests/script-tests/url-with-query.js: Removed. 60 * http/tests/websocket/tests/script-tests/websocket-event-target.js: Removed. 61 * http/tests/websocket/tests/script-tests/websocket-protocol-ignored.js: Removed. 62 * http/tests/websocket/tests/send-throw.html: 63 * http/tests/websocket/tests/send.html: 64 * http/tests/websocket/tests/simple.html: 65 * http/tests/websocket/tests/sub-protocol-with-space.html: 66 * http/tests/websocket/tests/sub-protocol.html: 67 * http/tests/websocket/tests/unicode.html: 68 * http/tests/websocket/tests/url-no-trailing-slash.html: 69 * http/tests/websocket/tests/url-parsing.html: 70 * http/tests/websocket/tests/url-with-credential.html: 71 * http/tests/websocket/tests/url-with-empty-query.html: 72 * http/tests/websocket/tests/url-with-query-for-no-query.html: 73 * http/tests/websocket/tests/url-with-query.html: 74 * http/tests/websocket/tests/websocket-event-target.html: 75 * http/tests/websocket/tests/websocket-protocol-ignored.html: 76 1 77 2011-06-30 Yuta Kitamura <yutak@chromium.org> 2 78 -
trunk/LayoutTests/http/tests/websocket/tests/alert-in-event-handler.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/alert-in-event-handler.js"></script> 11 <script type="text/javascript"> 12 description("Make sure event handler called serially."); 13 14 if (window.layoutTestController) { 15 layoutTestController.waitUntilDone(); 16 } 17 18 function endTest() 19 { 20 isSuccessfullyParsed(); 21 if (window.layoutTestController) { 22 layoutTestController.notifyDone(); 23 } 24 } 25 26 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/send2"); 27 28 ws.onopen = function() 29 { 30 debug("Connected"); 31 }; 32 33 ws.onmessage = function(messageEvent) 34 { 35 debug("Enter onmessage: " + messageEvent.data); 36 // alert() will suspend/resume WebSocket. 37 alert("message handled." + messageEvent.data); 38 debug("Leave onmessage: " + messageEvent.data); 39 }; 40 41 ws.onclose = function() 42 { 43 debug("Closed"); 44 endTest(); 45 }; 46 47 debug("alert will suspend/resume WebSocket."); 48 alert("waiting for open"); 49 debug("onopen should fire later."); 50 var successfullyParsed = true; 51 </script> 12 52 </body> 13 53 </html> -
trunk/LayoutTests/http/tests/websocket/tests/bad-handshake-crash.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/bad-handshake-crash.js"></script> 11 <script type="text/javascript"> 12 description("Make sure WebSocket doesn't crash with bad handshake message."); 13 if (window.layoutTestController) 14 layoutTestController.waitUntilDone(); 15 16 function finish() { 17 isSuccessfullyParsed(); 18 if (window.layoutTestController) 19 layoutTestController.notifyDone(); 20 } 21 22 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/bad-handshake-crash"); 23 ws.onopen = function () { 24 debug("WebSocket is open"); 25 }; 26 ws.onclose = function () { 27 debug("WebSocket is closed"); 28 finish(); 29 }; 30 31 var successfullyParsed = true; 32 </script> 12 33 </body> 13 34 </html> -
trunk/LayoutTests/http/tests/websocket/tests/bad-sub-protocol-control-chars.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/bad-sub-protocol-control-chars.js"></script> 11 <script type="text/javascript"> 12 description("Test WebSocket bad sub-protocol names by control characters."); 13 14 // Fails if protocol contains an character less than U+0020. 15 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0000")'); 16 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0009")'); 17 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u000A")'); 18 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u000D")'); 19 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u001B")'); 20 21 var successfullyParsed = true; 22 isSuccessfullyParsed(); 23 </script> 12 24 </body> 13 25 </html> -
trunk/LayoutTests/http/tests/websocket/tests/bad-sub-protocol-empty.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/bad-sub-protocol-empty.js"></script> 11 <script type="text/javascript"> 12 description("Test WebSocket bad sub-protocol names (empty)."); 13 14 // Fails if protocol is an empty string. 15 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "")'); 16 17 var successfullyParsed = true; 18 isSuccessfullyParsed(); 19 </script> 12 20 </body> 13 21 </html> -
trunk/LayoutTests/http/tests/websocket/tests/bad-sub-protocol-non-ascii.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/bad-sub-protocol-non-ascii.js"></script> 11 <script type="text/javascript"> 12 description("Test WebSocket bad sub-protocol names by non-ASCII chars."); 13 14 // Fails if protocol contains an character greater than U+007E. 15 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u007F")'); 16 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u0080")'); 17 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\u3042")'); 18 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFFFF")'); 19 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFEFF")'); 20 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uFFFE")'); 21 // Surrogate pairs 22 shouldThrow('new WebSocket("ws://127.0.0.1:8880/simple", "\uD840\uDC0B")'); 23 24 var successfullyParsed = true; 25 isSuccessfullyParsed(); 26 </script> 12 27 </body> 13 28 </html> -
trunk/LayoutTests/http/tests/websocket/tests/bufferedAmount-after-close.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/bufferedAmount-after-close.js"></script> 11 <script type="text/javascript"> 12 description("Web Socket bufferedAmount after closed"); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 function endTest() 18 { 19 isSuccessfullyParsed(); 20 if (window.layoutTestController) 21 layoutTestController.notifyDone(); 22 } 23 24 var ws = new WebSocket("ws://localhost:8880/websocket/tests/simple"); 25 26 ws.onopen = function() 27 { 28 debug("Connected."); 29 ws.close(); 30 }; 31 32 ws.onclose = function() 33 { 34 debug("Closed."); 35 shouldBe("ws.readyState", "3"); 36 shouldBe("ws.bufferedAmount", "0"); 37 shouldBeFalse("ws.send('send to closed socket')"); 38 // If the connection is closed, bufferedAmount attribute's value will only 39 // increase with each call to the send() method. 40 // (the number does not reset to zero once the connection closes). 41 shouldBe("ws.bufferedAmount", "23"); 42 endTest(); 43 }; 44 45 var successfullyParsed = true; 46 </script> 12 47 </body> 13 48 </html> -
trunk/LayoutTests/http/tests/websocket/tests/cross-origin.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/cross-origin.js"></script> 11 <script type="text/javascript"> 12 description("Web Socket Cross Origin test"); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var origin; 18 19 function endTest() 20 { 21 shouldBe("origin", '"http://127.0.0.1:8000"'); 22 clearTimeout(timeoutID); 23 isSuccessfullyParsed(); 24 if (window.layoutTestController) 25 layoutTestController.notifyDone(); 26 } 27 28 var url = "ws://localhost:8880/websocket/tests/origin-test"; 29 debug("document.domain=" + document.domain); 30 debug("ws.url=" + url); 31 var ws = new WebSocket(url); 32 33 ws.onopen = function() 34 { 35 debug("Connected"); 36 }; 37 38 ws.onmessage = function (messageEvent) 39 { 40 origin = messageEvent.data; 41 ws.close(); 42 }; 43 44 ws.onclose = function() 45 { 46 endTest(); 47 }; 48 49 function timeOutCallback() 50 { 51 debug("Timed out in state: " + ws.readyState); 52 endTest(); 53 } 54 55 var timeoutID = setTimeout(timeOutCallback, 3000); 56 57 var successfullyParsed = true; 58 </script> 12 59 </body> 13 60 </html> -
trunk/LayoutTests/http/tests/websocket/tests/error-detect.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/error-detect.js"></script> 11 <script type="text/javascript"> 12 description("Make sure WebSocket correctly fire error event for unknown frame type."); 13 if (window.layoutTestController) 14 layoutTestController.waitUntilDone(); 15 16 var errorCount = 0; 17 18 function finish() { 19 shouldBe("errorCount", "255"); 20 isSuccessfullyParsed(); 21 if (window.layoutTestController) 22 layoutTestController.notifyDone(); 23 } 24 25 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/unknown-frame-type"); 26 ws.onopen = function () { 27 debug("WebSocket is open"); 28 }; 29 ws.onmessage = function (evt) { 30 debug("received:" + evt.data); 31 }; 32 ws.onerror = function () { 33 errorCount += 1; 34 }; 35 ws.onclose = function () { 36 debug("WebSocket is closed"); 37 finish(); 38 }; 39 40 var successfullyParsed = true; 41 </script> 12 42 </body> 13 43 </html> -
trunk/LayoutTests/http/tests/websocket/tests/frame-length-longer-than-buffer.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/frame-length-longer-than-buffer.js"></script> 11 <script type="text/javascript"> 12 description("Make sure WebSocket correctly skip lengthed frame even if received data has incomplete frame."); 13 if (window.layoutTestController) 14 layoutTestController.waitUntilDone(); 15 16 var received_messages = []; 17 var expected_messages = ["hello"]; 18 function finish() { 19 clearTimeout(timeoutID); 20 debug(received_messages.length); 21 for (var i = 0; i < received_messages; i++) { 22 debug("received[" + i + "]=" + received_messages[i]); 23 } 24 25 shouldBeTrue("areArraysEqual(received_messages, expected_messages)"); 26 27 isSuccessfullyParsed(); 28 if (window.layoutTestController) 29 layoutTestController.notifyDone(); 30 } 31 32 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/frame-length-longer-than-buffer"); 33 ws.onopen = function () { 34 debug("WebSocket is open"); 35 }; 36 ws.onmessage = function (evt) { 37 debug("received:" + evt.data); 38 received_messages.push(evt.data); 39 }; 40 ws.onclose = function () { 41 debug("WebSocket is closed"); 42 finish(); 43 }; 44 var timeoutID = setTimeout("finish()", 2000); 45 46 var successfullyParsed = true; 47 </script> 12 48 </body> 13 49 </html> -
trunk/LayoutTests/http/tests/websocket/tests/frame-length-skip.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/frame-length-skip.js"></script> 11 <script type="text/javascript"> 12 description("Make sure WebSocket correctly skip lengthed frame."); 13 if (window.layoutTestController) 14 layoutTestController.waitUntilDone(); 15 16 var received_messages = []; 17 var expected_messages = ["hello", "world"]; 18 function finish() { 19 clearTimeout(timeoutID); 20 debug(received_messages.length); 21 for (var i = 0; i < received_messages; i++) { 22 debug("received[" + i + "]=" + received_messages[i]); 23 } 24 25 shouldBeTrue("areArraysEqual(received_messages, expected_messages)"); 26 27 isSuccessfullyParsed(); 28 if (window.layoutTestController) 29 layoutTestController.notifyDone(); 30 } 31 32 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/frame-length-skip"); 33 ws.onopen = function () { 34 debug("WebSocket is open"); 35 }; 36 ws.onmessage = function (evt) { 37 debug("received:" + evt.data); 38 received_messages.push(evt.data); 39 }; 40 ws.onclose = function () { 41 debug("WebSocket is closed"); 42 finish(); 43 }; 44 var timeoutID = setTimeout("finish()", 2000); 45 46 var successfullyParsed = true; 47 </script> 12 48 </body> 13 49 </html> -
trunk/LayoutTests/http/tests/websocket/tests/handshake-challenge-randomness.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/handshake-challenge-randomness.js"></script> 11 <script type="text/javascript"> 12 description('Handshake request should contain random challenge values.'); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var challenge1; 18 var challenge2; 19 20 function endTest() 21 { 22 shouldBeFalse('challenge1 === challenge2'); 23 if (challenge1 === challenge2) 24 debug('challenge was ' + challenge1); 25 26 isSuccessfullyParsed(); 27 if (window.layoutTestController) 28 layoutTestController.notifyDone(); 29 } 30 31 var url = 'ws://localhost:8880/websocket/tests/echo-challenge'; 32 var ws1 = new WebSocket(url); 33 34 ws1.onmessage = function(messageEvent) 35 { 36 challenge1 = messageEvent.data; 37 ws1.close(); 38 } 39 40 ws1.onclose = function() 41 { 42 var ws2 = new WebSocket(url); 43 44 ws2.onmessage = function(messageEvent) 45 { 46 challenge2 = messageEvent.data; 47 ws2.close(); 48 } 49 50 ws2.onclose = function() 51 { 52 endTest(); 53 } 54 } 55 56 var successfullyParsed = true; 57 </script> 12 58 </body> 13 59 </html> -
trunk/LayoutTests/http/tests/websocket/tests/handshake-error.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/handshake-error.js"></script> 11 <script type="text/javascript"> 12 description("Handshake error test"); 13 14 if (window.layoutTestController) { 15 layoutTestController.waitUntilDone(); 16 } 17 18 function endTest() 19 { 20 isSuccessfullyParsed(); 21 clearTimeout(timeoutID); 22 if (window.layoutTestController) { 23 layoutTestController.notifyDone(); 24 } 25 } 26 27 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/handshake-error"); 28 29 ws.onopen = function() 30 { 31 testFailed("Unexpectedly Connected."); 32 }; 33 34 ws.onmessage = function(messageEvent) 35 { 36 testFailed("Unexpectedly Received: '" + messageEvent.data + "'"); 37 }; 38 39 ws.onclose = function() 40 { 41 debug("Closed."); 42 shouldBe("ws.readyState", "3") 43 endTest(); 44 }; 45 46 function timeOutCallback() 47 { 48 testFailed("Timed out in state: " + ws.readyState); 49 endTest(); 50 } 51 52 var timeoutID = setTimeout(timeOutCallback, 3000); 53 54 var successfullyParsed = true; 55 </script> 12 56 </body> 13 57 </html> -
trunk/LayoutTests/http/tests/websocket/tests/handshake-fail-by-cross-origin.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/handshake-fail-by-cross-origin.js"></script> 11 <script type="text/javascript"> 12 description("Make sure Web Socket connection failed if origin mismatches."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var connected = false; 18 var origin; 19 20 function endTest() 21 { 22 shouldBeFalse("connected"); 23 shouldBeUndefined("origin"); 24 clearTimeout(timeoutID); 25 isSuccessfullyParsed(); 26 if (window.layoutTestController) 27 layoutTestController.notifyDone(); 28 } 29 30 var url = "ws://localhost:8880/websocket/tests/fixed-origin"; 31 debug("document.domain=" + document.domain); 32 debug("ws.url=" + url); 33 var ws = new WebSocket(url); 34 35 ws.onopen = function() 36 { 37 debug("Connected"); 38 connected = true; 39 }; 40 41 ws.onmessage = function (messageEvent) 42 { 43 origin = messageEvent.data; 44 debug("origin=" + origin); 45 ws.close(); 46 }; 47 48 ws.onclose = function() 49 { 50 endTest(); 51 }; 52 53 function timeOutCallback() 54 { 55 debug("Timed out in state: " + ws.readyState); 56 endTest(); 57 } 58 59 var timeoutID = setTimeout(timeOutCallback, 3000); 60 61 var successfullyParsed = true; 62 </script> 12 63 </body> 13 64 </html> -
trunk/LayoutTests/http/tests/websocket/tests/handshake-fail-by-no-cr.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/handshake-fail-by-no-cr.js"></script> 11 <script type="text/javascript"> 12 description('Handshake should fail when the first line does not end with CRLF.'); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone() 16 17 var connected = false; 18 var origin; 19 20 function endTest() { 21 shouldBeFalse('connected'); 22 shouldBeUndefined('origin'); 23 clearTimeout(timeoutID); 24 isSuccessfullyParsed(); 25 if (window.layoutTestController) 26 layoutTestController.notifyDone(); 27 } 28 29 var url = 'ws://localhost:8880/websocket/tests/handshake-fail-by-no-cr'; 30 var ws = new WebSocket(url); 31 32 ws.onopen = function() 33 { 34 debug('Connected'); 35 connected = true; 36 } 37 38 ws.onmessage = function(messageEvent) 39 { 40 origin = messageEvent.data; 41 debug('origin = ' + origin); 42 ws.close(); 43 } 44 45 ws.onclose = function() 46 { 47 endTest(); 48 } 49 50 function timeoutCallback() 51 { 52 debug('Timed out (state = ' + ws.readyState + ')'); 53 endTest(); 54 } 55 56 var timeoutID = setTimeout(timeoutCallback, 3000); 57 58 var successfullyParsed = true; 59 </script> 12 60 </body> 13 61 </html> -
trunk/LayoutTests/http/tests/websocket/tests/handshake-fail-by-sub-protocol-mismatch.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/handshake-fail-by-sub-protocol-mismatch.js"></script> 11 <script type="text/javascript"> 12 description("Test WebSocket handshake fail if sub protocol name mismatches."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var protocol; 18 19 function endTest() 20 { 21 shouldBeUndefined("protocol"); 22 clearTimeout(timeoutID); 23 isSuccessfullyParsed(); 24 if (window.layoutTestController) 25 layoutTestController.notifyDone(); 26 } 27 28 var url = "ws://localhost:8880/websocket/tests/protocol-test?protocol=available-protocol"; 29 var ws = new WebSocket(url, "requestting-protocol"); 30 31 ws.onopen = function() 32 { 33 debug("Connected"); 34 }; 35 36 ws.onmessage = function (messageEvent) 37 { 38 protocol = messageEvent.data; 39 ws.close(); 40 }; 41 42 ws.onclose = function() 43 { 44 endTest(); 45 }; 46 47 function timeOutCallback() 48 { 49 debug("Timed out in state: " + ws.readyState); 50 endTest(); 51 } 52 53 var timeoutID = setTimeout(timeOutCallback, 3000); 54 55 var successfullyParsed = true; 56 </script> 12 57 </body> 13 58 </html> -
trunk/LayoutTests/http/tests/websocket/tests/long-invalid-header.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/long-invalid-header.js"></script> 11 <script type="text/javascript"> 12 description("Make sure WebSocket gives errors on long invalid upgrade header."); 13 if (window.layoutTestController) 14 layoutTestController.waitUntilDone(); 15 16 function finish() { 17 clearTimeout(timeoutID); 18 19 isSuccessfullyParsed(); 20 if (window.layoutTestController) 21 layoutTestController.notifyDone(); 22 } 23 24 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/long-invalid-header"); 25 ws.onopen = function () { 26 debug("WebSocket is open"); 27 }; 28 ws.onclose = function () { 29 debug("WebSocket is closed"); 30 finish(); 31 }; 32 var timeoutID = setTimeout("finish()", 2000); 33 34 var successfullyParsed = true; 35 </script> 12 36 </body> 13 37 </html> -
trunk/LayoutTests/http/tests/websocket/tests/null-character.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/null-character.js"></script> 11 <script type="text/javascript"> 12 description("Make sure WebSocket transfer null character"); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 function finish() 18 { 19 isSuccessfullyParsed(); 20 if (window.layoutTestController) 21 layoutTestController.notifyDone(); 22 } 23 24 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/echo"); 25 // \xff in string would be \xc3\xbf on websocket connection (UTF-8) 26 var expectedMessage = "Should Not\xff\0Split"; 27 28 ws.onopen = function() 29 { 30 debug("WebSocket open"); 31 ws.send(expectedMessage); 32 }; 33 34 var msg; 35 ws.onmessage = function(messageEvent) 36 { 37 msg = messageEvent.data; 38 debug("msg should not be split by frame char \\xff\\0"); 39 shouldBe("msg", "expectedMessage"); 40 ws.close(); 41 }; 42 43 ws.onclose = function() 44 { 45 debug("WebSocket closed"); 46 finish(); 47 }; 48 49 var successfullyParsed = true; 50 </script> 12 51 </body> 13 52 </html> -
trunk/LayoutTests/http/tests/websocket/tests/send-throw.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/send-throw.js"></script> 11 <script type="text/javascript"> 12 description("Web Socket send test"); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 function endTest() 18 { 19 isSuccessfullyParsed(); 20 clearTimeout(timeoutID); 21 if (window.layoutTestController) 22 layoutTestController.notifyDone(); 23 } 24 25 var ws = new WebSocket("ws://localhost:8880/websocket/tests/send"); 26 27 var FIRST_MESSAGE_TO_SEND = { 28 toString: function() { throw "Pickles"; } 29 }; 30 // data needs to be global to be accessbile from shouldBe(). 31 var data = ""; 32 33 ws.onopen = function() 34 { 35 debug("Connected."); 36 try { 37 ws.send(FIRST_MESSAGE_TO_SEND); 38 } catch (ex) { 39 debug("Caught exception: " + ex); 40 } 41 ws.close(); 42 }; 43 44 ws.onclose = function() 45 { 46 debug("Closed."); 47 endTest(); 48 }; 49 50 function timeOutCallback() 51 { 52 testFailed("Timed out in state: " + ws.readyState); 53 endTest(); 54 } 55 56 var timeoutID = setTimeout(timeOutCallback, 3000); 57 58 var successfullyParsed = true; 59 </script> 12 60 </body> 13 61 </html> -
trunk/LayoutTests/http/tests/websocket/tests/send.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/send.js"></script> 11 <script type="text/javascript"> 12 description("Web Socket send test"); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 function endTest() 18 { 19 isSuccessfullyParsed(); 20 clearTimeout(timeoutID); 21 if (window.layoutTestController) 22 layoutTestController.notifyDone(); 23 } 24 25 var ws = new WebSocket("ws://localhost:8880/websocket/tests/send"); 26 27 var FIRST_MESSAGE_TO_SEND = "This is the first message to send to the server."; 28 var SECOND_MESSAGE_TO_SEND = "This is the second."; 29 // data needs to be global to be accessbile from shouldBe(). 30 var data = ""; 31 32 ws.onopen = function() 33 { 34 debug("Connected."); 35 ws.send(FIRST_MESSAGE_TO_SEND); 36 }; 37 38 ws.onmessage = function(messageEvent) 39 { 40 // The server should echo back the first message. 41 data = messageEvent.data; 42 shouldBe("data", "FIRST_MESSAGE_TO_SEND"); 43 ws.onmessage = function(messageEvent) { 44 // The server should echo back the second message. 45 data = messageEvent.data; 46 shouldBe("data", "SECOND_MESSAGE_TO_SEND"); 47 }; 48 ws.send(SECOND_MESSAGE_TO_SEND); 49 }; 50 51 ws.onclose = function() 52 { 53 debug("Closed."); 54 endTest(); 55 }; 56 57 function timeOutCallback() 58 { 59 testFailed("Timed out in state: " + ws.readyState); 60 endTest(); 61 } 62 63 var timeoutID = setTimeout(timeOutCallback, 3000); 64 65 var successfullyParsed = true; 66 </script> 12 67 </body> 13 68 </html> -
trunk/LayoutTests/http/tests/websocket/tests/simple.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/simple.js"></script> 11 <script type="text/javascript"> 12 description("Simple Web Socket test"); 13 14 if (window.layoutTestController) { 15 layoutTestController.waitUntilDone(); 16 } 17 18 function endTest() 19 { 20 isSuccessfullyParsed(); 21 clearTimeout(timeoutID); 22 if (window.layoutTestController) { 23 layoutTestController.notifyDone(); 24 } 25 } 26 27 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple"); 28 debug("Created a socket to '" + ws.URL + "'; readyState " + ws.readyState + "."); 29 30 ws.onopen = function() 31 { 32 debug("Connected; readyState " + ws.readyState); 33 }; 34 35 ws.onmessage = function(messageEvent) 36 { 37 debug("Received: '" + messageEvent.data + "'; readyState " + ws.readyState); 38 }; 39 40 ws.onclose = function() 41 { 42 debug("Closed; readyState " + ws.readyState + "."); 43 endTest(); 44 }; 45 46 function timeOutCallback() 47 { 48 debug("Timed out in state: " + ws.readyState); 49 endTest(); 50 } 51 52 var timeoutID = setTimeout(timeOutCallback, 3000); 53 54 var successfullyParsed = true; 55 </script> 12 56 </body> 13 57 </html> -
trunk/LayoutTests/http/tests/websocket/tests/sub-protocol-with-space.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/sub-protocol-with-space.js"></script> 11 <script type="text/javascript"> 12 description("Test WebSocket handshake success with sub protocol contains space."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var protocol; 18 19 function endTest() 20 { 21 shouldBe("protocol", '"sub protocol"'); 22 clearTimeout(timeoutID); 23 isSuccessfullyParsed(); 24 if (window.layoutTestController) 25 layoutTestController.notifyDone(); 26 } 27 28 var url = "ws://localhost:8880/websocket/tests/protocol-test?protocol=sub%20protocol"; 29 var ws = new WebSocket(url, "sub protocol"); 30 31 ws.onopen = function() 32 { 33 debug("Connected"); 34 }; 35 36 ws.onmessage = function (messageEvent) 37 { 38 protocol = messageEvent.data; 39 ws.close(); 40 }; 41 42 ws.onclose = function() 43 { 44 endTest(); 45 }; 46 47 function timeOutCallback() 48 { 49 debug("Timed out in state: " + ws.readyState); 50 endTest(); 51 } 52 53 var timeoutID = setTimeout(timeOutCallback, 3000); 54 55 var successfullyParsed = true; 56 </script> 12 57 </body> 13 58 </html> -
trunk/LayoutTests/http/tests/websocket/tests/sub-protocol.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/sub-protocol.js"></script> 11 <script type="text/javascript"> 12 description("Test WebSocket handshake success with sub protocol."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var protocol; 18 19 function endTest() 20 { 21 shouldBe("protocol", '"sub-protocol"'); 22 clearTimeout(timeoutID); 23 isSuccessfullyParsed(); 24 if (window.layoutTestController) 25 layoutTestController.notifyDone(); 26 } 27 28 var url = "ws://localhost:8880/websocket/tests/protocol-test?protocol=sub-protocol"; 29 var ws = new WebSocket(url, "sub-protocol"); 30 31 ws.onopen = function() 32 { 33 debug("Connected"); 34 }; 35 36 ws.onmessage = function (messageEvent) 37 { 38 protocol = messageEvent.data; 39 ws.close(); 40 }; 41 42 ws.onclose = function() 43 { 44 endTest(); 45 }; 46 47 function timeOutCallback() 48 { 49 debug("Timed out in state: " + ws.readyState); 50 endTest(); 51 } 52 53 var timeoutID = setTimeout(timeOutCallback, 3000); 54 55 var successfullyParsed = true; 56 </script> 12 57 </body> 13 58 </html> -
trunk/LayoutTests/http/tests/websocket/tests/unicode.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/unicode.js"></script> 11 <script type="text/javascript"> 12 description("Web Socket unicode message test"); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 function endTest() 18 { 19 isSuccessfullyParsed(); 20 clearTimeout(timeoutID); 21 if (window.layoutTestController) 22 layoutTestController.notifyDone(); 23 } 24 25 var ws = new WebSocket("ws://localhost:8880/websocket/tests/unicode"); 26 27 // Hello in Japanese 28 var UNICODE_HELLO = "\u3053\u3093\u306b\u3061\u306f"; 29 // Goodbye in Japanese 30 var UNICODE_GOODBYE = "\u3055\u3088\u3046\u306a\u3089"; 31 32 // data needs to be global to be accessbile from shouldBe(). 33 var data = ""; 34 35 ws.onopen = function() 36 { 37 debug("Connected."); 38 debug("Send UNICODE_HELLO."); 39 ws.send(UNICODE_HELLO); 40 }; 41 42 ws.onmessage = function(messageEvent) 43 { 44 // The server should send back Goodbye if it receives Hello. 45 data = messageEvent.data; 46 shouldBe("data", "UNICODE_GOODBYE"); 47 }; 48 49 ws.onclose = function() 50 { 51 debug("Closed."); 52 endTest(); 53 }; 54 55 function timeOutCallback() 56 { 57 testFailed("Timed out in state: " + ws.readyState); 58 endTest(); 59 } 60 61 var timeoutID = setTimeout(timeOutCallback, 3000); 62 63 var successfullyParsed = true; 64 </script> 12 65 </body> 13 66 </html> -
trunk/LayoutTests/http/tests/websocket/tests/url-no-trailing-slash.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/url-no-trailing-slash.js"></script> 11 <script type="text/javascript"> 12 description("URL that doesn't have trailing slash should not emit empty Request-URI."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var url = "ws://127.0.0.1:8880"; 18 var handshake_success = false; 19 var ws_location; 20 21 function endTest() 22 { 23 shouldBeTrue("handshake_success"); 24 shouldBe("ws_location", '"ws://127.0.0.1:8880/"'); 25 isSuccessfullyParsed(); 26 if (window.layoutTestController) 27 layoutTestController.notifyDone(); 28 } 29 30 31 var ws = new WebSocket(url); 32 ws.onopen = function () { 33 debug("WebSocket is open"); 34 handshake_success = true; 35 }; 36 ws.onmessage = function (evt) { 37 ws_location = evt.data; 38 debug("received:" + ws_location); 39 ws.close(); 40 }; 41 ws.onclose = function () { 42 debug("WebSocket is closed"); 43 endTest(); 44 }; 45 46 var successfullyParsed = true; 47 </script> 12 48 </body> 13 49 </html> -
trunk/LayoutTests/http/tests/websocket/tests/url-parsing.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/url-parsing.js"></script> 11 <script type="text/javascript"> 12 description("Test WebSocket URL parsing."); 13 14 // Invalid url will fail to be parsed. 15 shouldThrow('new WebSocket("ws://javascript:a")'); 16 17 // Can't use relative URLs - because spec says so, and because the scheme is different anyway. 18 shouldThrow('new WebSocket("/applet")'); 19 20 // Non ws URL is not allowed. 21 shouldThrow('new WebSocket("javascript:a")'); 22 23 // UA is allowed to block access to some ports, which we do. 24 shouldThrow('new WebSocket("ws://127.0.0.1:25/")'); 25 26 // Resolve the url string using the resolve a Web address algorithm. 27 // Use 127.0.0.1:8880 and existing ws handler to make sure we don't receive unexpected response (so no console message appears) 28 shouldBe('(new WebSocket("ws://127.0.0.1:8880/a/../websocket/tests/simple")).URL', '"ws://127.0.0.1:8880/websocket/tests/simple"'); 29 shouldBe('(new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple?")).URL', '"ws://127.0.0.1:8880/websocket/tests/simple?"'); 30 shouldBe('(new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple?k=v")).URL', '"ws://127.0.0.1:8880/websocket/tests/simple?k=v"'); 31 32 // draft-hixie-thewebsocketprotocol-60 says If /url/ has a <fragment> 33 // component, then fail the parsing Web Socket URLs, so throw a SYNTAX_ERR 34 // exception. 35 shouldThrow('new WebSocket("ws://127.0.0.1/path#")'); 36 shouldThrow('new WebSocket("ws://127.0.0.1/path#fragment")'); 37 38 var successfullyParsed = true; 39 isSuccessfullyParsed(); 40 </script> 12 41 </body> 13 42 </html> -
trunk/LayoutTests/http/tests/websocket/tests/url-with-credential.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/url-with-credential.js"></script> 11 <script type="text/javascript"> 12 description("Make sure handshake with URL with credentail info success."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var url = "ws://user:pass@127.0.0.1:8880/websocket/tests/echo-location"; 18 var handshake_success = false; 19 var ws_location; 20 21 function endTest() 22 { 23 clearTimeout(timeoutID); 24 shouldBeTrue("handshake_success"); 25 shouldBe("ws_location", '"ws://127.0.0.1:8880/websocket/tests/echo-location"'); 26 isSuccessfullyParsed(); 27 if (window.layoutTestController) 28 layoutTestController.notifyDone(); 29 } 30 31 debug("url=" + url); 32 var ws = new WebSocket(url); 33 ws.onopen = function () { 34 debug("WebSocket is open"); 35 handshake_success = true; 36 }; 37 ws.onmessage = function (evt) { 38 ws_location = evt.data; 39 debug("received:" + ws_location); 40 ws.close(); 41 }; 42 ws.onclose = function () { 43 debug("WebSocket is closed"); 44 endTest(); 45 }; 46 var timeoutID = setTimeout("endTest()", 2000); 47 48 var successfullyParsed = true; 49 </script> 12 50 </body> 13 51 </html> -
trunk/LayoutTests/http/tests/websocket/tests/url-with-empty-query.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/url-with-empty-query.js"></script> 11 <script type="text/javascript"> 12 description("Make sure handshake with URL with empty query components success."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var url = "ws://127.0.0.1:8880/websocket/tests/echo-location?"; 18 var handshake_success = false; 19 var ws_location; 20 21 function endTest() 22 { 23 clearTimeout(timeoutID); 24 shouldBeTrue("handshake_success"); 25 shouldBe("ws_location", "url"); 26 isSuccessfullyParsed(); 27 if (window.layoutTestController) 28 layoutTestController.notifyDone(); 29 } 30 31 debug("url=" + url); 32 var ws = new WebSocket(url); 33 ws.onopen = function () { 34 debug("WebSocket is open"); 35 handshake_success = true; 36 }; 37 ws.onmessage = function (evt) { 38 ws_location = evt.data; 39 debug("received:" + ws_location); 40 ws.close(); 41 }; 42 ws.onclose = function () { 43 debug("WebSocket is closed"); 44 endTest(); 45 }; 46 var timeoutID = setTimeout("endTest()", 2000); 47 48 var successfullyParsed = true; 49 </script> 12 50 </body> 13 51 </html> -
trunk/LayoutTests/http/tests/websocket/tests/url-with-query-for-no-query.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/url-with-query-for-no-query.js"></script> 11 <script type="text/javascript"> 12 description("Make sure handshake with URL with query components fails against server that doesn't support query component."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var url = "ws://127.0.0.1:8880/websocket/tests/no-query?"; 18 var handshake_success = false; 19 var ws_location; 20 21 function endTest() 22 { 23 clearTimeout(timeoutID); 24 shouldBeFalse("handshake_success"); 25 shouldBeUndefined("ws_location"); 26 isSuccessfullyParsed(); 27 if (window.layoutTestController) 28 layoutTestController.notifyDone(); 29 } 30 31 debug("url=" + url); 32 var ws = new WebSocket(url); 33 ws.onopen = function () { 34 debug("WebSocket is open"); 35 handshake_success = true; 36 }; 37 ws.onmessge = function (evt) { 38 ws_location = evt.data; 39 debug("received:" + ws_location); 40 ws.close(); 41 }; 42 ws.onclose = function () { 43 debug("WebSocket is closed"); 44 endTest(); 45 }; 46 var timeoutID = setTimeout("endTest()", 2000); 47 48 var successfullyParsed = true; 49 </script> 12 50 </body> 13 51 </html> -
trunk/LayoutTests/http/tests/websocket/tests/url-with-query.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/url-with-query.js"></script> 11 <script type="text/javascript"> 12 description("Make sure handshake with URL with query components success."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var url = "ws://127.0.0.1:8880/websocket/tests/echo-location?q=v"; 18 var handshake_success = false; 19 var ws_location; 20 21 function endTest() 22 { 23 clearTimeout(timeoutID); 24 shouldBeTrue("handshake_success"); 25 shouldBe("ws_location", "url"); 26 isSuccessfullyParsed(); 27 if (window.layoutTestController) 28 layoutTestController.notifyDone(); 29 } 30 31 debug("url=" + url); 32 var ws = new WebSocket(url); 33 ws.onopen = function () { 34 debug("WebSocket is open"); 35 handshake_success = true; 36 }; 37 ws.onmessage = function (evt) { 38 ws_location = evt.data; 39 debug("received:" + ws_location); 40 ws.close(); 41 }; 42 ws.onclose = function () { 43 debug("WebSocket is closed"); 44 endTest(); 45 }; 46 var timeoutID = setTimeout("endTest()", 2000); 47 48 var successfullyParsed = true; 49 </script> 12 50 </body> 13 51 </html> -
trunk/LayoutTests/http/tests/websocket/tests/websocket-event-target.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/websocket-event-target.js"></script> 11 <script type="text/javascript"> 12 description("Make sure WebSocket object acts as EventTarget."); 13 14 var ws = new WebSocket("ws://127.0.0.1:8880/websocket/tests/simple"); 15 ws.close(); // That is not a test with a WebSocket server, prevent logging an error to console. 16 var open_event_handled = false; 17 var message_event_handled = false; 18 var close_event_handled = false; 19 function openListener() { 20 open_event_handled = true; 21 }; 22 function messageListener() { 23 message_event_handled = true; 24 }; 25 function closeListener() { 26 close_event_handled = true; 27 } 28 ws.addEventListener('open', openListener, false); 29 ws.addEventListener('message', messageListener, false); 30 ws.addEventListener('close', closeListener, false); 31 32 shouldBe("open_event_handled", "false"); 33 shouldBe("message_event_handled", "false"); 34 shouldBe("close_event_handled", "false"); 35 36 var evt = document.createEvent("Events"); 37 evt.initEvent("open", true, false); 38 ws.dispatchEvent(evt); 39 shouldBe("open_event_handled", "true"); 40 41 open_event_handled = false; 42 ws.removeEventListener('open', openListener); 43 ws.dispatchEvent(evt); 44 shouldBe("open_event_handled", "false"); 45 46 evt = document.createEvent("MessageEvent"); 47 evt.initEvent("message", true, false); 48 ws.dispatchEvent(evt); 49 shouldBe("message_event_handled", "true"); 50 51 message_event_handled = false; 52 ws.removeEventListener('message', messageListener); 53 ws.dispatchEvent(evt); 54 shouldBe("message_event_handled", "false"); 55 56 evt = document.createEvent("Events"); 57 evt.initEvent("close", true, false); 58 ws.dispatchEvent(evt); 59 shouldBe("close_event_handled", "true"); 60 61 close_event_handled = false; 62 ws.removeEventListener('close', closeListener); 63 ws.dispatchEvent(evt); 64 shouldBe("close_event_handled", "false"); 65 66 var successfullyParsed = true; 67 isSuccessfullyParsed(); 68 </script> 12 69 </body> 13 70 </html> -
trunk/LayoutTests/http/tests/websocket/tests/websocket-protocol-ignored.html
r68914 r90100 9 9 <div id="description"></div> 10 10 <div id="console"></div> 11 <script src="script-tests/websocket-protocol-ignored.js"></script> 11 <script type="text/javascript"> 12 description("Test WebSocket handshake success without protocol and ignore WebSocket-Protocol from server."); 13 14 if (window.layoutTestController) 15 layoutTestController.waitUntilDone(); 16 17 var protocol; 18 19 function endTest() 20 { 21 shouldBe("protocol", '"sub-protocol"'); 22 clearTimeout(timeoutID); 23 isSuccessfullyParsed(); 24 if (window.layoutTestController) 25 layoutTestController.notifyDone(); 26 } 27 28 var url = "ws://localhost:8880/websocket/tests/protocol-test?protocol=sub-protocol"; 29 var ws = new WebSocket(url); 30 31 ws.onopen = function() 32 { 33 debug("Connected"); 34 }; 35 36 ws.onmessage = function (messageEvent) 37 { 38 protocol = messageEvent.data; 39 ws.close(); 40 }; 41 42 ws.onclose = function() 43 { 44 endTest(); 45 }; 46 47 function timeOutCallback() 48 { 49 debug("Timed out in state: " + ws.readyState); 50 endTest(); 51 } 52 53 var timeoutID = setTimeout(timeOutCallback, 3000); 54 55 var successfullyParsed = true; 56 </script> 12 57 </body> 13 58 </html>
Note: See TracChangeset
for help on using the changeset viewer.