haikuwebkit/LayoutTests/webrtc/video.html

150 lines
5.2 KiB
HTML
Raw Permalink Normal View History

[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
<!doctype html>
<html>
<head>
<meta charset="utf-8">
[WebRTC] LibWebRTC WK2 network stack is not providing correct ports for ICE candidates https://bugs.webkit.org/show_bug.cgi?id=167939 Patch by Youenn Fablet <youennf@gmail.com> on 2017-02-07 Reviewed by Sam Weinig. Source/WebCore: Test: webrtc/no-port-zero-in-upd-candidates.html * testing/MockLibWebRTCPeerConnection.cpp: (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): Adding a way to create one real PC in WTR environment. Source/WebKit2: AddressReady signalling was done by the WebProcess for UDP and ServerTCP as real async sockets in those case do not send it. But the WebProcess does not have information on the port, as it is assigned by the socket factory which is in the network process. Fixed that bug by signalling AddressReady in the network process for UDP, ServerTCP and ClientTCP. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalAddressReady): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::createUDPSocket): (WebKit::NetworkRTCProvider::createServerTCPSocket): (WebKit::NetworkRTCProvider::createClientTCPSocket): * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::LibWebRTCSocket): (WebKit::LibWebRTCSocket::signalAddressReady): LayoutTests: * webrtc/no-port-zero-in-upd-candidates.html: Added. * webrtc/no-port-zero-in-upd-candidates-expected.txt: Added. * webrtc/video.html: * webrtc/video-expected.txt: Added. Canonical link: https://commits.webkit.org/184979@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-07 20:19:09 +00:00
<title>Testing basic video exchange from offerer to receiver</title>
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
<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>
video = document.getElementById("video");
canvas = document.getElementById("canvas");
function grabFrameData(x, y, w, h)
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
{
canvas.width = video.videoWidth;
canvas.height = video.videoHeight;
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
canvas.getContext('2d').drawImage(video, x, y, w, h, x, y, w, h);
return canvas.getContext('2d').getImageData(x, y, w, h).data;
}
function testImage()
{
const data = grabFrameData(10, 325, 250, 1);
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
var index = 20;
assert_true(data[index] < 100);
assert_true(data[index + 1] < 100);
assert_true(data[index + 2] < 100);
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
index = 80;
assert_true(data[index] > 200);
assert_true(data[index + 1] > 200);
assert_true(data[index + 2] > 200);
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
index += 80;
assert_true(data[index] > 200);
assert_true(data[index + 1] > 200);
assert_true(data[index + 2] < 100);
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
}
var pc1, pc2;
promise_test(async (test) => {
if (window.testRunner)
testRunner.setUserMediaPermission(true);
const localStream = await navigator.mediaDevices.getUserMedia({video: {advanced: [{width:{min:640}}, {height:{min:480} } ]}});
const localStream2 = new MediaStream([localStream.getVideoTracks()[0]]);
if (window.internals)
assert_true(internals.pageMediaState().includes('HasActiveVideoCaptureDevice'), "Unexpected HasActiveVideoCaptureDevice");
const stream = await new Promise((resolve, reject) => {
createConnections((firstConnection) => {
pc1 = firstConnection;
const sender = firstConnection.addTrack(localStream.getVideoTracks()[0]);
sender.setStreams(localStream, localStream2);
}, (secondConnection) => {
pc2 = secondConnection;
secondConnection.ontrack = (trackEvent) => {
assert_true(trackEvent.track instanceof MediaStreamTrack);
assert_true(trackEvent.receiver instanceof RTCRtpReceiver);
assert_true(Array.isArray(trackEvent.streams), "Array.isArray() should return true");
assert_true(Object.isFrozen(trackEvent.streams), "Object.isFrozen() should return true");
assert_equals(trackEvent.streams.length, 2);
assert_equals(trackEvent.streams[0].id, localStream.id, "first stream id");
assert_equals(trackEvent.streams[1].id, localStream2.id, "second stream id");
assert_equals(trackEvent.track.id, localStream.getVideoTracks()[0].id);
assert_equals(trackEvent.track, trackEvent.streams[0].getVideoTracks()[0]);
resolve(trackEvent.streams[0]);
};
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
});
setTimeout(() => reject("Test timed out"), 5000);
});
video.srcObject = stream;
await video.play();
testImage();
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
}, "Basic video exchange");
function getCircleImageData()
{
return grabFrameData(450, 100, 150, 100);
}
async function checkVideoIsUpdated(shouldBeUpdated, count, referenceData)
{
if (count === undefined)
count = 0;
else if (count >= 20)
return Promise.reject("checkVideoIsUpdated timed out :" + shouldBeUpdated + " " + count);
if (referenceData === undefined)
referenceData = getCircleImageData();
await waitFor(200);
const newData = getCircleImageData();
if (shouldBeUpdated === (JSON.stringify(referenceData) !== JSON.stringify(newData)))
return;
await checkVideoIsUpdated(shouldBeUpdated, ++count, newData);
}
promise_test(async (test) => {
const sender = pc1.getSenders()[0];
let p = sender.getParameters();
p.encodings[0].active = false;
await sender.setParameters(p);
assert_false(sender.getParameters().encodings[0].active, "encodings[0].active should be false");
await checkVideoIsUpdated(false);
}, "Call setParameters to disable sending a given encoding");
promise_test(async (test) => {
const sender = pc1.getSenders()[0];
let p = sender.getParameters();
p.encodings[0].active = true;
await sender.setParameters(p);
assert_true(sender.getParameters().encodings[0].active, "encodings[0].active should be true");
await checkVideoIsUpdated(true);
}, "Call setParameters to reenable sending a given encoding");
promise_test(async (test) => {
const sender = pc1.getSenders()[0];
let p = sender.getParameters();
p.encodings[0].scaleResolutionDownBy = 2;
await sender.setParameters(p);
assert_equals(sender.getParameters().encodings[0].scaleResolutionDownBy, 2, "encodings[0].scaleResolutionDownBy should be 2");
assert_equals(video.videoWidth, 640);
assert_equals(video.videoHeight, 480);
let counter = 0;
while (++counter < 50 && video.videoWidth == 640)
await waitFor(200);
assert_equals(video.videoWidth, 320);
assert_equals(video.videoHeight, 240);
}, "Call setParameters to reduce size by two");
[WebRTC] Add a LibWebRTC mock for testing https://bugs.webkit.org/show_bug.cgi?id=167429 Patch by Youenn Fablet <youennf@gmail.com> on 2017-01-26 Reviewed by Alex Christensen. Source/WebCore: Covered by updated tests although feature is behind a flag, off by default. MockLibWebRTCPeerConnection will allow us testing the code above the WebRTC implementation above LibWebRTC, without reyling on it and controlling the way that the peer connections will behave. Adding support for mock factory to create real peer connections in case where we want to do full testing through the local loopback. Tests: fast/mediastream/getUserMedia-webaudio.html webrtc/datachannel/basic.html webrtc/video.html * WebCore.xcodeproj/project.pbxproj: * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::useMockRTCPeerConnectionFactory): * testing/Internals.h: * testing/Internals.idl: * testing/MockLibWebRTCPeerConnection.cpp: Added. (WebCore::useMockRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::MockLibWebRTCPeerConnectionForIceCandidates): (WebCore::MockLibWebRTCPeerConnectionForIceCandidates::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::MockLibWebRTCPeerConnectionForIceConnectionState): (WebCore::MockLibWebRTCPeerConnectionForIceConnectionState::gotLocalDescription): (WebCore::MockLibWebRTCPeerConnectionFactory::MockLibWebRTCPeerConnectionFactory): (WebCore::MockLibWebRTCPeerConnectionFactory::CreatePeerConnection): (WebCore::MockLibWebRTCPeerConnectionFactory::CreateLocalMediaStream): (WebCore::MockLibWebRTCPeerConnection::SetLocalDescription): (WebCore::MockLibWebRTCPeerConnection::SetRemoteDescription): (WebCore::MockLibWebRTCPeerConnection::CreateDataChannel): (WebCore::MockLibWebRTCPeerConnection::AddStream): (WebCore::MockLibWebRTCPeerConnection::RemoveStream): (WebCore::MockLibWebRTCPeerConnection::CreateOffer): (WebCore::MockLibWebRTCPeerConnection::CreateAnswer): * testing/MockLibWebRTCPeerConnection.h: Added. (WebCore::MockLibWebRTCPeerConnection::~MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::MockLibWebRTCPeerConnection): (WebCore::MockLibWebRTCPeerConnection::local_streams): (WebCore::MockLibWebRTCPeerConnection::remote_streams): (WebCore::MockLibWebRTCPeerConnection::CreateDtmfSender): (WebCore::MockLibWebRTCPeerConnection::GetStats): (WebCore::MockLibWebRTCPeerConnection::local_description): (WebCore::MockLibWebRTCPeerConnection::remote_description): (WebCore::MockLibWebRTCPeerConnection::AddIceCandidate): (WebCore::MockLibWebRTCPeerConnection::RegisterUMAObserver): (WebCore::MockLibWebRTCPeerConnection::signaling_state): (WebCore::MockLibWebRTCPeerConnection::ice_connection_state): (WebCore::MockLibWebRTCPeerConnection::ice_gathering_state): (WebCore::MockLibWebRTCPeerConnection::StopRtcEventLog): (WebCore::MockLibWebRTCPeerConnection::Close): (WebCore::MockLibWebRTCPeerConnection::gotLocalDescription): (WebCore::MockLibWebRTCIceCandidate::MockLibWebRTCIceCandidate): (WebCore::MockLibWebRTCAudioTrack::MockLibWebRTCAudioTrack): (WebCore::MockLibWebRTCVideoTrack::MockLibWebRTCVideoTrack): (WebCore::MockLibWebRTCDataChannel::MockLibWebRTCDataChannel): (WebCore::MockLibWebRTCPeerConnectionFactory::create): LayoutTests: * TestExpectations: Marking webrtc new tests as skipped for the moment. * fast/mediastream/RTCPeerConnection-createAnswer.html: * fast/mediastream/RTCPeerConnection-icecandidate-event.html: * fast/mediastream/RTCPeerConnection-iceconnectionstatechange-event.html: * webrtc/datachannel/basic.html: Added. * webrtc/routines.js: Added. (createConnections): (closeConnections): (onCreateSessionDescriptionError): (gotDescription1): (gotDescription2): (iceCallback1): (iceCallback2): (onAddIceCandidateSuccess): (onAddIceCandidateError): * webrtc/video.html: Added. Canonical link: https://commits.webkit.org/184528@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211253 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-27 04:54:09 +00:00
</script>
</body>
</html>