tor-browser

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

test_peerConnection_restartIceLocalAndRemoteRollbackNoSubsequentRestart.html (2359B)


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