haikuwebkit/LayoutTests/webrtc/no-port-zero-in-upd-candida...

51 lines
1.5 KiB
HTML
Raw Permalink Normal View History

[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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Ensuring ICE UDP candidates have a valid port</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<script>
function gatherCandidates(pc)
{
var candidates = [];
return new Promise((resolve, reject) => {
setTimeout(() => {
reject("gathering did time out with " + candidates.length + " candidates");
}, 10000);
[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
pc.onicecandidate = (event) => {
if (event.candidate === null) {
resolve(candidates);
return;
}
candidates.push(event.candidate.candidate);
};
pc.createOffer().then((offer) => {
pc.setLocalDescription(offer);
});
});
}
promise_test((test) => {
var pc = new RTCPeerConnection();
pc.createDataChannel("");
var hasCandidate = false;
return gatherCandidates(pc).then((candidates) => {
for(candidate of candidates) {
if (candidate.toLowerCase().indexOf(" udp ") === -1)
continue;
items = candidate.split(" ");
var port = parseInt(items[5]);
assert_true(port > 1024, "port is expected to be above 1024 but was " + port);
hasCandidate = true;
}
assert_true(hasCandidate, "Candidates should be gathered");
});
}, "Checking UDP ICE candidate ports");
</script>
</body>
</html>