ice-ufragpwd.html (1722B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <meta name="timeout" content="long"> 4 <title>RTCPeerConnection Failed State</title> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="../RTCPeerConnection-helper.js"></script> 8 <script> 9 'use strict'; 10 11 // Tests for validating ice-ufrag and ice-pwd syntax defined in 12 // https://tools.ietf.org/html/rfc5245#section-15.4 13 // Alphanumeric, '+' and '/' are allowed. 14 15 const preamble = `v=0 16 o=- 0 3 IN IP4 127.0.0.1 17 s=- 18 t=0 0 19 a=fingerprint:sha-256 A7:24:72:CA:6E:02:55:39:BA:66:DF:6E:CC:4C:D8:B0:1A:BF:1A:56:65:7D:F4:03:AD:7E:77:43:2A:29:EC:93 20 m=video 1 RTP/SAVPF 100 21 c=IN IP4 0.0.0.0 22 a=rtcp-mux 23 a=sendonly 24 a=mid:video 25 a=rtpmap:100 VP8/30 26 a=setup:actpass 27 `; 28 const valid_ufrag = 'a=ice-ufrag:ETEn\r\n'; 29 const valid_pwd = 'a=ice-pwd:OtSK0WpNtpUjkY4+86js7Z/l\r\n'; 30 const not_ice_char = '$'; // A snowman emoji would be cool but is not interoperable. 31 32 promise_test(async t => { 33 const pc = new RTCPeerConnection(); 34 t.add_cleanup(() => pc.close()); 35 36 const sdp = preamble + 37 valid_ufrag.replace('ETEn', 'E' + not_ice_char + 'En') + 38 valid_pwd; 39 40 return promise_rejects_dom(t, 'InvalidAccessError', 41 pc.setRemoteDescription({type: 'offer', sdp})); 42 }, 'setRemoteDescription with a ice-ufrag containing a non-ice-char fails'); 43 44 promise_test(async t => { 45 const pc = new RTCPeerConnection(); 46 t.add_cleanup(() => pc.close()); 47 48 const sdp = preamble + 49 valid_ufrag + 50 valid_pwd.replace('K0Wp', 'K' + not_ice_char + 'Wp'); 51 52 return promise_rejects_dom(t, 'InvalidAccessError', 53 pc.setRemoteDescription({type: 'offer', sdp})); 54 }, 'setRemoteDescription with a ice-pwd containing a non-ice-char fails'); 55 </script>