tor-browser

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

RTCPeerConnection-canTrickleIceCandidates.html (2450B)


      1 <!doctype html>
      2 <html>
      3 <head>
      4  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      5  <title>RTCPeerConnection canTrickleIceCandidates tests</title>
      6 </head>
      7 <body>
      8  <!-- These files are in place when executing on W3C. -->
      9  <script src="/resources/testharness.js"></script>
     10  <script src="/resources/testharnessreport.js"></script>
     11  <script type="text/javascript">
     12  // tests support for RTCPeerConnection.canTrickleIceCandidates:
     13  // http://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-cantrickleicecandidates
     14  const sdp = 'v=0\r\n' +
     15      'o=- 166855176514521964 2 IN IP4 127.0.0.1\r\n' +
     16      's=-\r\n' +
     17      't=0 0\r\n' +
     18      'a=ice-options:trickle\r\n' +
     19      'm=audio 9 UDP/TLS/RTP/SAVPF 111\r\n' +
     20      'c=IN IP4 0.0.0.0\r\n' +
     21      'a=rtcp:9 IN IP4 0.0.0.0\r\n' +
     22      'a=ice-ufrag:someufrag\r\n' +
     23      'a=ice-pwd:somelongpwdwithenoughrandomness\r\n' +
     24      'a=fingerprint:sha-256 8C:71:B3:8D:A5:38:FD:8F:A4:2E:A2:65:6C:86:52:BC:E0:6E:94:F2:9F:7C:4D:B5:DF:AF:AA:6F:44:90:8D:F4\r\n' +
     25      'a=setup:actpass\r\n' +
     26      'a=rtcp-mux\r\n' +
     27      'a=mid:mid1\r\n' +
     28      'a=sendonly\r\n' +
     29      'a=msid:stream1 track1\r\n' +
     30      'a=ssrc:1001 cname:some\r\n' +
     31      'a=rtpmap:111 opus/48000/2\r\n';
     32 
     33  test(function() {
     34    var pc = new RTCPeerConnection();
     35    assert_equals(pc.canTrickleIceCandidates, null, 'canTrickleIceCandidates property is null');
     36  }, 'canTrickleIceCandidates property is null prior to setRemoteDescription');
     37 
     38  promise_test(function(t) {
     39    var pc = new RTCPeerConnection();
     40 
     41    t.add_cleanup(() => pc.close());
     42 
     43    return pc.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp}))
     44    .then(function() {
     45      assert_true(pc.canTrickleIceCandidates, 'canTrickleIceCandidates property is true after setRemoteDescription');
     46    })
     47  }, 'canTrickleIceCandidates property is true after setRemoteDescription with a=ice-options:trickle');
     48 
     49  promise_test(function(t) {
     50    var pc = new RTCPeerConnection();
     51 
     52    t.add_cleanup(() => pc.close());
     53 
     54    return pc.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp.replace('a=ice-options:trickle\r\n', '')}))
     55    .then(function() {
     56      assert_false(pc.canTrickleIceCandidates, 'canTrickleIceCandidates property is false after setRemoteDescription');
     57    })
     58  }, 'canTrickleIceCandidates property is false after setRemoteDescription without a=ice-options:trickle');
     59 </script>
     60 
     61 </body>
     62 </html>