2012-08-22 19:18:34 +00:00
Tests RTCIceCandidate.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS candidate = new RTCIceCandidate(initializer); did not throw exception.
PASS candidate.candidate is "foo"
PASS candidate.sdpMid is "bar"
PASS candidate.sdpMLineIndex is 6
2016-09-28 13:18:37 +00:00
PASS RTCIceCandidate.prototype.toJSON is defined.
PASS Object.getOwnPropertyDescriptor(RTCIceCandidate.prototype, "toJSON").enumerable is true
PASS Object.getOwnPropertyDescriptor(RTCIceCandidate.prototype, "toJSON").writable is true
PASS Object.getOwnPropertyDescriptor(RTCIceCandidate.prototype, "toJSON").configurable is true
PASS RTCIceCandidate.prototype.toJSON.length is 0
PASS RTCIceCandidate.prototype.toJSON.name is "toJSON"
PASS Object.getOwnPropertyDescriptor(jsonMap, "candidate").enumerable is true
PASS Object.getOwnPropertyDescriptor(jsonMap, "candidate").writable is true
PASS Object.getOwnPropertyDescriptor(jsonMap, "candidate").configurable is true
PASS childCandidate.toJSON(); threw exception TypeError: Can only call RTCIceCandidate.toJSON on instances of RTCIceCandidate.
2020-09-14 17:21:50 +00:00
PASS JSON.stringify(candidate.toJSON()) is "{\"candidate\":\"foo\",\"sdpMLineIndex\":6,\"sdpMid\":\"bar\",\"usernameFragment\":null}"
PASS JSON.stringify(candidate.toJSON()) is "{\"candidate\":\"foo\",\"sdpMLineIndex\":6,\"sdpMid\":\"bar\",\"usernameFragment\":null}"
PASS JSON.stringify(candidate.toJSON()) is "{\"candidate\":\"foo\",\"sdpMLineIndex\":6,\"sdpMid\":\"bar\",\"usernameFragment\":null}"
PASS JSON.stringify(candidate.toJSON()) is "{\"candidate\":\"foo\",\"sdpMLineIndex\":6,\"sdpMid\":\"bar\",\"usernameFragment\":null}"
PASS JSON.stringify(candidate.toJSON()) is "{\"candidate\":\"foo\",\"sdpMLineIndex\":6,\"sdpMid\":\"bar\",\"usernameFragment\":null}"
2016-03-17 10:52:20 +00:00
2016-05-24 21:03:51 +00:00
Attributes are readonly
candidate.candidate = "foo-updated"
PASS candidate.candidate is "foo"
candidate.sdpMid = "bar-updated"
PASS candidate.sdpMid is "bar"
candidate.sdpMLineIndex = 7
PASS candidate.sdpMLineIndex is 6
Dictionary argument is mandatory.
PASS new RTCIceCandidate(); threw exception TypeError: Not enough arguments.
2016-06-21 04:51:49 +00:00
One of the 'sdpMid' or 'sdpMLineIndex' members must be present (and not null or undefined).
2020-09-02 16:19:52 +00:00
PASS new RTCIceCandidate({candidate:"foo"}); threw exception TypeError: Candidate must not have both null sdpMid and sdpMLineIndex.
PASS new RTCIceCandidate({candidate:"foo", sdpMid: null}); threw exception TypeError: Candidate must not have both null sdpMid and sdpMLineIndex.
PASS new RTCIceCandidate({candidate:"foo", sdpMid: undefined}); threw exception TypeError: Candidate must not have both null sdpMid and sdpMLineIndex.
PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex: null}); threw exception TypeError: Candidate must not have both null sdpMid and sdpMLineIndex.
PASS new RTCIceCandidate({candidate:"foo", sdpMLineIndex: undefined}); threw exception TypeError: Candidate must not have both null sdpMid and sdpMLineIndex.
PASS new RTCIceCandidate({candidate:"foo", sdpMid: null, sdpMLineIndex: null}); threw exception TypeError: Candidate must not have both null sdpMid and sdpMLineIndex.
PASS new RTCIceCandidate({candidate:"foo", sdpMid: undefined, sdpMLineIndex: undefined}); threw exception TypeError: Candidate must not have both null sdpMid and sdpMLineIndex.
2016-06-21 04:51:49 +00:00
Test that sdpMid or sdpMLineIndex explicitly set to null or undefined, results in a null value.
PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid: null, sdpMLineIndex: 1}); did not throw exception.
PASS candidate.sdpMid is null
PASS candidate.sdpMLineIndex is 1
PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid: undefined, sdpMLineIndex: 1}); did not throw exception.
PASS candidate.sdpMid is null
PASS candidate.sdpMLineIndex is 1
PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid: "foo", sdpMLineIndex: null}); did not throw exception.
PASS candidate.sdpMid is 'foo'
PASS candidate.sdpMLineIndex is null
PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid: "foo", sdpMLineIndex: undefined}); did not throw exception.
PASS candidate.sdpMid is 'foo'
PASS candidate.sdpMLineIndex is null
2016-03-17 10:52:20 +00:00
When one of the 'sdpMid' or 'sdpMLineIndex' members is set, the other must be null.
PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMid:"bar"}); did not throw exception.
PASS candidate.sdpMid is "bar"
PASS candidate.sdpMLineIndex is null
PASS candidate = new RTCIceCandidate({candidate:"foo", sdpMLineIndex:6}); did not throw exception.
PASS candidate.sdpMid is null
PASS candidate.sdpMLineIndex is 6
Remove uses of Dictionary in WebRTC IDL files
https://bugs.webkit.org/show_bug.cgi?id=165736
Reviewed by Sam Weinig.
Source/WebCore:
Also removed quite a bit of unused code. There were some mocks that were out of date and
no longer matched the types used in the real code, that also were no longer hooked up,
and other types of dead code. We will have to implement anew when we want to restore tests
like the ones these were intended to enable.
* CMakeLists.txt: Updated for all the removed files.
* Modules/mediastream/MediaEndpointPeerConnection.cpp: Moved some types in here
that don't need to be in the header.
(WebCore::MediaEndpointPeerConnection::MediaEndpointPeerConnection): Use make_unique.
(WebCore::MediaEndpointPeerConnection::setConfiguration): Changed argument type,
obviating the need for most of the code that was here.
* Modules/mediastream/MediaEndpointPeerConnection.h: Updated for the above. Made more
things private and final. Marked the constructor explicit. Removed unneeded includes.
* Modules/mediastream/PeerConnectionBackend.h: Removed unneeded includes and forward
declarations. Changed the argument type for setConfiguration (see above).
* Modules/mediastream/RTCConfiguration.cpp: Removed.
None of the code here was needed except for the ICE server validation, and that was
moved into RTCPeerConnection::setConfiguration.
* Modules/mediastream/RTCConfiguration.h: Changed this from a class to a struct since
this is now a dictionary rather than an interface.
* Modules/mediastream/RTCConfiguration.idl: Changed this from an interface to a dictionary.
* Modules/mediastream/RTCDTMFSender.cpp: Removed some of the code from this file. This
class currently isn't implemented, but was depending on RTCPeerConnectionHandler. I removed
some of the dead code. Someone will have to straighten this out so we can turn it back on.
* Modules/mediastream/RTCDTMFSender.h: Ditto.
* Modules/mediastream/RTCDataChannel.cpp: Updated includes.
* Modules/mediastream/RTCIceCandidate.cpp:
(WebCore::RTCIceCandidate::create): Removed most of the code, since this now takes
a structure rather than a WebCore::Dictionary, and so the bindings take care of the work.
* Modules/mediastream/RTCIceCandidate.h: Updated for the above.
* Modules/mediastream/RTCIceCandidate.idl: Changed the constructor to take a
RTCIceCandidateInit instead of a Dictionary.
* Modules/mediastream/RTCIceServer.h: Changed this from a class to a struct since
this is now a dictionary rather than an interface.
* Modules/mediastream/RTCIceServer.idl: Changed this from an interface to a dictionary.
* Modules/mediastream/RTCPeerConnection.cpp:
(WebCore::RTCPeerConnection::initializeWith): Take an RTCConfiguration rather than
a Dictionary.
(WebCore::RTCPeerConnection::getConfiguration): Moved to header, now an inline.
(WebCore::RTCPeerConnection::setConfiguration): Use the configuration dictionary now instead
of the configuration class. Also moved validation of server URLs here, formerly in the
RTCConfiguration RTCConfiguration::initialize function. Also moved code to convert from
RTCConfiguration to MediaEndpointConfiguration here, formerly in
MediaEndpointPeerConnection::setConfiguration.
* Modules/mediastream/RTCPeerConnection.h: Updated for the above.
* Modules/mediastream/RTCPeerConnection.idl: Changed argument to initializeWith and
setConfiguration from Dictionary to RTCConfiguration.
* Modules/mediastream/RTCSessionDescription.cpp:
(WebCore::parseTypeString): Deleted.
(WebCore::RTCSessionDescription::create): Changed to take struct instead of Dictionary.
* Modules/mediastream/RTCSessionDescription.h: Added Init struct and changed create to
take it.
* Modules/mediastream/RTCSessionDescription.idl: Changed constructor argument to take
RTCSessionDescriptionInit dictionary instead of Dictionary.
* Modules/webaudio/MediaStreamAudioDestinationNode.cpp: Updated includes.
* WebCore.xcodeproj/project.pbxproj: Updated for all the removed files.
* bindings/scripts/CodeGeneratorJS.pm:
(GenerateDictionaryImplementationContent): Fixed convertDictionaryToJS to work with other
nullable types besides RefPtr.
* bindings/scripts/test/JS/JSTestObj.cpp: Regenerated.
* platform/mediastream/RTCConfigurationPrivate.h: Removed.
* platform/mediastream/RTCIceServerPrivate.h: Removed.
* platform/mediastream/RTCPeerConnectionHandler.cpp: Removed.
* platform/mediastream/RTCPeerConnectionHandler.h: Removed.
* platform/mock/RTCDTMFSenderHandlerMock.cpp: Removed.
* platform/mock/RTCDTMFSenderHandlerMock.h: Removed.
* platform/mock/RTCDataChannelHandlerMock.h: Updated includes, made more things private and final.
* platform/mock/RTCPeerConnectionHandlerMock.cpp: Removed.
* platform/mock/RTCPeerConnectionHandlerMock.h: Removed.
* testing/Internals.cpp:
(WebCore::Internals::Internals): Removed call to enableMockRTCPeerConnectionHandler.
(WebCore::Internals::enableMockRTCPeerConnectionHandler): Deleted.
LayoutTests:
* fast/mediastream/RTCIceCandidate-expected.txt: Regenerated; no new failures.
* fast/mediastream/RTCIceCandidate.html: Updated test to expect the WebIDL rules for parsing
unsigned short for sdpMLineIndex. The old code expected additional range checking which is
not expected behavior.
* fast/mediastream/RTCPeerConnection-expected.txt: Regenerated; no new failures.
* fast/mediastream/RTCPeerConnection.html: Updated test to not expect an exception when
iceServers is entirely omitted or when it is an empty array. This is a progression and is
closer to the specification.
* fast/mediastream/RTCPeerConnection-getConfiguration-expected.txt: Regenerated; no new failures.
* fast/mediastream/RTCPeerConnection-getConfiguration.html: Updated test to expect the username
and credential fields to round trip as missing rather than turning from missing into empty strings.
Also updated the tests to pass in sequences of strings for "urls" since they expect sequences on
the way back out. We could also test round tripping of single strings, which should go in and come
back out as individual strings, but for now I did not bother adding that to this test.
* fast/mediastream/RTCSessionDescription-expected.txt: Regenerated; some exception messages are
now more specific than they were before.
* imported/w3c/web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt:
Updated expected results. The new code correctly allows callers of the RTCPeerConnection constructor
to omit iceServers, pass undefined, or pass an empty array, as specified. Thuis change leads to
a couple tests that now correctly pass instead of failing. And it also leads to some other tests
failing that were passing before. These were passing because they expected an exception for some
other reason, however the exception was actually occurring because of incorrect handling of iceServers.
Canonical link: https://commits.webkit.org/183351@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@209695 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-12-12 02:50:06 +00:00
Conversion of sdpMLineIndex to unsigned short, following WebIDL rules without [Clamp] or [EnforceRange]
PASS (new RTCIceCandidate({candidate:"foo", sdpMLineIndex:"a"})).sdpMLineIndex is 0
PASS (new RTCIceCandidate({candidate:"foo", sdpMLineIndex:-1})).sdpMLineIndex is 65535
PASS (new RTCIceCandidate({candidate:"foo", sdpMLineIndex:65536})).sdpMLineIndex is 0
PASS (new RTCIceCandidate({candidate:"foo", sdpMLineIndex:65537})).sdpMLineIndex is 1
2016-03-17 10:52:20 +00:00
Some bad input
2016-04-27 19:40:52 +00:00
PASS new RTCIceCandidate(5); threw exception TypeError: Type error.
PASS new RTCIceCandidate("foobar"); threw exception TypeError: Type error.
2016-05-24 21:03:51 +00:00
PASS new RTCIceCandidate(candidate:""); threw exception SyntaxError: Unexpected token ':'. Expected ')' to end an argument list..
2012-08-22 19:18:34 +00:00
PASS successfullyParsed is true
TEST COMPLETE