Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WebXR] Resolve required/optional features per the spec
This adds support to resolve required/optional features against device capabilities as well as sets up the plumbing for appropriately tailored consent. A WPT test for lack of device support was also added, which required updating the tests. Bug:991605 Change-Id: Ibce6924492311544fd75ca36ed79aa855c943aad
- Loading branch information
1 parent
f656b09
commit 82e17c6
Showing
9 changed files
with
136 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!DOCTYPE html> | ||
<body> | ||
<script src=/resources/testharness.js></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src="resources/webxr_util.js"></script> | ||
<script src="resources/webxr_test_constants.js"></script> | ||
<canvas></canvas> | ||
<script> | ||
|
||
let testName = | ||
"Immersive XRSession requests with no supported device should reject"; | ||
|
||
let fakeDeviceInitParams = { | ||
supportsImmersive: true, | ||
views: VALID_VIEWS, | ||
viewerOrigin: IDENTITY_TRANSFORM, | ||
supportedFeatures: [ | ||
"viewer", | ||
"local", | ||
"local-floor"] | ||
}; | ||
|
||
xr_promise_test(testName, | ||
(t) => { | ||
function session_resolves(sessionMode, sessionInit) { | ||
return navigator.xr.requestSession(sessionMode, sessionInit) | ||
.then((session) => { | ||
return session.end(); | ||
}); | ||
} | ||
|
||
return navigator.xr.test.simulateDeviceConnection(fakeDeviceInitParams) | ||
.then((controller) => new Promise((resolve, reject) => { | ||
navigator.xr.test.simulateUserActivation(() => { | ||
// Attempting to request required features that aren't supported by | ||
// the device should reject. | ||
promise_rejects(t, "NotSupportedError", | ||
navigator.xr.requestSession("immersive-vr", { | ||
requiredFeatures: ['bounded-floor'] | ||
})) | ||
.then(() => { | ||
// Attempting to request with an unsupported feature as optional | ||
// should succeed | ||
return session_resolves("immersive-vr", { | ||
optionalFeatures: ['bounded-floor'] | ||
}); | ||
}) | ||
.then(() => { | ||
// Attempting to request with supported features only should succeed. | ||
return session_resolves("immersive-vr", { | ||
requiredFeatures: ['local', 'local-floor'] | ||
}) | ||
.then(() => { | ||
resolve(); | ||
}).catch((err) => { | ||
reject(err); | ||
});; | ||
}); | ||
}); | ||
})); | ||
}); | ||
|
||
</script> | ||
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters