Create-valid-url-array-protocols.any.js (720B)
1 // META: script=constants.sub.js 2 // META: variant=?default 3 // META: variant=?wpt_flags=h2 4 // META: variant=?wss 5 6 var test = async_test("Create WebSocket - Pass a valid URL and array of protocol strings - Connection should be closed"); 7 8 var wsocket = CreateWebSocket(false, true); 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);