004.html (772B)
1 <!doctype html> 2 <title>WebSockets: getting constants on prototype and object</title> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 5 <script src=../../../constants.sub.js></script> 6 <meta name="variant" content="?default"> 7 <meta name="variant" content="?wss"> 8 <div id=log></div> 9 <script> 10 var constants = ['CONNECTING', 'OPEN', 'CLOSING', 'CLOSED']; 11 for (var i = 0; i < constants.length; ++i) { 12 test(function() { 13 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/'); 14 assert_equals(WebSocket.prototype[constants[i]], i); 15 }, 'WebSocket.prototype.'+constants[i]); 16 test(function() { 17 var ws = new WebSocket(SCHEME_DOMAIN_PORT+'/'); 18 assert_equals(ws[constants[i]], i); 19 }, 'ws.'+constants[i]); 20 }; 21 </script>