Bug 1630741 [wpt PR 23031] - Add WebKit support for WebXR tests, a=testonly

Automatic update from web-platform-tests
Add WebKit support for WebXR tests (#23031)

WebXR and the WebXR testing API are in the process of being implemented. The way we designed the integration of the test API with the rest of the engine is by adding WebXRTest to an object called Internals which is injected in JSC and that provides JS access to WebKit's internal APIs. That Internals object is only available for testing so we can ensure that WebXRTest is never exposed to the Web.
--

wpt-commits: 603ea91ccada76c2796bc51d1cf027882582cd83
wpt-pr: 23031
This commit is contained in:
Sergio 2020-04-28 11:33:16 +00:00 коммит произвёл moz-wptsync-bot
Родитель 22dffa9a6d
Коммит b68d4ed809
2 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -684,6 +684,7 @@ LAYOUTTESTS APIS: resources/chromium/webxr-test.js
LAYOUTTESTS APIS: web-nfc/NDEFReader-document-hidden-manual.https.html
LAYOUTTESTS APIS: web-nfc/NDEFReader_scan.https.html
LAYOUTTESTS APIS: web-nfc/NDEFWriter_write.https.html
LAYOUTTESTS APIS: webxr/resources/webxr_util.js
# Signed Exchange files have hard-coded URLs in the certUrl field
WEB-PLATFORM.TEST:signed-exchange/resources/*.sxg

Просмотреть файл

@ -22,6 +22,11 @@ function xr_promise_test(name, func, properties) {
xr_debug = navigator.xr.test.Debug;
}
if (self.internals && internals.xrTest && navigator.xr) {
// WebKit setup
await setupWebKitWebXRTestAPI;
}
// Ensure that any devices are disconnected when done. If this were done in
// a .then() for the success case, a test that expected failure would
// already be marked done at the time that runs and the shutdown would
@ -199,3 +204,16 @@ let loadChromiumResources = Promise.resolve().then(() => {
return chain;
});
let setupWebKitWebXRTestAPI = Promise.resolve().then(() => {
if (!self.internals) {
// Do nothing on non-WebKit-based browsers.
return;
}
// WebKit setup. The internals object is used by the WebKit test runner
// to provide JS access to internal APIs. In this case it's used to
// ensure that XRTest is only exposed to wpt tests.
navigator.xr.test = internals.xrTest;
return Promise.resolve();
});