002.html (776B)
1 <!doctype html> 2 <title>WebSockets: valid handshake</title> 3 <meta name=timeout content=long> 4 <script src=/resources/testharness.js></script> 5 <script src=/resources/testharnessreport.js></script> 6 <script src=../constants.sub.js></script> 7 <meta name="variant" content="?default"> 8 <meta name="variant" content="?wss"> 9 <meta name="variant" content="?wpt_flags=h2"> 10 <div id=log></div> 11 <script> 12 async_test(function(t) { 13 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/echo'); 14 ws.onopen = t.step_func(function(e) { 15 ws.onclose = t.step_func(function(e) { 16 assert_equals(e.wasClean, true); 17 ws.onclose = t.unreached_func(); 18 t.step_timeout(() => t.done(), 50); 19 }) 20 ws.close(); 21 }); 22 ws.onerror = ws.onmessage = ws.onclose = t.unreached_func(); 23 }); 24 </script>