blob: 8dde7ee2cb25a757dca9361c77e0e69feb2dc485 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="/js-test-resources/js-test.js"></script>
<script>
description("Tests that giving device orientation permission to one third-party iframe gives it to other iframes of the same origin too.");
jsTestIsAsync = true;
// If prompted, allow.
if (window.testRunner)
testRunner.setShouldAllowDeviceOrientationAndMotionAccess(true);
let firstFrame = true;
onmessage = (_e) => {
e = _e;
shouldBeEqualToString("e.data", "granted");
if (!firstFrame) {
finishJSTest();
return;
}
firstFrame = false;
if (window.testRunner)
testRunner.setShouldAllowDeviceOrientationAndMotionAccess(false);
let secondFrame = document.createElement("iframe");
secondFrame.src = "http://localhost:8000/device-orientation/resources/request-orientation-events.html";
secondFrame.allow = "accelerometer;gyroscope;magnetometer";
document.body.append(secondFrame);
};
</script>
<iframe src="http://localhost:8000/device-orientation/resources/request-orientation-events.html" allow="accelerometer;gyroscope;magnetometer"></iframe>
</body>
</html>