tor-browser

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

sctp-format.html (998B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>RTCPeerconnection SDP SCTP format test</title>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="../RTCPeerConnection-helper.js"></script>
      7 <script>
      8 'use strict';
      9 
     10 promise_test(async t => {
     11  const caller = new RTCPeerConnection();
     12  const callee = new RTCPeerConnection();
     13  t.add_cleanup(() => caller.close());
     14  t.add_cleanup(() => callee.close());
     15  caller.createDataChannel('channel');
     16  const offer = await caller.createOffer();
     17  const [preamble, media_section, postamble] = offer.sdp.split('\r\nm=');
     18  assert_true(typeof(postamble) === 'undefined');
     19  assert_greater_than(media_section.search(
     20    /^application \d+ UDP\/DTLS\/SCTP webrtc-datachannel\r\n/), -1);
     21  assert_greater_than(media_section.search(/\r\na=sctp-port:\d+\r\n/), -1);
     22  assert_greater_than(media_section.search(/\r\na=mid:/), -1);
     23 }, 'Generated Datachannel SDP uses correct SCTP offer syntax');
     24 
     25 </script>