summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/test_peerConnection_basicScreenshare.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/media/webrtc/tests/mochitests/test_peerConnection_basicScreenshare.html')
-rw-r--r--dom/media/webrtc/tests/mochitests/test_peerConnection_basicScreenshare.html56
1 files changed, 56 insertions, 0 deletions
diff --git a/dom/media/webrtc/tests/mochitests/test_peerConnection_basicScreenshare.html b/dom/media/webrtc/tests/mochitests/test_peerConnection_basicScreenshare.html
new file mode 100644
index 0000000000..93148ac5fd
--- /dev/null
+++ b/dom/media/webrtc/tests/mochitests/test_peerConnection_basicScreenshare.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <script type="application/javascript" src="pc.js"></script>
+</head>
+<body>
+<pre id="test">
+<script type="application/javascript">
+ createHTML({
+ bug: "1039666",
+ title: "Basic screenshare-only peer connection"
+ });
+
+ async function supportedVideoPayloadTypes() {
+ const pc = new RTCPeerConnection();
+ const offer = await pc.createOffer({offerToReceiveVideo: true});
+ return sdputils.getPayloadTypes(offer.sdp);
+ }
+
+ async function testScreenshare(payloadType) {
+ const options = {};
+ options.h264 = payloadType == 97 || payloadType == 126;
+ const test = new PeerConnectionTest(options);
+ const constraints = {
+ video: { mediaSource: "screen" },
+ };
+ test.setMediaConstraints([constraints], []);
+ test.chain.insertAfterEach("PC_LOCAL_CREATE_OFFER", [
+ function PC_LOCAL_ISOLATE_CODEC() {
+ info(`Forcing payload type ${payloadType}. Note that other associated ` +
+ `payload types, like RTX, are removed too.`);
+ test.originalOffer.sdp =
+ sdputils.removeAllButPayloadType(test.originalOffer.sdp, payloadType);
+ },
+ ]);
+ await test.run();
+ }
+
+ runNetworkTest(async () => {
+ await matchPlatformH264CodecPrefs();
+ const pts = await supportedVideoPayloadTypes();
+ ok(pts.includes("120"), "VP8 is supported");
+ ok(pts.includes("121"), "VP9 is supported");
+ if (pts.length > 2) {
+ is(pts.length, 4, "Expected VP8, VP9 and two variants of H264");
+ ok(pts.includes("97"), "H264 with no packetization-mode is supported");
+ ok(pts.includes("126"), "H264 with packetization-mode=1 is supported");
+ }
+ for (const pt of pts) {
+ await testScreenshare(pt);
+ }
+ });
+</script>
+</pre>
+</body>
+</html>