blob: 11b1207302529da2818f84cc33c9000e41dc2fda [file] [log] [blame]
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="file:///gen/layout_test_data/mojo/public/js/mojo_bindings.js"></script>
<script src="file:///gen/device/vr/public/mojom/vr_service.mojom.js"></script>
<script src="../external/wpt/resources/chromium/webxr-test.js"></script>
<script src="../xr/resources/xr-test-utils.js"></script>
<canvas id="webgl-canvas"></canvas>
let testName = "XRSession requestAnimationFrame must fail if the session has "
+ "no baseLayer";
let fakeDeviceInitParams = { supportsImmersive:true };
let requestSessionModes = [
let testFunction = (session) => new Promise((resolve, reject) => {
// Session must have a baseLayer or frame requests will be ignored.
let webglLayer = new XRWebGLLayer(session, gl, {
compositionDisabled: session.mode == 'inline' });
function onEarlyFrame(time, vrFrame) {
// We shouldn't be allowed to reach this callback with no baseLayer
assert_equals(session.renderState.baseLayer, webglLayer);
// This callback shouldn't go through, since the session doesn't
// have a baseLayer when this call is made.
let handle = session.requestAnimationFrame(onEarlyFrame);
// Should still give us a valid handle, though.
assert_not_equals(handle, 0);
// Wait for a bit and set the baseLayer.
setTimeout(() => {
// Once the base layer is set the previously registered callback should run.
baseLayer: webglLayer
}, 300);
testFunction, fakeDeviceInitParams, requestSessionModes, testName);