blob: 421db26270a36f10b2d7dfc49ede595433d578f0 [file] [log] [blame]
Test behavior of RTCPeerConnection.addIceCandidate
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
*** A remote description is needed before a candidate can be added
PASS pc.remoteDescription is null
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: 'foo', sdpMid: 0})) rejected with InvalidStateError (DOM Exception 11): No remote description set
PASS Remote description set
*** Define sdpMid, badSdpMid, sdpMLineIndex and badSdpMLineIndex for testing
PASS sdpMLineIndex is not badSdpMLineIndex
PASS sdpMid is not null
PASS sdpMid is not badSdpMid
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: badSdpMid})) rejected with OperationError (DOM Exception 34): sdpMid did not match any media description
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMLineIndex: badSdpMLineIndex})) rejected with OperationError (DOM Exception 34): sdpMLineIndex is out of range
*** A (bad) sdpMid takes precedesce over valid sdpMLineIndex
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: badSdpMid, sdpMLineIndex: sdpMLineIndex})) rejected with OperationError (DOM Exception 34): sdpMid did not match any media description
*** Test bad candidate content with valid sdpMid
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMid: sdpMid})) rejected with OperationError (DOM Exception 34): Invalid candidate content
*** Test bad candidate content with valid sdpMLineIndex
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMLineIndex: sdpMLineIndex})) rejected with OperationError (DOM Exception 34): Invalid candidate content
*** Test valid candidate with no mid and mlineindex
PASS promise pc.addIceCandidate({candidate: validCandidate}) rejected with TypeError: Argument 1 ('candidate') to RTCPeerConnection.addIceCandidate must be an instance of RTCIceCandidate
*** Test some OK input
PASS promise pc.addIceCandidate({candidate: validCandidate, sdpMid: sdpMid}) fulfilled with undefined
PASS promise pc.addIceCandidate({candidate: validCandidate, sdpMLineIndex: sdpMLineIndex}) fulfilled with undefined
PASS promise pc.addIceCandidate(undefined) fulfilled with undefined
PASS promise pc.addIceCandidate(null) fulfilled with undefined
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMLineIndex: sdpMLineIndex})) fulfilled with undefined
*** A valid sdpMid takes precedesce over a bad sdpMLineIndex
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: sdpMid, sdpMLineIndex: badSdpMLineIndex})) fulfilled with undefined
PASS End of test promise chain
PASS successfullyParsed is true
TEST COMPLETE