blob: 8e7576adb7a9b4dd38b7d01fb89514f54abbfda8 [file] [log] [blame]
<!DOCTYPE HTML>
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script>
window.jsTestIsAsync = true;
if (window.internals)
internals.settings.setMediaCaptureRequiresSecureConnection(true);
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.setUserMediaPermission(true);
testRunner.dumpAsText();
}
if (location.hostname != "localhost")
window.location = `${location.protocol}//localhost:${location.port}${location.pathname}`;
else {
window.addEventListener("load", async () => {
try {
await window.navigator.mediaDevices.getUserMedia({audio:true});
testPassed("getUserMedia succeeded");
} catch(err) {
testFailed(`getUserMedia should have succeeded but failed with error "${err}"`);
}
finishJSTest();
});
}
description("Tests that getUserMedia is allowed from localhost when secure connection is required.");
</script>
<script src="../../js-test-resources/js-test-post.js"></script>
</head>
<body>
<div id="console"></div>
</body>
</html>