-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1581791 [wpt PR 19119] - Update xr feature policy name and behavi…
…or to match spec, a=testonly Automatic update from web-platform-tests Update xr feature policy name and behavior to match spec As a result of TPAC there were some spec changes to the xr feature policy (FP). These were made in: immersive-web/webxr#842 The following changes were needed to become spec compliant: * rename FP from "xr" to "xr-spatial-tracking" * supportsSession always resolves for "inline" * supportsSession rejects for immersive-vr with a SecurityError if FP not set * default features per mode are now required features for that mode * requestSession does not unconditionally reject if FP is not set, instead resolving specific features now depends on FP status. * While resolving features, if any required features depend on a missing FP, the requestSession call will fail with a "NotSupportedError" * While resolving features, if any optional features depend on a missing FP, those features will be silently ignored. * devicechange events will not fire for documents that do not have FP set. Bug: 1003842 Change-Id: Ie9ae16b5c1d863b730e556b511c024bae8a4503c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808800 Commit-Queue: Alexander Cooper <alcooper@chromium.org> Reviewed-by: Brandon Jones <bajones@chromium.org> Reviewed-by: Ian Clelland <iclelland@chromium.org> Reviewed-by: Jacob DeWitt <jacde@chromium.org> Auto-Submit: Alexander Cooper <alcooper@chromium.org> Cr-Commit-Position: refs/heads/master@{#701740} -- wpt-commits: dc17f8c8e3372dd30ce98d542874843f87726e8e wpt-pr: 19119
- Loading branch information
1 parent
62bf275
commit 79dbbe3
Showing
8 changed files
with
114 additions
and
24 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
2 changes: 1 addition & 1 deletion
2
testing/web-platform/tests/feature-policy/reporting/xr-report-only.https.html.headers
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 |
---|---|---|
@@ -1 +1 @@ | ||
Feature-Policy-Report-Only: xr 'none' | ||
Feature-Policy-Report-Only: xr-spatial-tracking 'none' |
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
2 changes: 1 addition & 1 deletion
2
testing/web-platform/tests/feature-policy/reporting/xr-reporting.https.html.headers
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 |
---|---|---|
@@ -1 +1 @@ | ||
Feature-Policy: xr 'none' | ||
Feature-Policy: xr-spatial-tracking 'none' |
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
81 changes: 81 additions & 0 deletions
81
testing/web-platform/tests/webxr/webxr_feature_policy.https.html
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,81 @@ | ||
<!DOCTYPE html> | ||
<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 /> | ||
|
||
<script> | ||
xr_promise_test( | ||
"Validate isSessionSupported behavior without xr-spatial-tracking policy", | ||
(t) => { | ||
// Inline should never reject. | ||
return navigator.xr.isSessionSupported("inline").then((supported) => { | ||
t.step(() => { | ||
assert_true(supported, | ||
"inline should always be supported, even without feature policy"); | ||
}); | ||
|
||
// It shouldn't matter that there's no device connected, the SecurityError | ||
// should reject first. | ||
return promise_rejects(t, "SecurityError", | ||
navigator.xr.isSessionSupported("immersive-vr"), | ||
"Immersive isSessionSupported should reject"); | ||
}); | ||
}); | ||
|
||
xr_promise_test( | ||
"Validate requestSession behavior without xr-spatial-tracking policy", | ||
(t) => { | ||
return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE) | ||
.then(() => { | ||
return new Promise((resolve, reject) => { | ||
navigator.xr.test.simulateUserActivation(() => { | ||
|
||
// Technically the first "requestSession" doesn't need either the device | ||
// or the activation, but this makes the test code a little cleaner since | ||
// the others do, as lacking user activation or a valid backing device | ||
// should also cause the session to reject. In order to guarantee that | ||
// we're seeing the rejection we want, we eliminate those as possibilities. | ||
resolve(Promise.all([ | ||
navigator.xr.requestSession("inline").then(session => session.end()), | ||
|
||
promise_rejects(t, "NotSupportedError", | ||
navigator.xr.requestSession("inline", { requiredFeatures: ["local"] }), | ||
"Inline with features should reject without feature policy"), | ||
|
||
promise_rejects(t, "NotSupportedError", | ||
navigator.xr.requestSession("immersive-vr"), | ||
"Immersive-vr should reject without feature policy") | ||
])); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
xr_promise_test( | ||
"Validate devicechange event behavior without xr-spatial-tracking policy", | ||
(t) => { | ||
navigator.xr.addEventListener("devicechange", () => { | ||
t.step(() => { assert_unreached("devicechange should not fire"); }); | ||
}) | ||
|
||
// We need to yield a short time to ensure that any event registration has | ||
// propagated, as this can take some time. | ||
// Note that device connection is not guaranteed to fire per the spec, if it's | ||
// the first connection, but disconnect definitely should. | ||
t.step_timeout(() => { | ||
navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE) | ||
.then((testDeviceController) => { | ||
return testDeviceController.disconnect(); | ||
}); | ||
}, 100); | ||
|
||
// Wait an even longer time before finishing the test, so that if the event | ||
// were to fire, it would've by now. | ||
return new Promise((resolve) => { | ||
t.step_timeout(() => { resolve(); }, 2000); | ||
}); | ||
|
||
}); | ||
</script> |
1 change: 1 addition & 0 deletions
1
testing/web-platform/tests/webxr/webxr_feature_policy.https.html.headers
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 @@ | ||
Feature-Policy: xr-spatial-tracking 'none' |