summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webrtc/protocol/sdes-dont-dont-dont.html
blob: dcf7ad1b5467a17226cdb3144b00c0689cf8149b (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
48
49
<!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(t => {
  const pc = new RTCPeerConnection();
  t.add_cleanup(() => pc.close());

  return promise_rejects_dom(t, 'InvalidAccessError',
      pc.setRemoteDescription({type: 'offer', sdp}));
}, 'rejects a remote offer that only includes SDES and no DTLS fingerprint');
</script>