tor-browser

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

getStats.https.html (1365B)


      1 <!doctype html>
      2 <meta charset=utf-8>
      3 <title>RTCPeerConnection Simulcast Tests - getStats</title>
      4 <meta name="timeout" content="long">
      5 <script src="../third_party/sdp/sdp.js"></script>
      6 <script src="simulcast.js"></script>
      7 <script src="../RTCPeerConnection-helper.js"></script>
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="/resources/testdriver.js"></script>
     11 <script src="/resources/testdriver-vendor.js"></script>
     12 <script src="../../mediacapture-streams/permission-helper.js"></script>
     13 <script>
     14 promise_test(async t => {
     15  const rids = [0, 1, 2];
     16  const pc1 = new RTCPeerConnection();
     17  t.add_cleanup(() => pc1.close());
     18  const pc2 = new RTCPeerConnection();
     19  t.add_cleanup(() => pc2.close());
     20 
     21  await negotiateSimulcastAndWaitForVideo(t, await getCameraStream(t), rids, pc1, pc2);
     22 
     23  const outboundStats = [];
     24  const senderStats = await pc1.getSenders()[0].getStats();
     25  senderStats.forEach(stat => {
     26    if (stat.type === 'outbound-rtp') {
     27      outboundStats.push(stat);
     28    }
     29  });
     30  assert_equals(outboundStats.length, 3, "getStats result should contain three layers");
     31  const statsRids = outboundStats.map(stat => parseInt(stat.rid, 10));
     32  assert_array_equals(rids, statsRids.sort(), "getStats result should match the rids provided");
     33 }, 'Simulcast getStats results');
     34 </script>