blob: 601de3a83d4492fe082449596c7b1c69c0a06a84 [file] [log] [blame]
Test basic behavior of RTCRtpSender.replaceTrack()
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS pc.getSenders().length is 0
PASS sender = pc.addTrack(audioTrack, stream) did not throw exception.
PASS sender is an instance of RTCRtpSender
PASS sender.track is audioTrack
PASS promise sender.replaceTrack() rejected with TypeError: Not enough arguments
PASS promise sender.replaceTrack(null) rejected with TypeError: Argument 1 ('withTrack') to RTCRtpSender.replaceTrack must be an instance of MediaStreamTrack
PASS promise sender.replaceTrack({}) rejected with TypeError: Argument 1 ('withTrack') to RTCRtpSender.replaceTrack must be an instance of MediaStreamTrack
Test mismatching track kind
PASS promise sender.replaceTrack(videoTrack) rejected with TypeError: Type error
PASS promise sender.replaceTrack(audioTrack2) fulfilled with undefined
PASS Track successfully replaced
PASS sender.track is audioTrack2
Sender should still use old track (audioTrack) id in negotiation.
PASS offer created
PASS offer.sdp.indexOf(audioTrack.id) is not -1
PASS offer.sdp.indexOf(audioTrack2.id) is -1
Stop sender, and try replacing the track
PASS promise sender.replaceTrack(audioTrack2) rejected with InvalidStateError (DOM Exception 11): The object is in an invalid state.
Create a new sender
PASS sender = pc.addTrack(audioTrack2, stream) did not throw exception.
Close pc and try replacing the track
PASS promise sender.replaceTrack(audioTrack3) rejected with InvalidStateError (DOM Exception 11): The object is in an invalid state.
End of promise chain
PASS successfullyParsed is true
TEST COMPLETE