Chromium Code Reviews| Index: content/test/data/media/peerconnection-call.html |
| diff --git a/content/test/data/media/peerconnection-call.html b/content/test/data/media/peerconnection-call.html |
| index 39b01b5a5f0a926c0e4d9e58fdd904bdb98cd6c2..758ebad73fe071d53573fb69afc44779bfbf3970 100644 |
| --- a/content/test/data/media/peerconnection-call.html |
| +++ b/content/test/data/media/peerconnection-call.html |
| @@ -113,6 +113,68 @@ |
| waitForVideo('remote-view-1'); |
| waitForVideo('remote-view-2'); |
| } |
| + |
| + // Test call with a new Video MediaStream that has been created based on a |
| + // stream generated by getUserMedia. When Video is flowing, an audio track |
| + // is added to the sent stream and the video track is removed. This |
| + // is to test that adding and removing of remote tracks on an existing |
| + // mediastream works. |
| + function callWithNewVideoMediaStreamLaterSwitchToAudio() { |
| + createConnections(null); |
| + navigator.webkitGetUserMedia({audio:true, video:true}, |
|
phoglund_chromium
2013/04/16 14:44:58
Nit: line length
perkj_chrome
2013/04/18 14:46:58
Done.
|
| + createNewVideoStreamAndAddToBothConnections, printGetUserMediaError); |
| + |
| + waitForVideo('remote-view-1'); |
| + waitForVideo('remote-view-2'); |
| + |
| + // Set an event handler for when video is playing. |
|
phoglund_chromium
2013/04/16 14:44:58
Side note: We should consider if we make this eve
perkj_chrome
2013/04/18 14:46:58
I was considering that. But one feature I like wit
|
| + setAllEventsOccuredHandler(function() { |
| + // Add an audio track to the local stream and remove the video track. |
| + local_stream = gFirstConnection.getLocalStreams()[0]; |
| + local_stream.addTrack(gLocalStream.getAudioTracks()[0]); |
| + local_stream.removeTrack(local_stream.getVideoTracks()[0]); |
| + |
| + remote_stream_1 = gFirstConnection.getRemoteStreams()[0]; |
| + // Add an expected event that onaddtrack will be called on the remote |
|
phoglund_chromium
2013/04/16 14:44:58
So you call addTrack and removeTrack and _later_ s
perkj_chrome
2013/04/18 14:46:58
Nothing happens until you do the renegotiation. Th
|
| + // mediastream received on gFirstConnection when the audio track is |
| + // received. |
| + addExpectedEvent(); |
| + remote_stream_1.onaddtrack = function() { |
| + expectEquals(remote_stream_1.getAudioTracks()[0].id, |
| + local_stream.getAudioTracks()[0].id); |
| + eventOccured(); |
| + } |
| + |
| + // Add an expectation that the received video track is removed from |
| + // gFirstConnection. |
| + addExpectedEvent(); |
| + remote_stream_1.onremovetrack = function() { |
| + eventOccured(); |
| + } |
| + |
| + // Add an expected event that onaddtrack will be called on the remote |
| + // mediastream received on gSecondConnection when the audio track is |
| + // received. |
| + remote_stream_2 = gSecondConnection.getRemoteStreams()[0]; |
| + addExpectedEvent(); |
| + remote_stream_2.onaddtrack = function() { |
| + expectEquals(remote_stream_2.getAudioTracks()[0].id, |
| + local_stream.getAudioTracks()[0].id); |
| + eventOccured(); |
| + } |
| + |
| + // Add an expectation that the received video track is removed from |
| + // gSecondConnection. |
| + addExpectedEvent(); |
| + remote_stream_2.onremovetrack = function() { |
| + eventOccured(); |
| + } |
| + |
| + // When all the above events have occurred- the test pass. |
| + setAllEventsOccuredHandler(function() { document.title = 'OK'; }); |
| + negotiate(); |
| + }); |
| + } |
| // This function is used for setting up a test that: |
| // 1. Creates a data channel on |gFirstConnection| and sends data to |
| @@ -212,9 +274,12 @@ |
| // MediaStream. A new MediaStream is created and the video track from |
| // |localStream| is added. |
| function createNewVideoStreamAndAddToBothConnections(localStream) { |
| - var new_stream = new webkitMediaStream(); |
| + displayAndRemember(localStream); |
|
phoglund_chromium
2013/04/16 14:44:58
This change doesn't make sense, accidental?
perkj_chrome
2013/04/18 14:46:58
Nope- I want to reuse createNewVideoStreamAndAddTo
|
| + var new_stream = new webkitMediaStream(); |
| new_stream.addTrack(localStream.getVideoTracks()[0]); |
| - addStreamToBothConnectionsAndNegotiate(new_stream); |
| + gFirstConnection.addStream(new_stream); |
| + gSecondConnection.addStream(new_stream); |
| + negotiate(); |
| } |
| function negotiate() { |