mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Update xrSession_features_deviceSupport to use new user activations for each session request
This commit is contained in:
parent
535e05f7b2
commit
8cc7c51803
5 changed files with 29 additions and 35 deletions
|
@ -735150,7 +735150,7 @@
|
|||
"support"
|
||||
],
|
||||
"webxr/resources/webxr_util.js": [
|
||||
"5f66dc9573d37630d588265f20e5b57a8175766f",
|
||||
"dbe1585929f50089bb3e26a981b9c12b30e9fa1f",
|
||||
"support"
|
||||
],
|
||||
"webxr/webGLCanvasContext_create_xrcompatible.https.html": [
|
||||
|
@ -735302,7 +735302,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"webxr/xrSession_features_deviceSupport.https.html": [
|
||||
"d8858bd4be689bf8e4f3a3795e13fad2a2057019",
|
||||
"1ee63bae047bd196233f5e4253baec94b6a576a9",
|
||||
"testharness"
|
||||
],
|
||||
"webxr/xrSession_input_events_end.https.html": [
|
||||
|
@ -735342,7 +735342,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"webxr/xrSession_viewer_availability.https.html": [
|
||||
"c509e5f1a2a992b9329fd55e591e37fcea2b6e91",
|
||||
"f28a07ad8bd0f8529b791048840bf60495186a7e",
|
||||
"testharness"
|
||||
],
|
||||
"webxr/xrSession_viewer_referenceSpace.https.html": [
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
[xrSession_features_deviceSupport.https.html]
|
||||
expected: ERROR
|
||||
[Immersive XRSession requests with no supported device should reject]
|
||||
expected: TIMEOUT
|
||||
|
|
@ -101,6 +101,18 @@ function xr_session_promise_test(
|
|||
properties);
|
||||
}
|
||||
|
||||
|
||||
// This function wraps the provided function in a
|
||||
// simulateUserActivation() call, and resolves the promise with the
|
||||
// result of func(), or an error if one is thrown
|
||||
function promise_simulate_user_activation(func) {
|
||||
return new Promise((resolve, reject) => {
|
||||
navigator.xr.test.simulateUserActivation(() => {
|
||||
try { let a = func(); resolve(a); } catch(e) { reject(e); }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// This functions calls a callback with each API object as specified
|
||||
// by https://immersive-web.github.io/webxr/spec/latest/, allowing
|
||||
// checks to be made on all ojects.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
"local-floor"]
|
||||
};
|
||||
|
||||
|
||||
xr_promise_test(testName,
|
||||
(t) => {
|
||||
function session_resolves(sessionMode, sessionInit) {
|
||||
|
@ -31,34 +32,28 @@
|
|||
}
|
||||
|
||||
return navigator.xr.test.simulateDeviceConnection(fakeDeviceInitParams)
|
||||
.then((controller) => new Promise((resolve, reject) => {
|
||||
navigator.xr.test.simulateUserActivation(() => {
|
||||
.then((controller) =>
|
||||
promise_simulate_user_activation(() => {
|
||||
// Attempting to request required features that aren't supported by
|
||||
// the device should reject.
|
||||
promise_rejects(t, "NotSupportedError",
|
||||
|
||||
return promise_rejects(t, "NotSupportedError",
|
||||
navigator.xr.requestSession("immersive-vr", {
|
||||
requiredFeatures: ['bounded-floor']
|
||||
}))
|
||||
.then(() => {
|
||||
}).then(() => promise_simulate_user_activation(() => {
|
||||
// Attempting to request with an unsupported feature as optional
|
||||
// should succeed
|
||||
return session_resolves("immersive-vr", {
|
||||
optionalFeatures: ['bounded-floor']
|
||||
});
|
||||
})).then(() => promise_simulate_user_activation(() => {
|
||||
// Attempting to request with supported features only should succeed.
|
||||
return session_resolves("immersive-vr", {
|
||||
requiredFeatures: ['local', 'local-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>
|
||||
|
|
|
@ -24,14 +24,6 @@
|
|||
.then(session => session.end()));
|
||||
}
|
||||
|
||||
function simulate_user_activation(func) {
|
||||
return new Promise((resolve, reject) => {
|
||||
navigator.xr.test.simulateUserActivation(() => {
|
||||
try { resolve(func()); } catch(e) { reject(e); }
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return session_resolves('inline', {
|
||||
// RequestSession with 'viewer' as a required featre should succeed, even
|
||||
// without user activation.
|
||||
|
@ -62,14 +54,14 @@
|
|||
optionalFeatures: ['local']
|
||||
});
|
||||
})
|
||||
.then(() => simulate_user_activation(() => {
|
||||
.then(() => promise_simulate_user_activation(() => {
|
||||
// RequestSession with unsupported optional features should succeed.
|
||||
return session_resolves('inline', {
|
||||
requiredFeatures: ['viewer'],
|
||||
optionalFeatures: ['local']
|
||||
})
|
||||
}))
|
||||
.then(() => simulate_user_activation(() => {
|
||||
.then(() => promise_simulate_user_activation(() => {
|
||||
// Request with unsupported required features should reject.
|
||||
return session_rejects("NotSupportedError", 'inline', {
|
||||
requiredFeatures: ['local']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue