diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /dom/media/webrtc/tests/mochitests/test_peerConnection_trackless_sender_stats.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | dom/media/webrtc/tests/mochitests/test_peerConnection_trackless_sender_stats.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_trackless_sender_stats.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_trackless_sender_stats.html new file mode 100644 index 0000000000..f0356f5655 --- /dev/null +++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_trackless_sender_stats.html @@ -0,0 +1,56 @@ +<!DOCTYPE HTML> +<html> +<head> + <script type="application/javascript" src="pc.js"></script> + <script type="application/javascript" src="stats.js"></script> +</head> +<body> +<pre id="test"> +<script type="application/javascript"> + createHTML({ + bug: "1452673", + title: "Trackless RTCRtpSender.getStats()", + visible: true + }); + + // Calling getstats() on a trackless RTCRtpSender should yield an empty + // stats report. When track stats are added in the future, the stats + // for the removed tracks should continue to appear. + + runNetworkTest(function (options) { + const test = new PeerConnectionTest(options); + test.chain.removeAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW"); + test.chain.append( + async function PC_LOCAL_AND_REMOTE_TRACKLESS_SENDER_STATS(test) { + await Promise.all([ + waitForSyncedRtcp(test.pcLocal._pc), + waitForSyncedRtcp(test.pcRemote._pc), + ]); + let senders = test.pcLocal.getSenders(); + let receivers = test.pcRemote.getReceivers(); + is(senders.length, 2, "Have exactly two senders."); + is(receivers.length, 2, "Have exactly two receivers."); + for(let kind of ["audio", "video"]) { + is(senders.filter(s => s.track.kind == kind).length, 1, + "Exactly 1 sender of kind " + kind); + is(receivers.filter(r => r.track.kind == kind).length, 1, + "Exactly 1 receiver of kind " + kind); + } + // Remove tracks from senders + for (const sender of senders) { + await sender.replaceTrack(null); + is(sender.track, null, "Sender track removed"); + let stats = await sender.getStats(); + ok(stats instanceof window.RTCStatsReport, "Stats is instance of RTCStatsReport"); + // Number of stats in the report. This should be 0. + is(stats.size, 0, "Trackless sender stats report is empty"); + } + } + ); + test.setMediaConstraints([{audio: true}, {video: true}], []); + return test.run(); + }); +</script> +</pre> +</body> +</html> |