summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc/protocol/sdes-dont-dont-dont.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/webrtc/protocol/sdes-dont-dont-dont.html')
-rw-r--r--testing/web-platform/tests/webrtc/protocol/sdes-dont-dont-dont.html55
1 files changed, 55 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webrtc/protocol/sdes-dont-dont-dont.html b/testing/web-platform/tests/webrtc/protocol/sdes-dont-dont-dont.html
new file mode 100644
index 0000000000..e938c84c8b
--- /dev/null
+++ b/testing/web-platform/tests/webrtc/protocol/sdes-dont-dont-dont.html
@@ -0,0 +1,55 @@
+<!doctype html>
+<meta charset=utf-8>
+<meta name="timeout" content="long">
+<title>RTCPeerConnection MUST NOT support SDES</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script src="../RTCPeerConnection-helper.js"></script>
+<script src="/webrtc/third_party/sdp/sdp.js"></script>
+<script>
+'use strict';
+
+// Test support for
+// https://www.rfc-editor.org/rfc/rfc8826#section-4.3.1
+
+const sdp = `v=0
+o=- 0 3 IN IP4 127.0.0.1
+s=-
+t=0 0
+m=video 9 UDP/TLS/RTP/SAVPF 100
+c=IN IP4 0.0.0.0
+a=rtcp-mux
+a=sendonly
+a=mid:video
+a=rtpmap:100 VP8/90000
+a=fmtp:100 max-fr=30;max-fs=3600
+a=crypto:0 AES_CM_128_HMAC_SHA1_80 inline:2nra27hTUb9ilyn2rEkBEQN9WOFts26F/jvofasw
+a=ice-ufrag:ETEn
+a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l
+`;
+
+// Negative test for Chrome legacy behavior.
+promise_test(async t => {
+ const sdes_constraint = {'mandatory': {'DtlsSrtpKeyAgreement': false}};
+ const pc = new RTCPeerConnection(null, sdes_constraint);
+ t.add_cleanup(() => pc.close());
+
+ pc.addTransceiver('audio');
+ const offer = await pc.createOffer();
+ assert_false(offer.sdp.includes('\na=crypto:'));
+}, 'does not create offers with SDES');
+
+promise_test(async t => {
+ const pc = new RTCPeerConnection();
+ t.add_cleanup(() => pc.close());
+
+ try {
+ await pc.setRemoteDescription({type: 'offer', sdp});
+ assert_unreached("Must not accept SDP without fingerprint");
+ } catch (e) {
+ // TODO: which error is correct? See
+ // https://github.com/w3c/webrtc-pc/issues/2672
+ assert_true(['OperationError', 'InvalidAccessError'].includes(e.name));
+ }
+}, 'rejects a remote offer that only includes SDES and no DTLS fingerprint');
+</script>