test_peerConnection_basicAudioNATRelay.html (2070B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="nonTrickleIce.js"></script> 5 <script type="application/javascript" src="pc.js"></script> 6 </head> 7 <body> 8 <pre id="test"> 9 <script type="application/javascript"> 10 createHTML({ 11 bug: "1231975", 12 title: "Basic audio-only peer connection with port dependent NAT, for verifying UDP relay" 13 }); 14 15 // This test uses the NAT simulator, which doesn't work in https, so we turn 16 // on getUserMedia in http, which requires a reload. 17 if (!("mediaDevices" in navigator)) { 18 SpecialPowers.pushPrefEnv({set: [['media.devices.insecure.enabled', true]]}, 19 () => location.reload()); 20 } else { 21 runNetworkTest(async (options = {}) => { 22 await pushPrefs( 23 ['media.peerconnection.ice.obfuscate_host_addresses', false], 24 ['media.peerconnection.nat_simulator.filtering_type', 'PORT_DEPENDENT'], 25 ['media.peerconnection.nat_simulator.mapping_type', 'PORT_DEPENDENT'], 26 ['media.peerconnection.nat_simulator.block_tcp', true], 27 ['media.peerconnection.nat_simulator.block_tls', true], 28 ['media.peerconnection.ice.loopback', true], 29 // The above triggers warning about 5 ICE servers 30 ['media.peerconnection.treat_warnings_as_errors', false], 31 ['media.getusermedia.insecure.enabled', true]); 32 options.expectedLocalCandidateType = "srflx"; 33 options.expectedRemoteCandidateType = "relay"; 34 // If both have TURN, it is a toss-up which one will end up using a 35 // relay. 36 options.turn_disabled_local = true; 37 const test = new PeerConnectionTest(options); 38 // Make sure we don't end up choosing the wrong thing due to delays in 39 // trickle. Once we are willing to accept trickle after ICE success, we 40 // can maybe wait a bit to allow things to stabilize. 41 // TODO(bug 1238249) 42 makeOffererNonTrickle(test.chain); 43 makeAnswererNonTrickle(test.chain); 44 test.setMediaConstraints([{audio: true}], [{audio: true}]); 45 await test.run(); 46 }, { useIceServer: true }); 47 } 48 </script> 49 </pre> 50 </body> 51 </html>