Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="../resources/webxr_util.js"></script>
<script src="../resources/webxr_test_constants.js"></script>
<script src="../resources/webxr_test_asserts.js"></script>
<style type="text/css">
div {
padding: 10px;
min-width: 10px;
min-height: 10px;
iframe {
border: 0;
width: 20px;
height: 20px;
<div id="div_overlay">
<div id="div_other">
<p>test text</p>
const fakeDeviceInitParams = {
supportedModes: ["immersive-ar"],
supportedFeatures: ALL_FEATURES,
// This test verifies that WebXR DOM Overlay mode works when the document is
// already in fullscreen mode when the session starts. (This should work both
// for a fullscreen-based overlay implementation and for one that treats the
// overlay as an independent output.)
async (setup) => {
setup.add_cleanup(() => document.exitFullscreen());
// Fullscreen the <body> element before running the test. Currently, this
// can't be an arbitrary element because the simulateUserActivation call
// adds a button to <body> which is only clickable if it's visible.
await test_driver.bless("fullscreen",
() => document.body.requestFullscreen());
const overlayElement = document.getElementById('div_overlay');
"Check XR session from fullscreen",
(session, fakeDeviceController, t) => {
// The overlay element should have a transparent background.
'rgba(0, 0, 0, 0)');
// Check that the pseudostyle is set.
assert_equals(document.querySelector(':xr-overlay'), overlayElement);
// Wait for one animation frame before exiting.
return new Promise((resolve) => session.requestAnimationFrame(resolve));
fakeDeviceInitParams, 'immersive-ar', {
requiredFeatures: ['dom-overlay'],
domOverlay: { root: overlayElement }
// The setup promise_test automatically succeeds if it gets here
// without raising an exception. It'll pass even on systems that
// don't support WebXR or DOM Overlay.
"fullscreen setup"