haikuwebkit/LayoutTests/webrtc/negotiatedneeded-event-addS...

49 lines
1.6 KiB
HTML
Raw Permalink Normal View History

[WebRTC] Add support for libwebrtc negotiation needed event https://bugs.webkit.org/show_bug.cgi?id=168267 Patch by Youenn Fablet <youennf@gmail.com> on 2017-02-14 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/negotiatedneeded-event-addStream.html Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend. This code handles the control of sending or not the negotiationneeded event. Updating mock to use markAsNeedingNegotiation when streams are changed. Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::markAsNeedingNegotiation): * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::isNegotiationNeeded): (WebCore::PeerConnectionBackend::clearNegotiationNeededState): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * testing/MockLibWebRTCPeerConnection.cpp: (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): LayoutTests: * fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: * platform/gtk/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: Copied from LayoutTests/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt. * webrtc/negotiatedneeded-event-addStream-expected.txt: Added. * webrtc/negotiatedneeded-event-addStream.html: Added. Canonical link: https://commits.webkit.org/185370@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-15 01:23:39 +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>
<video id="video" autoplay=""></video>
<canvas id="canvas" width="640" height="480"></canvas>
<script src ="routines.js"></script>
<script>
promise_test((test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
return new Promise((resolve, reject) => {
var pc = new RTCPeerConnection();
var count = 0;
pc.onnegotiationneeded = () => {
assert_equals(count++, 0, "Should only be called once");
setTimeout(resolve, 500);
};
pc.addTrack(stream.getVideoTracks()[0], stream);
[WebRTC] Add support for libwebrtc negotiation needed event https://bugs.webkit.org/show_bug.cgi?id=168267 Patch by Youenn Fablet <youennf@gmail.com> on 2017-02-14 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/negotiatedneeded-event-addStream.html Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend. This code handles the control of sending or not the negotiationneeded event. Updating mock to use markAsNeedingNegotiation when streams are changed. Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::markAsNeedingNegotiation): * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::isNegotiationNeeded): (WebCore::PeerConnectionBackend::clearNegotiationNeededState): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * testing/MockLibWebRTCPeerConnection.cpp: (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): LayoutTests: * fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: * platform/gtk/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: Copied from LayoutTests/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt. * webrtc/negotiatedneeded-event-addStream-expected.txt: Added. * webrtc/negotiatedneeded-event-addStream.html: Added. Canonical link: https://commits.webkit.org/185370@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-15 01:23:39 +00:00
});
});
}, "on negotiation needed in case of adding a stream");
promise_test((test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
return navigator.mediaDevices.getUserMedia({ video: true}).then((stream) => {
return new Promise((resolve, reject) => {
var pc = new RTCPeerConnection();
pc.onnegotiationneeded = () => { reject(); };
pc.addTrack(stream.getVideoTracks()[0], stream);
pc.close();
setTimeout(resolve, 500);
});
});
}, "on negotiation needed not called if pc is closed");
[WebRTC] Add support for libwebrtc negotiation needed event https://bugs.webkit.org/show_bug.cgi?id=168267 Patch by Youenn Fablet <youennf@gmail.com> on 2017-02-14 Reviewed by Eric Carlson. Source/WebCore: Test: webrtc/negotiatedneeded-event-addStream.html Moving generic code (markAsNeedingNegotiation) from MediaEndpointPeerConnection to PeerConnectionBackend. This code handles the control of sending or not the negotiationneeded event. Updating mock to use markAsNeedingNegotiation when streams are changed. Updating libwebrtc backend to call markAsNeedingNegotiation when required by libwebrtc implementation. * Modules/mediastream/MediaEndpointPeerConnection.cpp: (WebCore::MediaEndpointPeerConnection::setLocalDescriptionTask): * Modules/mediastream/MediaEndpointPeerConnection.h: * Modules/mediastream/PeerConnectionBackend.cpp: (WebCore::PeerConnectionBackend::markAsNeedingNegotiation): * Modules/mediastream/PeerConnectionBackend.h: (WebCore::PeerConnectionBackend::isNegotiationNeeded): (WebCore::PeerConnectionBackend::clearNegotiationNeededState): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::OnRenegotiationNeeded): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.h: * testing/MockLibWebRTCPeerConnection.cpp: (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): LayoutTests: * fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: * platform/gtk/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt: Copied from LayoutTests/fast/mediastream/RTCPeerConnection-more-media-to-negotiate-expected.txt. * webrtc/negotiatedneeded-event-addStream-expected.txt: Added. * webrtc/negotiatedneeded-event-addStream.html: Added. Canonical link: https://commits.webkit.org/185370@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-15 01:23:39 +00:00
</script>
</body>
</html>