<!--
Tests that AR hit test returns results when a plane is present.
-->
<html>
<head>
<link rel="stylesheet" type="text/css" href="../resources/webxr_e2e.css">
</head>
<body>
<canvas id="webgl-canvas"></canvas>
<script src="../../../../../../third_party/blink/web_tests/resources/testharness.js"></script>
<script src="../resources/webxr_e2e.js"></script>
<script>var shouldAutoCreateNonImmersiveSession = false;</script>
<script src="../resources/webxr_boilerplate.js"></script>
<script>
let gotResult = false;
let hitTestSource = null;
function stepStartHitTesting() {
let sessionInfo = sessionInfos[sessionTypes.AR];
console.log('Requesting hit test source');
sessionInfo.currentSession.requestHitTestSource({
space: sessionInfo.currentRefSpace,
offsetRay: new XRRay()
}).then((hts) => {
console.log('Got hit test source');
hitTestSource = hts;
});
onARFrameCallback = (session, frame) => {
console.log('Got AR frame');
if (!hitTestSource) return;
if (gotResult) return;
let results = frame.getHitTestResults(hitTestSource);
if (results.length) {
gotResult = true;
done();
}
};
}
</script>
</body>
</html>