tor-browser

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

test_peerConnection_syncSetDescription.html (1955B)


      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: "1063971",
     11    title: "Legacy sync setDescription calls",
     12    visible: true
     13  });
     14 
     15 // Test setDescription without callbacks, which many webrtc examples still do
     16 
     17 function PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC(test) {
     18  test.pcLocal.onsignalingstatechange = function() {};
     19  test.pcLocal._pc.setLocalDescription(test.originalOffer);
     20 }
     21 
     22 function PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC(test) {
     23  test.pcRemote.onsignalingstatechange = function() {};
     24  test.pcRemote._pc.setRemoteDescription(test._local_offer,
     25    test.pcRemote.releaseIceCandidates,
     26    generateErrorCallback("pcRemote._pc.setRemoteDescription() sync failed"));
     27 }
     28 function PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC(test) {
     29  test.pcRemote.onsignalingstatechange = function() {};
     30  test.pcRemote._pc.setLocalDescription(test.originalAnswer);
     31 }
     32 function PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC(test) {
     33  test.pcLocal.onsignalingstatechange = function() {};
     34  test.pcLocal._pc.setRemoteDescription(test._remote_answer,
     35    test.pcLocal.releaseIceCandidates,
     36    generateErrorCallback("pcLocal._pc.setRemoteDescription() sync failed"));
     37 }
     38 
     39 runNetworkTest(() => {
     40  const test = new PeerConnectionTest();
     41  test.setMediaConstraints([{video: true}], [{video: true}]);
     42  test.chain.replace("PC_LOCAL_SET_LOCAL_DESCRIPTION", PC_LOCAL_SET_LOCAL_DESCRIPTION_SYNC);
     43  test.chain.replace("PC_REMOTE_SET_REMOTE_DESCRIPTION", PC_REMOTE_SET_REMOTE_DESCRIPTION_SYNC);
     44  test.chain.remove("PC_REMOTE_CHECK_CAN_TRICKLE_SYNC");
     45  test.chain.replace("PC_REMOTE_SET_LOCAL_DESCRIPTION", PC_REMOTE_SET_LOCAL_DESCRIPTION_SYNC);
     46  test.chain.replace("PC_LOCAL_SET_REMOTE_DESCRIPTION", PC_LOCAL_SET_REMOTE_DESCRIPTION_SYNC);
     47  test.chain.remove("PC_LOCAL_CHECK_CAN_TRICKLE_SYNC");
     48  return test.run();
     49 });
     50 </script>
     51 </pre>
     52 </body>
     53 </html>