Create-valid-url-protocol-string.any.js (710B)
1 // META: script=constants.sub.js 2 // META: variant=?default 3 // META: variant=?wss 4 // META: variant=?wpt_flags=h2 5 6 var test = async_test("Create WebSocket - Pass a valid URL and protocol string - Connection should be closed"); 7 8 var wsocket = CreateWebSocket(true, false); 9 var isOpenCalled = false; 10 11 wsocket.addEventListener('open', test.step_func(function(evt) { 12 assert_equals(wsocket.readyState, 1, "readyState should be 1(OPEN)"); 13 wsocket.close(); 14 isOpenCalled = true; 15 }), true); 16 17 wsocket.addEventListener('close', test.step_func(function(evt) { 18 assert_true(isOpenCalled, "WebSocket connection should be open"); 19 assert_equals(evt.wasClean, true, "wasClean should be true"); 20 test.done(); 21 }), true);