LibWebRTCRtpReceiverBackend::getSynchronizationSources should use Vector::append
[WebKit-https.git] / LayoutTests / webrtc / clone-audio-track.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     var context = new webkitAudioContext();
13     promise_test((test) => {
14         if (window.testRunner)
15             testRunner.setUserMediaPermission(true);
16
17         return navigator.mediaDevices.getUserMedia({audio: true}).then((localStream) => {
18             var clonedTrack;
19             var remoteTrack;
20             var remoteStream;
21             return new Promise((resolve, reject) => {
22                 createConnections((firstConnection) => {
23                     var track = localStream.getAudioTracks()[0];
24                     clonedTrack = track.clone();
25                     track.enabled = false;
26                     firstConnection.addTrack(localStream.getAudioTracks()[0], localStream);
27                 }, (secondConnection) => {
28                     secondConnection.ontrack = (trackEvent) => {
29                         remoteStream = trackEvent.streams[0];
30                         remoteTrack = remoteStream.getAudioTracks()[0];
31                         resolve();
32                     };
33                 });
34             }).then(() => {
35                 return analyseAudio(remoteStream, 200, context).then((results) => {
36                     assert_false(results.heardHum, "Did not heard hum from remote enabled track");
37                 });
38             }).then(() => {
39                 return analyseAudio(new MediaStream([clonedTrack]), 200, context).then((results) => {
40                     assert_true(results.heardHum, "Heard hum from cloned track");
41                 });
42             }).then(() => {
43                 return context.close();
44             });
45         });
46     }, "Muting an outgoing audio track but not its clone");
47     </script>
48 </body>
49 </html>