tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_peerConnection_basicAudioNATSrflx.html (1962B)


      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 endpoint independent NAT, for verifying UDP srflx"
     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', 'ENDPOINT_INDEPENDENT'],
     25        ['media.peerconnection.nat_simulator.mapping_type', 'ENDPOINT_INDEPENDENT'],
     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 = "srflx";
     34    const test = new PeerConnectionTest(options);
     35    // Make sure we don't end up choosing the wrong thing due to delays in
     36    // trickle. Once we are willing to accept trickle after ICE success, we
     37    // can maybe wait a bit to allow things to stabilize.
     38    // TODO(bug 1238249)
     39    makeOffererNonTrickle(test.chain);
     40    makeAnswererNonTrickle(test.chain);
     41    test.setMediaConstraints([{audio: true}], [{audio: true}]);
     42    await test.run();
     43  }, { useIceServer: true });
     44 }
     45 </script>
     46 </pre>
     47 </body>
     48 </html>