haikuwebkit/LayoutTests/webrtc/datachannel/basic.html

166 lines
5.8 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">
<title>Testing basic data channel 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>
var localChannel;
var remoteChannel;
function closeDataChannels() {
localChannel.close();
remoteChannel.close();
closeConnections();
}
function receiveMessages(event) {
try {
[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
if (++counter === 1)
assert_equals(event.data, "one");
else if (counter === 2)
assert_equals(event.data, "two");
else if (counter === 3)
assert_equals(event.data, "three");
else if (counter === 4) {
assert_equals(event.data, "four");
closeDataChannels();
finishTest();
} else
assert_unreached();
} catch(e) {
console.log(e);
}
[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
}
function sendMessages(channel)
{
channel.send("one");
channel.send("two");
channel.send("three");
channel.send("four");
}
var finishTest;
promise_test((test) => {
counter = 0;
return new Promise((resolve, reject) => {
finishTest = resolve;
createConnections((localConnection) => {
localChannel = localConnection.createDataChannel('sendDataChannel');
localChannel.onopen = () => { sendMessages(localChannel) };
}, (remoteConnection) => {
remoteConnection.ondatachannel = (event) => {
remoteChannel = event.channel;
remoteChannel.onmessage = receiveMessages;
};
});
setTimeout(() => { reject("Test timed out"); }, 5000);
[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 data channel exchange from offerer to receiver");
promise_test((test) => {
counter = 0;
return new Promise((resolve, reject) => {
finishTest = resolve;
createConnections((localConnection) => {
localChannel = localConnection.createDataChannel('sendDataChannel');
localChannel.onmessage = receiveMessages;
}, (remoteConnection) => {
remoteConnection.ondatachannel = (event) => {
remoteChannel = event.channel;
remoteChannel.onopen = () => { sendMessages(remoteChannel) };
};
});
setTimeout(() => { reject("Test timed out"); }, 5000);
[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 data channel exchange from receiver to offerer");
[WebRTC] Add support for libwebrtc TCP incoming connections https://bugs.webkit.org/show_bug.cgi?id=168748 Patch by Youenn Fablet <youenn@apple.com> on 2017-02-27 Reviewed by Alex Christensen. Source/WebKit2: Covered by added layout tests. When a libwebrtc server socket is signalling a new connnection through SignalNewConnection, we do: - Wrap the incoming socket into a LibWebRTCSocketClient - Store it into a pending socket map with an identifier - Send a message to the web process of a new connection with the server socket identifier and new connection socket identifier. The Web process then creates a WebRTCSocket wrapper around it by sendinig a WrapNewTCPConnection message. It then propagates the SignalNewConnection to libwebrtc code path. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalNewConnection): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::newConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: * WebProcess/Network/webrtc/WebRTCSocket.cpp: (WebKit::WebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/WebRTCSocket.h: * WebProcess/Network/webrtc/WebRTCSocket.messages.in: LayoutTests: * webrtc/datachannel/basic-expected.txt: Added. * webrtc/datachannel/basic.html: * webrtc/routines.js: (createConnections): (iceCallback1): (iceCallback2): Canonical link: https://commits.webkit.org/185936@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 01:10:39 +00:00
[WebRTC] Add support for libwebrtc TCP incoming connections https://bugs.webkit.org/show_bug.cgi?id=168748 Patch by Youenn Fablet <youenn@apple.com> on 2017-02-27 Reviewed by Alex Christensen. Source/WebKit2: Covered by added layout tests. When a libwebrtc server socket is signalling a new connnection through SignalNewConnection, we do: - Wrap the incoming socket into a LibWebRTCSocketClient - Store it into a pending socket map with an identifier - Send a message to the web process of a new connection with the server socket identifier and new connection socket identifier. The Web process then creates a WebRTCSocket wrapper around it by sendinig a WrapNewTCPConnection message. It then propagates the SignalNewConnection to libwebrtc code path. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalNewConnection): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::newConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: * WebProcess/Network/webrtc/WebRTCSocket.cpp: (WebKit::WebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/WebRTCSocket.h: * WebProcess/Network/webrtc/WebRTCSocket.messages.in: LayoutTests: * webrtc/datachannel/basic-expected.txt: Added. * webrtc/datachannel/basic.html: * webrtc/routines.js: (createConnections): (iceCallback1): (iceCallback2): Canonical link: https://commits.webkit.org/185936@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 01:10:39 +00:00
promise_test((test) => {
counter = 0;
return new Promise((resolve, reject) => {
finishTest = resolve;
createConnections((localConnection) => {
localChannel = localConnection.createDataChannel('sendDataChannel');
localChannel.onopen = () => { sendMessages(localChannel) };
}, (remoteConnection) => {
remoteConnection.ondatachannel = (event) => {
remoteChannel = event.channel;
remoteChannel.onmessage = receiveMessages;
};
Clean up RTCDataChannel https://bugs.webkit.org/show_bug.cgi?id=169732 LayoutTests/imported/w3c: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt: Source/JavaScriptCore: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent. Source/WebCore: Patch by Youenn Fablet <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30 Reviewed by Chris Dumez. Test: webrtc/datachannel/datachannel-event.html webrtc/datachannel/bufferedAmountLowThreshold.html Making RTCDataChannel interface closer to the spec updating implementation accordingly. See https://w3c.github.io/webrtc-pc/#rtcdatachannel. In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes. Doing some additional cleaning refactoring. Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by libwebrtc without needing to get it from the libwebrtc network thread again. In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be updated to increase in the send method. Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): (WebCore::RTCDataChannel::close): (WebCore::RTCDataChannel::didChangeReadyState): (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::channel): * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::OnStateChange): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addDataChannel): * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelState.h: Added. * platform/mediastream/RTCPeerConnectionHandlerClient.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::setClient): (WebCore::RTCDataChannelHandlerMock::close): * platform/mock/RTCNotifiersMock.cpp: (WebCore::IceConnectionNotifier::IceConnectionNotifier): (WebCore::SignalingStateNotifier::SignalingStateNotifier): (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): * platform/mock/RTCNotifiersMock.h: LayoutTests: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold.html: Added. Canonical link: https://commits.webkit.org/187223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-30 21:42:19 +00:00
}, { filterOutICECandidate: (candidate) => { return candidate && candidate.candidate.toLowerCase().indexOf("udp") == -1; } });
setTimeout(() => { reject("Test timed out"); }, 5000);
[WebRTC] Add support for libwebrtc TCP incoming connections https://bugs.webkit.org/show_bug.cgi?id=168748 Patch by Youenn Fablet <youenn@apple.com> on 2017-02-27 Reviewed by Alex Christensen. Source/WebKit2: Covered by added layout tests. When a libwebrtc server socket is signalling a new connnection through SignalNewConnection, we do: - Wrap the incoming socket into a LibWebRTCSocketClient - Store it into a pending socket map with an identifier - Send a message to the web process of a new connection with the server socket identifier and new connection socket identifier. The Web process then creates a WebRTCSocket wrapper around it by sendinig a WrapNewTCPConnection message. It then propagates the SignalNewConnection to libwebrtc code path. * NetworkProcess/webrtc/LibWebRTCSocketClient.cpp: (WebKit::LibWebRTCSocketClient::LibWebRTCSocketClient): (WebKit::LibWebRTCSocketClient::signalReadPacket): (WebKit::LibWebRTCSocketClient::signalSentPacket): (WebKit::LibWebRTCSocketClient::signalNewConnection): (WebKit::LibWebRTCSocketClient::signalAddressReady): (WebKit::LibWebRTCSocketClient::signalConnect): (WebKit::LibWebRTCSocketClient::signalClose): * NetworkProcess/webrtc/LibWebRTCSocketClient.h: * NetworkProcess/webrtc/NetworkRTCProvider.cpp: (WebKit::NetworkRTCProvider::wrapNewTCPConnection): (WebKit::NetworkRTCProvider::newConnection): * NetworkProcess/webrtc/NetworkRTCProvider.h: * NetworkProcess/webrtc/NetworkRTCProvider.messages.in: * WebProcess/Network/webrtc/LibWebRTCSocket.cpp: (WebKit::LibWebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/LibWebRTCSocket.h: * WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp: (WebKit::LibWebRTCSocketFactory::createNewConnectionSocket): * WebProcess/Network/webrtc/LibWebRTCSocketFactory.h: * WebProcess/Network/webrtc/WebRTCSocket.cpp: (WebKit::WebRTCSocket::signalNewConnection): * WebProcess/Network/webrtc/WebRTCSocket.h: * WebProcess/Network/webrtc/WebRTCSocket.messages.in: LayoutTests: * webrtc/datachannel/basic-expected.txt: Added. * webrtc/datachannel/basic.html: * webrtc/routines.js: (createConnections): (iceCallback1): (iceCallback2): Canonical link: https://commits.webkit.org/185936@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@213104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-02-28 01:10:39 +00:00
});
}, "Basic data channel exchange from offerer to receiver using UDP only");
promise_test((test) => {
counter = 0;
return new Promise((resolve, reject) => {
var checkDataChannelOptions = (channel, init) => {
assert_equals(channel.ordered, init.ordered, "ordered");
assert_equals(channel.maxPacketLifeTime, init.maxPacketLifeTime, "maxPacketLifeTime");
assert_equals(channel.maxRetransmitTime, init.maxRetransmitTime, "maxRetransmitTime");
assert_equals(channel.maxRetransmits, init.maxRetransmits, "maxRetransmits");
assert_equals(channel.protocol, init.protocol, "protocol");
assert_equals(channel.negotiated, init.negotiated, "negotiated");
assert_equals(channel.id, init.id, "id");
};
finishTest = resolve;
createConnections((localConnection) => {
Clean up RTCDataChannel https://bugs.webkit.org/show_bug.cgi?id=169732 LayoutTests/imported/w3c: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * web-platform-tests/webrtc/RTCDataChannelEvent-constructor-expected.txt: Source/JavaScriptCore: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * runtime/CommonIdentifiers.h: Adding RTCDataChannelEvent. Source/WebCore: Patch by Youenn Fablet <youenn@apple.com> and Jon Lee <jonlee@apple.com> on 2017-03-30 Reviewed by Chris Dumez. Test: webrtc/datachannel/datachannel-event.html webrtc/datachannel/bufferedAmountLowThreshold.html Making RTCDataChannel interface closer to the spec updating implementation accordingly. See https://w3c.github.io/webrtc-pc/#rtcdatachannel. In particular adding RTCDataChannelEvent constructor, and missing bufferedAmount related attributes. Doing some additional cleaning refactoring. Making bufferedAmountIsDecreasing take a bufferedAmount argument so that we get the actual value passed by libwebrtc without needing to get it from the libwebrtc network thread again. In the future, we should store the bufferedAmount value in RTCDataChannel and update its value on each libwebrtc OnBufferedAmountChange. Special treatment may be needed when the data channel is closed, in which case the bufferedAmount should just be updated to increase in the send method. Added some FIXMEs as RTCDataChannel is not aligned with the spec related to send and bufferedAmount. * Modules/mediastream/RTCDataChannel.cpp: (WebCore::RTCDataChannel::send): (WebCore::RTCDataChannel::close): (WebCore::RTCDataChannel::didChangeReadyState): (WebCore::RTCDataChannel::bufferedAmountIsDecreasing): * Modules/mediastream/RTCDataChannel.h: * Modules/mediastream/RTCDataChannel.idl: * Modules/mediastream/RTCDataChannelEvent.cpp: (WebCore::RTCDataChannelEvent::create): (WebCore::RTCDataChannelEvent::RTCDataChannelEvent): (WebCore::RTCDataChannelEvent::channel): * Modules/mediastream/RTCDataChannelEvent.h: * Modules/mediastream/RTCDataChannelEvent.idl: * Modules/mediastream/RTCPeerConnection.idl: * Modules/mediastream/libwebrtc/LibWebRTCDataChannelHandler.cpp: (WebCore::LibWebRTCDataChannelHandler::OnStateChange): * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: (WebCore::LibWebRTCMediaEndpoint::addDataChannel): * WebCore.xcodeproj/project.pbxproj: * dom/EventNames.h: * platform/mediastream/RTCDataChannelHandler.h: * platform/mediastream/RTCDataChannelHandlerClient.h: * platform/mediastream/RTCDataChannelState.h: Added. * platform/mediastream/RTCPeerConnectionHandlerClient.h: * platform/mock/RTCDataChannelHandlerMock.cpp: (WebCore::RTCDataChannelHandlerMock::setClient): (WebCore::RTCDataChannelHandlerMock::close): * platform/mock/RTCNotifiersMock.cpp: (WebCore::IceConnectionNotifier::IceConnectionNotifier): (WebCore::SignalingStateNotifier::SignalingStateNotifier): (WebCore::DataChannelStateNotifier::DataChannelStateNotifier): * platform/mock/RTCNotifiersMock.h: LayoutTests: Patch by Youenn Fablet <youenn@apple.com> on 2017-03-30 Reviewed by Chris Dumez. * webrtc/datachannel/bufferedAmountLowThreshold-expected.txt: Added. * webrtc/datachannel/bufferedAmountLowThreshold.html: Added. Canonical link: https://commits.webkit.org/187223@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@214627 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-03-30 21:42:19 +00:00
var init = { ordered: true, maxPacketLifeTime: 10, maxRetransmitTime: 11, protocol: "whatever", negotiated: false, id: 1 };
localChannel = localConnection.createDataChannel('sendDataChannel', init);
localChannel.onopen = () => { sendMessages(localChannel) };
}, (remoteConnection) => {
remoteConnection.ondatachannel = (event) => {
remoteChannel = event.channel;
remoteChannel.onmessage = receiveMessages;
};
});
setTimeout(() => { reject("Test timed out"); }, 5000);
});
Update testharness.js from upstream https://bugs.webkit.org/show_bug.cgi?id=201808 Reviewed by Darin Adler. LayoutTests/imported/w3c: Update existing layout tests so that they are compatible with this new version of testharness.js. * IndexedDB-private-browsing/idbdatabase_createObjectStore9-invalidparameters.html: * IndexedDB-private-browsing/idbobjectstore_deleted.html: * web-platform-tests/custom-elements/resources/custom-elements-helpers.js: (create_window_in_test): LayoutTests: Update testharness.js from upstream 6fd5e1e086ce590a4780a30d12968. Update existing layout tests so that they are compatible with this new version of testharness.js. * TestExpectations: * css-custom-properties-api/length-expected.txt: * css-custom-properties-api/length.html: * css-custom-properties-api/registerProperty.html: * css-dark-mode/older-systems/color-scheme-css-expected.txt: * css-dark-mode/older-systems/color-scheme-css.html: * css-dark-mode/older-systems/color-scheme-meta-expected.txt: * css-dark-mode/older-systems/color-scheme-meta.html: * css3/flexbox/style-change-expected.txt: * fast/css/DOMQuad-serialization.html: * fast/css/Element-style.html: * fast/css/parse-justify-self-expected.txt: * fast/css/parse-justify-self.html: * fast/events/clipboard-event-constructor-expected.txt: * fast/events/clipboard-event-constructor.html: * fast/media/mq-js-update-media-expected.txt: * fast/media/mq-js-update-media.html: * fast/mediacapturefromelement/CanvasCaptureMediaStream-offscreencanvas-expected.txt: * fast/mediastream/captureStream/canvas2d-expected.txt: * fast/mediastream/captureStream/canvas2d-heavy-drawing.html: * fast/mediastream/captureStream/canvas2d.html: * fast/shadow-dom/event-path-with-window-expected.txt: * fast/shadow-dom/event-path-with-window.html: * fast/shadow-dom/offsetParent-across-shadow-boundaries-expected.txt: * fast/shadow-dom/offsetParent-across-shadow-boundaries.html: * fast/shadow-dom/slotchange-for-slot-mutation-expected.txt: * fast/shadow-dom/slotchange-for-slot-mutation.html: * fast/shadow-dom/stylesheet-title-in-shadow-tree-expected.txt: * fast/shadow-dom/stylesheet-title-in-shadow-tree.html: * http/tests/fetch/redirectmode-and-preload-expected.txt: * http/tests/fetch/redirectmode-and-preload.html: * imported/blink/editing/selection/selectstart-event-crash-expected.txt: * js/promises-tests/promises-in-workers-expected.txt: * js/promises-tests/promises-in-workers.js: * resources/check-layout-th.js: (window.checkLayout): * resources/testharness.js: (WindowTestEnvironment): (WindowTestEnvironment.prototype._dispatch): (WindowTestEnvironment.prototype._forEach_windows): (WindowTestEnvironment.prototype.next_default_test_name): (WorkerTestEnvironment.prototype.next_default_test_name): (ServiceWorkerTestEnvironment.on_all_loaded): (ServiceWorkerTestEnvironment): (ShellTestEnvironment): (ShellTestEnvironment.prototype.next_default_test_name): (ShellTestEnvironment.prototype.on_new_harness_properties): (ShellTestEnvironment.prototype.on_tests_ready): (ShellTestEnvironment.prototype.add_on_loaded_callback): (ShellTestEnvironment.prototype.test_timeout): (create_test_environment): (is_shared_worker): (is_service_worker): (test): (promise_test): (this.wait_for): (EventWatcher): (done): * streams/readable-byte-stream-controller-expected.txt: * streams/readable-byte-stream-controller-worker-expected.txt: Added. * streams/readable-byte-stream-controller-worker.html: Copied from LayoutTests/streams/readable-byte-stream-controller.html. * streams/readable-byte-stream-controller.html: * streams/readable-stream-byob-reader-expected.txt: * streams/readable-stream-byob-reader-worker-expected.txt: Added. * streams/readable-stream-byob-reader-worker.html: Copied from LayoutTests/streams/readable-stream-byob-reader.html. * streams/readable-stream-byob-reader.html: * streams/readable-stream-byob-request-expected.txt: * streams/readable-stream-byob-request-worker-expected.txt: Copied from LayoutTests/streams/readable-stream-byob-request-expected.txt. * streams/readable-stream-byob-request-worker.html: Copied from LayoutTests/streams/readable-stream-byob-request.html. * streams/readable-stream-byob-request.html: * streams/reference-implementation/readable-stream-templated-expected.txt: * streams/reference-implementation/readable-stream-templated.html: * streams/reference-implementation/writable-stream-abort-expected.txt: * streams/reference-implementation/writable-stream-expected.txt: * webrtc/datachannel/basic-expected.txt: * webrtc/datachannel/basic.html: * webrtc/datachannel/mdns-ice-candidates-expected.txt: * webrtc/datachannel/mdns-ice-candidates.html: * webrtc/pc-detached-document-expected.txt: * webrtc/pc-detached-document.html: * webrtc/video-mute-expected.txt: * webrtc/video-mute-vp8-expected.txt: * webrtc/video-mute-vp8.html: * webrtc/video-mute.html: Canonical link: https://commits.webkit.org/215471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-09-16 21:04:08 +00:00
}, "Basic data channel exchange from offerer to receiver 2");
promise_test(async (test) => {
await new Promise((resolve, reject) => {
finishTest = resolve;
createConnections((localConnection) => {
localChannel = localConnection.createDataChannel('sendDataChannel');
}, (remoteConnection) => {
remoteConnection.ondatachannel = resolve;
});
setTimeout(() => { reject("Test step 1 timed out"); }, 5000);
});
await waitFor(50);
let waitForLocalChannelOpening = new Promise((resolve) => {
localChannel = localConnection.createDataChannel('sendDataChannel2');
localChannel.onopen = resolve;
});
let waitForRemoteChannel = new Promise((resolve) => {
remoteConnection.ondatachannel = (event) => {
remoteChannel = event.channel;
resolve();
};
});
await Promise.all([waitForLocalChannelOpening, waitForRemoteChannel]);
counter = 0;
await new Promise((resolve, reject) => {
finishTest = resolve;
remoteChannel.onmessage = receiveMessages;
sendMessages(localChannel);
setTimeout(() => { reject("Test step 2 timed out"); }, 5000);
});
}, "Create a second channel asynchronously and send messages");
[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>