Update web-platform-tests to revision 3f9178031eec5374c9a7d5709a7e11ba4a1955ed

This commit is contained in:
WPT Sync Bot 2018-07-22 21:05:03 -04:00
parent 4997ec26c2
commit a5af9a106a
192 changed files with 3943 additions and 1927 deletions

View file

@ -1,3 +1,25 @@
// These tests rely on the User Agent providing an implementation of the
// WebXR Testing API (https://github.com/immersive-web/webxr-test-api).
//
// In Chromium-based browsers, this implementation is provided by a JavaScript
// shim in order to reduce the amount of test-only code shipped to users. To
// enable these tests the browser must be run with these options:
//
// --enable-blink-features=MojoJS,MojoJSTest
function xr_promise_test(func, name, properties) {
promise_test(async (t) => {
// Perform any required test setup:
if (window.XRTest === undefined) {
// Chrome setup
await loadChromiumResources;
}
return func(t);
}, name, properties);
}
// 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.
@ -25,4 +47,32 @@ function forEachWebxrObject(callback) {
callback(window.XRStageBoundsPoint, 'XRStageBoundsPoint');
callback(window.XRSessionEvent, 'XRSessionEvent');
callback(window.XRCoordinateSystemEvent, 'XRCoordinateSystemEvent');
}
}
// Code for loading test api in chromium.
let loadChromiumResources = Promise.resolve().then(() => {
if (!MojoInterfaceInterceptor) {
// Do nothing on non-Chromium-based browsers or when the Mojo bindings are
// not present in the global namespace.
return;
}
let chain = Promise.resolve();
['/gen/layout_test_data/mojo/public/js/mojo_bindings.js',
'/gen/ui/gfx/geometry/mojo/geometry.mojom.js',
'/gen/mojo/public/mojom/base/time.mojom.js',
'/gen/device/vr/public/mojom/vr_service.mojom.js',
'/resources/chromium/webxr-test.js', '/resources/testdriver.js',
'/resources/testdriver-vendor.js',
].forEach(path => {
let script = document.createElement('script');
script.src = path;
script.async = false;
chain = chain.then(() => new Promise(resolve => {
script.onload = () => resolve();
}));
document.head.appendChild(script);
});
return chain;
});