haikuwebkit/LayoutTests/webrtc/connection-state.html

81 lines
3.5 KiB
HTML
Raw Permalink Normal View History

Support RTCPeerConnectionState https://bugs.webkit.org/show_bug.cgi?id=169978 Patch by Youenn Fablet <youenn@apple.com> on 2017-03-22 Reviewed by Jon Lee. LayoutTests/imported/w3c: * web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt: Source/WebCore: Test: webrtc/connection-state.html Implementing https://www.w3.org/TR/webrtc/#rtcpeerconnectionstate-enum. Its state and event is based on changes made to ice gathering state and ice connection state. * CMakeLists.txt: Adding RTCPeerConnectionState idl. * DerivedSources.make: Ditto. * Modules/mediastream/RTCPeerConnection.cpp: Splitting close in doClose/doStop so that we can send closed event in case close is called, but not if stopped. (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::close): (WebCore::RTCPeerConnection::stop): (WebCore::RTCPeerConnection::doStop): (WebCore::RTCPeerConnection::updateIceGatheringState): (WebCore::RTCPeerConnection::updateIceConnectionState): (WebCore::RTCPeerConnection::updateConnectionState): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: Fixing IDL and minor cosmetic changes * Modules/mediastream/RTCPeerConnection.js: (setLocalDescription): Cosmetic change. (setRemoteDescription): * Modules/mediastream/RTCPeerConnectionState.idl: Added. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnIceGatheringChange): Adding 'gathering' state * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCPeerConnectionState.h: Added. LayoutTests: * webrtc/connection-state-expected.txt: Added. * webrtc/connection-state.html: Added. * webrtc/rtcpeerconnection-error-messages-expected.txt: Canonical link: https://commits.webkit.org/186920@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214293 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-23 02:44:57 +00:00
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing basic video exchange from offerer to receiver</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script src ="routines.js"></script>
<script>
promise_test((test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
var firstConnection, secondConnection;
var localConnectionStates = ["new"];
var remoteConnectionStates = ["new"];
var localIceConnectionStates = ["new"];
var remoteIceConnectionStates = ["new"];
var localGatheringStates = ["new"];
var remoteGatheringStates = ["new"];
return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
return new Promise((resolve, reject) => {
createConnections((connection) => {
firstConnection = connection;
firstConnection.addTrack(stream.getVideoTracks()[0], stream);
assert_equals(firstConnection.connectionState, "new");
firstConnection.onconnectionstatechange = () => {
localConnectionStates.push(firstConnection.connectionState);
}
firstConnection.onicegatheringstatechange = () => {
localGatheringStates.push(firstConnection.iceGatheringState);
}
firstConnection.oniceconnectionstatechange = () => {
localIceConnectionStates.push(firstConnection.iceConnectionState);
}
}, (connection) => {
secondConnection = connection;
assert_equals(secondConnection.connectionState, "new");
secondConnection.onconnectionstatechange = () => {
remoteConnectionStates.push(secondConnection.connectionState);
}
secondConnection.onicegatheringstatechange = () => {
remoteGatheringStates.push(secondConnection.iceGatheringState);
}
secondConnection.oniceconnectionstatechange = () => {
remoteIceConnectionStates.push(secondConnection.iceConnectionState);
}
secondConnection.ontrack = (trackEvent) => {
resolve(trackEvent.streams[0]);
};
});
setTimeout(() => reject("Test timed out"), 5000);
});
}).then((stream) => {
return waitFor(500);
}).then(() => {
assert_array_equals(localConnectionStates, ["new", "connecting", "connected"]);
assert_array_equals(remoteConnectionStates, ["new", "connecting", "connected"]);
assert_array_equals(localGatheringStates, ["new", "gathering", "complete"]);
assert_array_equals(remoteGatheringStates, ["new", "gathering", "complete"]);
assert_array_equals(localIceConnectionStates, ["new", "checking", "connected", "completed"]);
assert_array_equals(remoteIceConnectionStates, ["new", "checking", "connected"]);
});
}, "Checking various connection state for video exchange");
promise_test((test) => {
return new Promise((resolve, reject) => {
var pc = new RTCPeerConnection();
pc.onconnectionstatechange = () => {
Remove RTCSignalingState::Closed https://bugs.webkit.org/show_bug.cgi?id=170811 Patch by Youenn Fablet <youenn@apple.com> on 2017-04-13 Reviewed by Eric Carlson. Source/WebCore: Covered by existing and rebased tests. Adding RTCPeerConnection::isClosed to better match the isClosed internal slot in webrtc specification. Using isClosed instead of checking signalingState value. Implementing isClosed in terms of m_connectionState which has a Closed value. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): (WebCore::MediaEndpointPeerConnection::replaceTrackTask): * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOffer): (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createOfferFailed): (WebCore::PeerConnectionBackend::createAnswer): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::createAnswerFailed): (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded): (WebCore::PeerConnectionBackend::setLocalDescriptionFailed): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded): (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed): (WebCore::PeerConnectionBackend::addIceCandidate): (WebCore::PeerConnectionBackend::addIceCandidateSucceeded): (WebCore::PeerConnectionBackend::addIceCandidateFailed): * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::create): (WebCore::RTCPeerConnection::RTCPeerConnection): (WebCore::RTCPeerConnection::addTrack): (WebCore::RTCPeerConnection::removeTrack): (WebCore::RTCPeerConnection::queuedCreateOffer): (WebCore::RTCPeerConnection::queuedCreateAnswer): (WebCore::RTCPeerConnection::queuedSetLocalDescription): (WebCore::RTCPeerConnection::queuedSetRemoteDescription): (WebCore::RTCPeerConnection::queuedAddIceCandidate): (WebCore::RTCPeerConnection::setConfiguration): (WebCore::RTCPeerConnection::createDataChannel): (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::updateIceGatheringState): (WebCore::RTCPeerConnection::updateIceConnectionState): (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::signalingState): * platform/mediastream/RTCSignalingState.h: LayoutTests: * webrtc/connection-state.html: Canonical link: https://commits.webkit.org/187745@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-13 18:28:29 +00:00
assert_unreached();
Support RTCPeerConnectionState https://bugs.webkit.org/show_bug.cgi?id=169978 Patch by Youenn Fablet <youenn@apple.com> on 2017-03-22 Reviewed by Jon Lee. LayoutTests/imported/w3c: * web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt: Source/WebCore: Test: webrtc/connection-state.html Implementing https://www.w3.org/TR/webrtc/#rtcpeerconnectionstate-enum. Its state and event is based on changes made to ice gathering state and ice connection state. * CMakeLists.txt: Adding RTCPeerConnectionState idl. * DerivedSources.make: Ditto. * Modules/mediastream/RTCPeerConnection.cpp: Splitting close in doClose/doStop so that we can send closed event in case close is called, but not if stopped. (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::close): (WebCore::RTCPeerConnection::stop): (WebCore::RTCPeerConnection::doStop): (WebCore::RTCPeerConnection::updateIceGatheringState): (WebCore::RTCPeerConnection::updateIceConnectionState): (WebCore::RTCPeerConnection::updateConnectionState): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: Fixing IDL and minor cosmetic changes * Modules/mediastream/RTCPeerConnection.js: (setLocalDescription): Cosmetic change. (setRemoteDescription): * Modules/mediastream/RTCPeerConnectionState.idl: Added. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnIceGatheringChange): Adding 'gathering' state * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCPeerConnectionState.h: Added. LayoutTests: * webrtc/connection-state-expected.txt: Added. * webrtc/connection-state.html: Added. * webrtc/rtcpeerconnection-error-messages-expected.txt: Canonical link: https://commits.webkit.org/186920@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214293 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-23 02:44:57 +00:00
};
pc.close();
Remove RTCSignalingState::Closed https://bugs.webkit.org/show_bug.cgi?id=170811 Patch by Youenn Fablet <youenn@apple.com> on 2017-04-13 Reviewed by Eric Carlson. Source/WebCore: Covered by existing and rebased tests. Adding RTCPeerConnection::isClosed to better match the isClosed internal slot in webrtc specification. Using isClosed instead of checking signalingState value. Implementing isClosed in terms of m_connectionState which has a Closed value. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): (WebCore::MediaEndpointPeerConnection::replaceTrackTask): * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::createOffer): (WebCore::PeerConnectionBackend::createOfferSucceeded): (WebCore::PeerConnectionBackend::createOfferFailed): (WebCore::PeerConnectionBackend::createAnswer): (WebCore::PeerConnectionBackend::createAnswerSucceeded): (WebCore::PeerConnectionBackend::createAnswerFailed): (WebCore::PeerConnectionBackend::setLocalDescription): (WebCore::PeerConnectionBackend::setLocalDescriptionSucceeded): (WebCore::PeerConnectionBackend::setLocalDescriptionFailed): (WebCore::PeerConnectionBackend::setRemoteDescription): (WebCore::PeerConnectionBackend::setRemoteDescriptionSucceeded): (WebCore::PeerConnectionBackend::setRemoteDescriptionFailed): (WebCore::PeerConnectionBackend::addIceCandidate): (WebCore::PeerConnectionBackend::addIceCandidateSucceeded): (WebCore::PeerConnectionBackend::addIceCandidateFailed): * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::create): (WebCore::RTCPeerConnection::RTCPeerConnection): (WebCore::RTCPeerConnection::addTrack): (WebCore::RTCPeerConnection::removeTrack): (WebCore::RTCPeerConnection::queuedCreateOffer): (WebCore::RTCPeerConnection::queuedCreateAnswer): (WebCore::RTCPeerConnection::queuedSetLocalDescription): (WebCore::RTCPeerConnection::queuedSetRemoteDescription): (WebCore::RTCPeerConnection::queuedAddIceCandidate): (WebCore::RTCPeerConnection::setConfiguration): (WebCore::RTCPeerConnection::createDataChannel): (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::updateIceGatheringState): (WebCore::RTCPeerConnection::updateIceConnectionState): (WebCore::RTCPeerConnection::scheduleNegotiationNeededEvent): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::signalingState): * platform/mediastream/RTCSignalingState.h: LayoutTests: * webrtc/connection-state.html: Canonical link: https://commits.webkit.org/187745@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215327 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-04-13 18:28:29 +00:00
setTimeout(resolve, 200);
Support RTCPeerConnectionState https://bugs.webkit.org/show_bug.cgi?id=169978 Patch by Youenn Fablet <youenn@apple.com> on 2017-03-22 Reviewed by Jon Lee. LayoutTests/imported/w3c: * web-platform-tests/webrtc/rtcpeerconnection/rtcpeerconnection-constructor-expected.txt: Source/WebCore: Test: webrtc/connection-state.html Implementing https://www.w3.org/TR/webrtc/#rtcpeerconnectionstate-enum. Its state and event is based on changes made to ice gathering state and ice connection state. * CMakeLists.txt: Adding RTCPeerConnectionState idl. * DerivedSources.make: Ditto. * Modules/mediastream/RTCPeerConnection.cpp: Splitting close in doClose/doStop so that we can send closed event in case close is called, but not if stopped. (WebCore::RTCPeerConnection::doClose): (WebCore::RTCPeerConnection::close): (WebCore::RTCPeerConnection::stop): (WebCore::RTCPeerConnection::doStop): (WebCore::RTCPeerConnection::updateIceGatheringState): (WebCore::RTCPeerConnection::updateIceConnectionState): (WebCore::RTCPeerConnection::updateConnectionState): * Modules/mediastream/RTCPeerConnection.h: * Modules/mediastream/RTCPeerConnection.idl: Fixing IDL and minor cosmetic changes * Modules/mediastream/RTCPeerConnection.js: (setLocalDescription): Cosmetic change. (setRemoteDescription): * Modules/mediastream/RTCPeerConnectionState.idl: Added. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnIceGatheringChange): Adding 'gathering' state * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCPeerConnectionState.h: Added. LayoutTests: * webrtc/connection-state-expected.txt: Added. * webrtc/connection-state.html: Added. * webrtc/rtcpeerconnection-error-messages-expected.txt: Canonical link: https://commits.webkit.org/186920@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214293 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-23 02:44:57 +00:00
})
}, "Checking connection state event when closing peer connetion");
</script>
</body>
</html>