tor-browser

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

test_peerConnection_restartIceLocalAndRemoteRollback.html (2141B)


      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    bug: "906986",
     11    title: "Renegotiation: restart ice, local and remote rollback"
     12  });
     13 
     14  var test;
     15  runNetworkTest(function (options) {
     16    test = new PeerConnectionTest(options);
     17 
     18    addRenegotiation(test.chain,
     19      [
     20        async function PC_LOCAL_SETUP_ICE_HANDLER(test) {
     21          await test.pcLocal.endOfTrickleIce;
     22          test.pcLocal.setupIceCandidateHandler(test);
     23        },
     24 
     25        // causes a full, normal ice restart
     26        function PC_LOCAL_SET_OFFER_OPTION(test) {
     27          test.setOfferOptions({ iceRestart: true });
     28        }
     29      ]
     30    );
     31 
     32    test.chain.replaceAfter('PC_REMOTE_CREATE_ANSWER',
     33      [
     34        function PC_REMOTE_ROLLBACK(test) {
     35          return test.setRemoteDescription(test.pcRemote, { type: "rollback" },
     36                                           STABLE);
     37        },
     38 
     39        async function PC_LOCAL_ROLLBACK(test) {
     40          await test.pcLocal.endOfTrickleIce;
     41          // We haven't negotiated the new stream yet.
     42          test.pcLocal.expectNegotiationNeeded();
     43          return test.setLocalDescription(
     44              test.pcLocal,
     45              new RTCSessionDescription({ type: "rollback", sdp: ""}),
     46              STABLE);
     47        },
     48 
     49        // Rolling back should shut down gathering for the offerer,
     50        // but because the answerer never set a local description, no ICE
     51        // gathering has happened yet, so there's no changes to ICE gathering
     52        // state
     53        function PC_LOCAL_WAIT_FOR_END_OF_TRICKLE(test) {
     54          return test.pcLocal.endOfTrickleIce;
     55        },
     56 
     57      ],
     58      1 // Replaces after second PC_REMOTE_CREATE_ANSWER
     59    );
     60    test.chain.append(commandsPeerConnectionOfferAnswer);
     61 
     62    // for now, only use one stream, because rollback doesn't seem to
     63    // like multiple streams.  See bug 1259465.
     64    test.setMediaConstraints([{audio: true}],
     65                             [{audio: true}]);
     66    return test.run();
     67  });
     68 
     69 </script>
     70 </pre>
     71 </body>
     72 </html>