blob: 7ddfc1c64d7ecb2f1f40ab92667babde83889856 [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 OperationError: Expect line: candidate:<candidate-str>
PASS Remote description set
*** Define sdpMid, badSdpMid, sdpMLineIndex and badSdpMLineIndex for testing
PASS sdpMLineIndex is not badSdpMLineIndex
FAIL sdpMid should not be null.
PASS sdpMid is not badSdpMid
FAIL promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: badSdpMid})) fulfilled unexpectedly.
FAIL promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMLineIndex: badSdpMLineIndex})) fulfilled unexpectedly.
*** A (bad) sdpMid takes precedesce over valid sdpMLineIndex
FAIL promise pc.addIceCandidate(new RTCIceCandidate({candidate: validCandidate, sdpMid: badSdpMid, sdpMLineIndex: sdpMLineIndex})) fulfilled unexpectedly.
*** Test bad candidate content with valid sdpMid
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMid: sdpMid})) rejected with OperationError: Expect line: candidate:<candidate-str>
*** Test bad candidate content with valid sdpMLineIndex
PASS promise pc.addIceCandidate(new RTCIceCandidate({candidate: 'bad content', sdpMLineIndex: sdpMLineIndex})) rejected with OperationError: Expect line: candidate:<candidate-str>
*** 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