blob: 8a30e4136b1f741fa9d2a651036a7a1a1eee1585 [file] [edit]
<!-- webkit-test-runner [ SiteIsolationEnabled=true ] -->
<script src="/js-test-resources/js-test.js"></script>
<script>
description("Verifies the camera Permissions API reflects permissions policy on cross-site frames");
jsTestIsAsync = true;
if (window.testRunner)
testRunner.setUserMediaPermission(true);
onmessage = (event) => {
let iframe = document.getElementById("iframe");
if (iframe.getAttribute("allow") === "camera 'none'") {
state = event.data;
shouldBeEqualToString("state", "denied");
shouldBe("event.origin", "'http://localhost:8000'");
iframe.setAttribute("allow", "camera *");
iframe.src = "http://localhost:8000/site-isolation/resources/permissions-query-frame.html?name=camera&allow";
} else {
state = event.data;
shouldBeFalse("state === 'denied'");
shouldBe("event.origin", "'http://localhost:8000'");
finishJSTest();
}
}
</script>
<body>
<iframe id="iframe" allow="camera 'none'" src="http://localhost:8000/site-isolation/resources/permissions-query-frame.html?name=camera&deny"></iframe>
</body>