| Philip Jägenstedt | c053f40 | 2014-01-22 17:02:18 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <title>W3C WebSocket API - Create Secure WebSocket with valid url and array of protocols</title> |
| 5 | <script type="text/javascript" src="/resources/testharness.js"></script> |
| 6 | <script type="text/javascript" src="/resources/testharnessreport.js"></script> |
| 7 | <script type="text/javascript" src="websocket.js?pipe=sub"></script> |
| 8 | </head> |
| 9 | <body> |
| 10 | <div id="log"></div> |
| 11 | <script type="text/javascript"> |
| 12 | |
| 13 | var testOpen = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be opened"); |
| 14 | var testClose = async_test("W3C WebSocket API - Create Secure WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed"); |
| 15 | |
| 16 | var wsocket = CreateWebSocket(true, false, true); |
| 17 | var isOpenCalled = false; |
| 18 | |
| 19 | wsocket.addEventListener('open', testOpen.step_func(function (evt) { |
| 20 | assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); |
| 21 | wsocket.close(); |
| 22 | isOpenCalled = true; |
| 23 | testOpen.done(); |
| 24 | }), true); |
| 25 | |
| 26 | wsocket.addEventListener('close', testClose.step_func(function (evt) { |
| 27 | assert_true(isOpenCalled, "WebSocket connection should be open"); |
| 28 | assert_equals(evt.wasClean, true, "wasClean should be true"); |
| 29 | testClose.done(); |
| 30 | }), true); |
| 31 | |
| 32 | </script> |
| 33 | </body> |
| 34 | </html> |