commit-queue@webkit.org | 0570cde | 2017-05-31 20:51:12 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <title>A muted audio track that is added should not cause audio to be sent</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 | var localTrack; |
| 17 | return navigator.mediaDevices.getUserMedia({audio: true}).then((localStream) => { |
| 18 | localTrack = localStream.getAudioTracks()[0]; |
| 19 | localTrack.enabled = false; |
| 20 | var remoteStream; |
| 21 | return new Promise((resolve, reject) => { |
| 22 | createConnections((firstConnection) => { |
| 23 | firstConnection.addTrack(localTrack, localStream); |
| 24 | }, (secondConnection) => { |
| 25 | secondConnection.ontrack = (trackEvent) => { |
| 26 | remoteStream = trackEvent.streams[0]; |
| 27 | resolve(); |
| 28 | }; |
| 29 | }); |
| 30 | }).then(() => { |
| 31 | return doHumAnalysis(remoteStream, false).then((result) => { |
| 32 | assert_true(result, "Should not hear hum"); |
| 33 | }); |
| 34 | }).then(() => { |
| 35 | localTrack.enabled = true; |
| 36 | }).then(() => { |
| 37 | return doHumAnalysis(remoteStream, true).then((result) => { |
| 38 | assert_true(result, "Should hear hum"); |
| 39 | }); |
| 40 | }); |
| 41 | }); |
| 42 | }, "Muting a local audio track before adding it should be correctly handled"); |
| 43 | </script> |
| 44 | </body> |
| 45 | </html> |