blob: dc0542eb77f7feca42089c41289cd5d71d761139 [file] [log] [blame]
Philipp Hanckeb7014f72017-02-27 13:24:201<!doctype html>
2<html>
3<head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>RTCPeerConnection setRemoteDescription tests</title>
6</head>
7<body>
8 <!-- These files are in place when executing on W3C. -->
9 <script src="/resources/testharness.js"></script>
10 <script src="/resources/testharnessreport.js"></script>
11 <script type="text/javascript">
Philipp Hancke86eb3cb2017-04-13 16:19:5012 // tests that ontrack is called and parses the msid information from the SDP and creates
Philipp Hancke0e550322017-05-03 13:46:4913 // the streams with matching identifiers.
Philipp Hanckeb7014f72017-02-27 13:24:2014 async_test(function(test) {
15 const sdp = 'v=0\r\n' +
16 'o=- 166855176514521964 2 IN IP4 127.0.0.1\r\n' +
17 's=-\r\n' +
18 't=0 0\r\n' +
19 'a=msid-semantic:WMS *\r\n' +
20 'm=audio 9 UDP/TLS/RTP/SAVPF 111\r\n' +
21 'c=IN IP4 0.0.0.0\r\n' +
22 'a=rtcp:9 IN IP4 0.0.0.0\r\n' +
23 'a=ice-ufrag:someufrag\r\n' +
24 'a=ice-pwd:somelongpwdwithenoughrandomness\r\n' +
25 'a=fingerprint:sha-256 8C:71:B3:8D:A5:38:FD:8F:A4:2E:A2:65:6C:86:52:BC:E0:6E:94:F2:9F:7C:4D:B5:DF:AF:AA:6F:44:90:8D:F4\r\n' +
26 'a=setup:actpass\r\n' +
27 'a=rtcp-mux\r\n' +
28 'a=mid:mid1\r\n' +
29 'a=sendonly\r\n' +
30 'a=rtpmap:111 opus/48000/2\r\n' +
31 'a=msid:stream1 track1\r\n' +
32 'a=ssrc:1001 cname:some\r\n';
33
34 var pc = new RTCPeerConnection(null);
35
Philipp Hancke86eb3cb2017-04-13 16:19:5036 pc.ontrack = test.step_func(function(event) {
Philipp Hancke86eb3cb2017-04-13 16:19:5037 assert_equals(event.streams.length, 1, 'the track belongs to one MediaStream');
38 assert_equals(event.streams[0].id, 'stream1', 'the stream name is parsed from the MSID line');
Philipp Hanckeb7014f72017-02-27 13:24:2039 test.done();
40 });
41
42 pc.setRemoteDescription(new RTCSessionDescription({type: 'offer', sdp: sdp}))
43 .catch(test.step_func(function(e) {
44 assert_unreached('Error ' + e.name + ': ' + e.message);
45 }));
Philipp Hancke0e550322017-05-03 13:46:4946 }, 'Triggers ontrack when called with a remote description and the MSID of the stream is is parsed.');
Philipp Hanckeb7014f72017-02-27 13:24:2047</script>
48
49</body>
50</html>