webrtc wpt: assert SDES is not supported (#30213)

based on
  third_party/blink/web_tests/fast/peerconnection/RTCPeerConnection-sdes-constraint.html

BUG=webrtc:11066

Change-Id: I9f7a5cc377013241e96bdc13556c30d9e1559cba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3123755
Commit-Queue: Philipp Hancke <philipp.hancke@googlemail.com>
Reviewed-by: Harald Alvestrand <hta@chromium.org>
Cr-Commit-Position: refs/heads/main@{#915876}

Co-authored-by: Philipp Hancke <philipp.hancke@googlemail.com>
diff --git a/webrtc/protocol/sdes-dont-dont-dont.html b/webrtc/protocol/sdes-dont-dont-dont.html
new file mode 100644
index 0000000..541c996
--- /dev/null
+++ b/webrtc/protocol/sdes-dont-dont-dont.html
@@ -0,0 +1,48 @@
+<!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 sdes_constraint = {'mandatory': {'DtlsSrtpKeyAgreement': false}};
+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
+`;
+
+promise_test(async t => {
+  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());
+
+  pc.setRemoteDescription({type: 'offer', sdp})
+    .then(assert_unreached);
+}, 'rejects a remote offer that only includes SDES and no DTLS');
+</script>