summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/test_peerConnection_bug1512281.html
blob: e6451becea27ad64e070cb789fc755bd9dd94ea7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="pc.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    bug: "1512281",
    title: "Test that RTCP sender and receiver stats are not swapped"
  });

const ensure_missing_rtcp = async stats => {
	const rtcp_stats = [...stats.values()].filter(
		s => s.type.endsWith("bound-rtp") &&
			 s.isRemote == true).map(s => JSON.stringify(s))
	is(rtcp_stats, [],
	   "There are no RTCP stats when RTCP reception is turned off");
};

const PC_LOCAL_TEST_FOR_MISSING_RTCP = async test =>
	await ensure_missing_rtcp(await test.pcLocal.getStats());

const PC_REMOTE_TEST_FOR_MISSING_RTCP = async test =>
  await ensure_missing_rtcp(await test.pcRemote.getStats());

runNetworkTest(async options => {
  await pushPrefs(["media.webrtc.net.force_disable_rtcp_reception", true]);

  const test = new PeerConnectionTest(options);

  test.chain.insertAfter("PC_LOCAL_WAIT_FOR_MEDIA_FLOW",
    [PC_LOCAL_TEST_FOR_MISSING_RTCP]);

  test.chain.insertAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW",
    [PC_REMOTE_TEST_FOR_MISSING_RTCP]);

  test.setMediaConstraints([{audio: true}, {video: true}],
                           [{audio: true}, {video: true}]);
  await test.run();
});

</script>
</pre>
</body>
</html>