tor-browser

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

RTCSctpTransport-maxChannels.html (1926B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>RTCSctpTransport.prototype.maxChannels</title>
      4 <link rel="help" href="https://w3c.github.io/webrtc-pc/#rtcsctptransport-interface">
      5 <script src=/resources/testharness.js></script>
      6 <script src=/resources/testharnessreport.js></script>
      7 <script src="RTCPeerConnection-helper.js"></script>
      8 <script>
      9 'use strict';
     10 
     11 promise_test(async (t) => {
     12  const pc = new RTCPeerConnection();
     13  t.add_cleanup(() => pc.close());
     14 
     15  assert_equals(pc.sctp, null, 'RTCSctpTransport must be null');
     16  pc.createDataChannel('test');
     17  const offer = await pc.createOffer();
     18  await pc.setRemoteDescription(offer);
     19  const answer = await pc.createAnswer();
     20  await pc.setLocalDescription(answer);
     21 
     22  assert_not_equals(pc.sctp, null, 'RTCSctpTransport must be available');
     23  assert_equals(pc.sctp.maxChannels, null, 'maxChannels must not be set');
     24 }, 'An unconnected peerconnection must not have maxChannels set');
     25 
     26 promise_test(async (t) => {
     27    const pc1 = new RTCPeerConnection();
     28  t.add_cleanup(() => pc1.close());
     29  const pc2 = new RTCPeerConnection();
     30  t.add_cleanup(() => pc2.close());
     31  exchangeIceCandidates(pc1, pc2);
     32  pc1.createDataChannel('');
     33  const offer = await pc1.createOffer();
     34  await pc1.setLocalDescription(offer);
     35  const pc1ConnectedWaiter = waitForState(pc1.sctp, 'connected');
     36  await pc2.setRemoteDescription(offer);
     37  const pc2ConnectedWaiter = waitForState(pc2.sctp, 'connected');
     38  const answer = await pc2.createAnswer();
     39  await pc2.setLocalDescription(answer);
     40  await pc1.setRemoteDescription(answer);
     41  assert_equals(null, pc1.sctp.maxChannels);
     42  assert_equals(null, pc2.sctp.maxChannels);
     43  await pc1ConnectedWaiter;
     44  await pc2ConnectedWaiter;
     45  assert_not_equals(null, pc1.sctp.maxChannels);
     46  assert_not_equals(null, pc2.sctp.maxChannels);
     47  assert_equals(pc1.sctp.maxChannels, pc2.sctp.maxChannels);
     48 }, 'maxChannels gets instantiated after connecting');
     49 </script>