MediaStream id should be equal to msid
[WebKit-https.git] / LayoutTests / webrtc / peer-connection-remote-audio-mute.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4     <meta charset="utf-8">
5     <title>Testing local audio capture playback causes "playing" event to fire</title>
6     <script src="../resources/testharness.js"></script>
7     <script src="../resources/testharnessreport.js"></script>
8 </head>
9 <body>
10     <script src ="routines.js"></script>
11     <script>
12     promise_test((test) => {
13         if (window.testRunner)
14             testRunner.setUserMediaPermission(true);
15
16         return navigator.mediaDevices.getUserMedia({audio: true}).then((localStream) => {
17             var remoteTrack;
18             var remoteStream;
19             return new Promise((resolve, reject) => {
20                 createConnections((firstConnection) => {
21                     firstConnection.addStream(localStream);
22                 }, (secondConnection) => {
23                     secondConnection.onaddstream = (streamEvent) => {
24                         remoteStream = streamEvent.stream;
25                         remoteTrack = remoteStream.getAudioTracks()[0];
26                         resolve();
27                     };
28                 });
29             }).then(() => {
30                 return analyseAudio(remoteStream, 200).then((results) => {
31                     assert_true(results.heardHum, "heard hum from remote enabled track");
32                 });
33             }).then(() => {
34                 remoteTrack.enabled = false;
35                 return waitFor(100);
36             }).then(() => {
37                 return analyseAudio(remoteStream, 200).then((results) => {
38                     assert_false(results.heardHum, "not heard hum from remote disabled track");
39                 });
40             });
41         });
42     }, "Muting an incoming audio track");
43     </script>
44 </body>
45 </html>