haikuwebkit/LayoutTests/webrtc/disable-encryption.html

51 lines
1.6 KiB
HTML
Raw Permalink Normal View History

Enable a debug WebRTC mode without any encryption https://bugs.webkit.org/show_bug.cgi?id=199177 <rdar://problem/52074986> Reviewed by Eric Carlson. Source/JavaScriptCore: * inspector/protocol/Page.json: Source/ThirdParty/libwebrtc: * Configurations/libwebrtc.iOS.exp: * Configurations/libwebrtc.iOSsim.exp: * Configurations/libwebrtc.mac.exp: Source/WebCore: For every RTCPeerConnection, first set whether to use encryption or not based on page settings. If encryption is disabled, log it. Add internals API to toggle the switch from tests. Test: webrtc/disable-encryption.html * Modules/mediastream/RTCPeerConnection.cpp: (WebCore::RTCPeerConnection::RTCPeerConnection): * Modules/mediastream/libwebrtc/LibWebRTCPeerConnectionBackend.cpp: (WebCore::createLibWebRTCPeerConnectionBackend): * inspector/agents/InspectorPageAgent.cpp: * page/Settings.yaml: * platform/mediastream/libwebrtc/LibWebRTCProvider.cpp: (WebCore::LibWebRTCProvider::setEnableWebRTCEncryption): * platform/mediastream/libwebrtc/LibWebRTCProvider.h: * testing/Internals.cpp: (WebCore::Internals::resetToConsistentState): (WebCore::Internals::setEnableWebRTCEncryption): * testing/Internals.h: * testing/Internals.idl: Source/WebInspectorUI: * Localizations/en.lproj/localizedStrings.js: * UserInterface/Base/Main.js: LayoutTests: * webrtc/disable-encryption-expected.txt: Added. * webrtc/disable-encryption.html: Added. Canonical link: https://commits.webkit.org/213671@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247438 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-07-15 18:59:19 +00:00
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing connection with and without encryption</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
</head>
<body>
<video id="video" autoplay playsinline></video>
<script src ="routines.js"></script>
<script>
promise_test(async (test) => {
if (window.internals)
internals.setEnableWebRTCEncryption(false);
const localStream = await navigator.mediaDevices.getUserMedia({video: true});
video.srcObject = await new Promise((resolve, reject) => {
createConnections((localConnection) => {
localConnection.addTrack(localStream.getVideoTracks()[0], localStream);
}, (remoteConnection) => {
remoteConnection.ontrack = (event) => {
resolve(event.streams[0]);
};
});
setTimeout(() => { reject("Test timed out"); }, 5000);
});
await video.play();
}, "Basic data channel exchange without encryption");
promise_test(async (test) => {
if (!window.internals)
return Promise.rejects("Test needs internals");
internals.setEnableWebRTCEncryption(false);
const pc1 = new RTCPeerConnection();
internals.setEnableWebRTCEncryption(true);
const pc2 = new RTCPeerConnection();
pc1.addTransceiver('audio');
const offer = await pc1.createOffer();
await pc1.setLocalDescription(offer);
return promise_rejects(test, 'InvalidAccessError', pc2.setRemoteDescription(offer));
}, "Make sure a pc with encryption and a pc without encryption cannot talk");
</script>
</body>
</html>