blob: 7de2b75f4ee85b338d6b36ff7c12c5b17bb61779 [file] [log] [blame]
Soares Chen172fe9d2017-07-18 09:30:181<!doctype html>
2<meta charset=utf-8>
3<title>RTCRtpParameters headerExtensions</title>
4<script src="/resources/testharness.js"></script>
5<script src="/resources/testharnessreport.js"></script>
6<script src="dictionary-helper.js"></script>
7<script src="RTCRtpParameters-helper.js"></script>
8<script>
9 'use strict';
10
11 // Test is based on the following editor draft:
12 // https://w3c.github.io/webrtc-pc/archives/20170605/webrtc.html
13
14 // The following helper functions are called from RTCRtpParameters-helper.js:
15 // validateSenderRtpParameters
16
17 /*
18 5.2. RTCRtpSender Interface
19 interface RTCRtpSender {
20 Promise<void> setParameters(optional RTCRtpParameters parameters);
21 RTCRtpParameters getParameters();
22 };
23
24 dictionary RTCRtpParameters {
25 DOMString transactionId;
26 sequence<RTCRtpEncodingParameters> encodings;
27 sequence<RTCRtpHeaderExtensionParameters> headerExtensions;
28 RTCRtcpParameters rtcp;
29 sequence<RTCRtpCodecParameters> codecs;
Soares Chen172fe9d2017-07-18 09:30:1830 };
31
32 dictionary RTCRtpHeaderExtensionParameters {
33 [readonly]
34 DOMString uri;
35
36 [readonly]
37 unsigned short id;
38
39 [readonly]
40 boolean encrypted;
41 };
42
43 getParameters
44 - The headerExtensions sequence is populated based on the header extensions
45 that have been negotiated for sending.
46 */
47
48 /*
49 5.2. setParameters
50 7. If parameters.encodings.length is different from N, or if any parameter
51 in the parameters argument, marked as a Read-only parameter, has a value
52 that is different from the corresponding parameter value returned from
53 sender.getParameters(), abort these steps and return a promise rejected
54 with a newly created InvalidModificationError. Note that this also applies
55 to transactionId.
56 */
57 promise_test(t => {
58 const pc = new RTCPeerConnection();
Philipp Hancke1622a022018-06-11 10:00:5359 t.add_cleanup(() => pc.close());
Soares Chen172fe9d2017-07-18 09:30:1860 const { sender } = pc.addTransceiver('audio');
61 const param = sender.getParameters();
62 validateSenderRtpParameters(param);
63
64 param.headerExtensions = [{
65 uri: 'non-existent.example.org',
66 id: 404,
67 encrypted: false
68 }];
69
Boris Zbarskyb7f2dd32020-02-04 21:26:4870 return promise_rejects_dom(t, 'InvalidModificationError',
Soares Chen172fe9d2017-07-18 09:30:1871 sender.setParameters(param));
Soares Chen172fe9d2017-07-18 09:30:1872 }, `setParameters() with modified headerExtensions should reject with InvalidModificationError`);
73
74</script>