haikuwebkit/LayoutTests/webrtc/filtering-ice-candidate-aft...

67 lines
1.8 KiB
HTML
Raw Permalink Normal View History

We should do ICE candidate filtering at the Document level https://bugs.webkit.org/show_bug.cgi?id=173861 <rdar://problem/33122058> Patch by Youenn Fablet <youenn@apple.com> on 2017-07-11 Reviewed by Eric Carlson. Source/WebCore: Tests: http/tests/webrtc/filtering-ice-candidate-cross-origin-frame.html http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html http/tests/webrtc/filtering-ice-candidate-same-origin-frame2.html webrtc/filtering-ice-candidate-after-reload.html Making UserMediaRequest disable the ICE candidate filtering for the page RTCController. All RTCPeerConnection of the page that are created on a document that are same-origin as the top document are now registered to the RTCController. This allows disabling filtering to only these RTCPeerConnection. The page keeps the default ICE candidate filtering policy. This policy allows disabling ICE candidate filtering for all RTCPeerConnection. When the top document is changing, the RTCController filtering policy is reset and its list of RTCPeerConnection is emptied. Internals no longer disables ICE candidate filtering by default. This allows finer grained testing. ICE candidate filtering is disabled for tests including testharnessreport.js to enable web-platform-tests to run without modifications. * Modules/mediastream/RTCController.cpp: (WebCore::RTCController::reset): * Modules/mediastream/RTCController.h: * Modules/mediastream/UserMediaRequest.cpp: (WebCore::UserMediaRequest::allow): * page/Frame.cpp: (WebCore::Frame::setDocument): * page/Page.cpp: (WebCore::Page::disableICECandidateFiltering): * page/Page.h: (WebCore::Page::shouldEnableICECandidateFilteringByDefault): (WebCore::Page::disableICECandidateFiltering): Deleted. (WebCore::Page::enableICECandidateFiltering): Deleted. (WebCore::Page::isICECandidateFilteringEnabled): Deleted. * testing/Internals.cpp: (WebCore::Internals::Internals): (WebCore::Internals::setICECandidateFiltering): (WebCore::Internals::setEnumeratingAllNetworkInterfacesEnabled): (WebCore::Internals::isICECandidateFilteringEnabled): Deleted. * testing/Internals.h: * testing/Internals.idl: Source/WebKit2: Removing ICE candidate filtering handling at UIProcess level. ICE candidate filtering is now disabled at UserMediaRequest level. WebPage forwards the ICE candidate filtering option to the page so as to set the default option correctly for every document of the page. * UIProcess/UserMediaProcessManager.cpp: (WebKit::UserMediaProcessManager::willCreateMediaStream): (WebKit::UserMediaProcessManager::endedCaptureSession): * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::disableICECandidateFiltering): (WebKit::WebPage::enableICECandidateFiltering): LayoutTests: * http/tests/webrtc/filtering-ice-candidate-cross-origin-frame-expected.txt: Added. * http/tests/webrtc/filtering-ice-candidate-cross-origin-frame.html: Added. * http/tests/webrtc/filtering-ice-candidate-same-origin-frame-expected.txt: Added. * http/tests/webrtc/filtering-ice-candidate-same-origin-frame.html: Added. * http/tests/webrtc/filtering-ice-candidate-same-origin-frame2-expected.txt: Added. * http/tests/webrtc/filtering-ice-candidate-same-origin-frame2.html: Added. * http/tests/webrtc/resources/check-ice-candidate-filtering.html: Added. * http/tests/webrtc/resources/do-get-user-media.html: Added. * platform/mac-wk1/TestExpectations: Disable http/tests/webrtc tests. * resources/testharnessreport.js: Disabled ICE candidate filtering by default. * webrtc/filtering-ice-candidate-after-reload-expected.txt: Added. * webrtc/filtering-ice-candidate-after-reload.html: Added. Canonical link: https://commits.webkit.org/191174@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@219331 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-07-11 15:32:38 +00:00
<!DOCTYPE html>
<html>
<head>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function isFilteringEnabled()
{
var pc = new RTCPeerConnection();
pc.createDataChannel("");
var candidates = [];
return new Promise((resolve, reject) => {
pc.onicecandidate = (event) => {
if (event.candidate === null) {
resolve(!candidates.length);
return;
}
candidates.push(event.candidate.candidate);
};
pc.createOffer().then((offer) => {
pc.setLocalDescription(offer);
});
});
}
function endTest(message)
{
result.innerHTML = message;
if (window.testRunner)
testRunner.notifyDone();
}
function test() {
if (window.localStorage.getItem("after-reload") == null) {
window.localStorage.setItem("after-reload", "true")
isFilteringEnabled().then((filtering) => {
if (!filtering) {
endTest("FAIL, initial ice candidate filtering is off");
return;
}
navigator.mediaDevices.getUserMedia({audio:true, video:true}).then(() => { return isFilteringEnabled(); }).then((filtering) => {
if (filtering) {
endTest("FAIL, initial ice candidate filtering after getUserMedia is on");
return;
}
internals.forceReload(true);
});
});
} else {
window.localStorage.clear();
isFilteringEnabled().then((filtering) => { endTest(filtering ? "PASS" : "FAIL"); });
}
}
</script>
</head>
<body onload="setTimeout(test, 0);">
<div>This test requires internals. It checks that after reload, we are back to filtering ice candidate.</div>
<div id="result"></div>
</body>
</html>