blob: d81f83330a233d7b7360efc1b9e2f9e6cc3367c4 [file] [log] [blame]
Test basic behavior of RTCPeerConnection.add/removeTrack()
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Test bad addTrack() arguments
PASS pc.addTrack() threw exception TypeError: Not enough arguments.
PASS pc.addTrack(null) threw exception TypeError: Argument 1 ('track') to RTCPeerConnection.addTrack must be an instance of MediaStreamTrack.
PASS pc.addTrack({}) threw exception TypeError: Argument 1 ('track') to RTCPeerConnection.addTrack must be an instance of MediaStreamTrack.
PASS pc.addTrack(track, null) threw exception TypeError: Type error.
PASS pc.addTrack(track, {}) threw exception TypeError: Type error.
PASS pc.addTrack(track, stream, null) threw exception TypeError: Type error.
Test bad removeTrack() arguments
PASS pc.removeTrack() threw exception TypeError: Not enough arguments.
PASS pc.removeTrack(null) threw exception TypeError: Argument 1 ('sender') to RTCPeerConnection.removeTrack must be an instance of RTCRtpSender.
PASS pc.removeTrack({}) threw exception TypeError: Argument 1 ('sender') to RTCPeerConnection.removeTrack must be an instance of RTCRtpSender.
PASS pc.getSenders().length is 0
PASS sender = pc.addTrack(track, stream) did not throw exception.
PASS sender is an instance of RTCRtpSender
PASS sender.track is track
PASS pc.getSenders().length is 1
PASS pc.getSenders()[0] is sender
PASS pc.getReceivers().length is 1
PASS receiver.track is an instance of MediaStreamTrack
PASS receiver.track.muted is true
PASS receiver.track.kind is sender.track.kind
PASS pc.getTransceivers().length is 1
PASS transceiver.mid is null
PASS transceiver.sender is sender
PASS transceiver.receiver is receiver
PASS transceiver.stopped is false
Try to add same track again
PASS sender = pc.addTrack(track, stream) threw exception InvalidAccessError: The object does not support the operation or argument..
PASS sender2 = pc.addTrack(track2, stream, stream2) did not throw exception.
PASS pc.getSenders().length is 2
PASS pc.getSenders()[0] is sender
PASS pc.getSenders()[1] is sender2
PASS pc.removeTrack(sender) did not throw exception.
Sender is still in getSenders() list
PASS pc.getSenders().length is 2
PASS senderFromPc2 = pc2.addTrack(track, stream) did not throw exception.
removeTrack() with 'foreign' sender must be ignored (not throw)
PASS pc.removeTrack(senderFromPc2) did not throw exception.
PASS pc.addTrack(null); threw exception TypeError: Argument 1 ('track') to RTCPeerConnection.addTrack must be an instance of MediaStreamTrack.
PASS pc.addTrack(undefined); threw exception TypeError: Argument 1 ('track') to RTCPeerConnection.addTrack must be an instance of MediaStreamTrack.
PASS pc.removeTrack(null); threw exception TypeError: Argument 1 ('sender') to RTCPeerConnection.removeTrack must be an instance of RTCRtpSender.
PASS pc.removeTrack(undefined); threw exception TypeError: Argument 1 ('sender') to RTCPeerConnection.removeTrack must be an instance of RTCRtpSender.
PASS successfullyParsed is true
TEST COMPLETE