test_selftest.html (776B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="pc.js"></script> 5 </head> 6 <body> 7 <pre id="test"> 8 <script type="application/javascript"> 9 createHTML({ 10 title: "Self-test of harness functions", 11 visible: true 12 }); 13 14 function TEST(test) {} 15 16 var catcher = func => { 17 try { 18 func(); 19 return null; 20 } catch (e) { 21 return e.message; 22 } 23 }; 24 25 runNetworkTest(() => { 26 var test = new PeerConnectionTest(); 27 test.setMediaConstraints([{video: true}], [{video: true}]); 28 is(catcher(() => test.chain.replace("PC_LOCAL_SET_LOCAL_DESCRIPTION", TEST)), 29 null, "test.chain.replace works"); 30 is(catcher(() => test.chain.replace("FOO", TEST)), 31 "Unknown test: FOO", "test.chain.replace catches typos"); 32 }); 33 34 </script> 35 </pre> 36 </body> 37 </html>