WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-209859-20200409172546.patch (text/plain), 84.85 KB, created by
Sergio Villar Senin
on 2020-04-09 08:25:51 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sergio Villar Senin
Created:
2020-04-09 08:25:51 PDT
Size:
84.85 KB
patch
obsolete
>Subversion Revision: 259712 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d50836fc90288335921a55acc2771c8df903fec4..0a141b61b09b41435a8281d2e06fd552009b2c99 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,88 @@ >+2020-04-09 Sergio Villar Senin <svillar@igalia.com> >+ >+ [WebXR] Test IDLs and stubs >+ https://bugs.webkit.org/show_bug.cgi?id=209859 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WebXR testing is hard as it might involve interaction with actual >+ devices. That's why the WebXR testing >+ API (https://immersive-web.github.io/webxr-test-api/) was >+ proposed. In fact, all the current WebXR tests from >+ web-platform-tests are using that testing API. This new testing >+ API supplements navigator.xr and is accessed through >+ navigator.xr.test. >+ >+ We're adding the required IDLs and very basic (mostly empty) >+ implementations for testing methods. We're adding testing >+ infrastructure, adding tests make no sense for this change. >+ >+ * CMakeLists.txt: >+ * DerivedSources.make: >+ * Modules/webxr/WebXRSystem.cpp: >+ (WebCore::WebXRSystem::test const): >+ * Modules/webxr/WebXRSystem.h: >+ * Modules/webxr/WebXRSystemWebXRTest.h: Added. >+ * Modules/webxr/WebXRSystemWebXRTest.idl: Added. >+ * Modules/webxr/XRHandedness.h: >+ * Modules/webxr/XRTargetRayMode.h: >+ * Sources.txt: Added new files. >+ * WebCore.xcodeproj/project.pbxproj: Ditto. >+ * bindings/js/WebCoreBuiltinNames.h: Added some new macros. >+ * page/RuntimeEnabledFeatures.cpp: >+ (WebCore::RuntimeEnabledFeatures::setWebXRTestEnabled): New runtime >+ flag for WebXRTest API. Can be set to true only when EnableWebXR is true. >+ * page/RuntimeEnabledFeatures.h: >+ (WebCore::RuntimeEnabledFeatures::webXRTestEnabled const): >+ * testing/FakeXRBoundsPoint.h: Added. >+ * testing/FakeXRBoundsPoint.idl: Added. >+ * testing/FakeXRButtonStateInit.h: Added. >+ * testing/FakeXRButtonStateInit.idl: Added. >+ * testing/FakeXRInputSourceInit.h: Added. >+ * testing/FakeXRInputSourceInit.idl: Added. >+ * testing/FakeXRRigidTransformInit.h: Added. >+ * testing/FakeXRRigidTransformInit.idl: Added. >+ * testing/FakeXRViewInit.h: Added. >+ * testing/FakeXRViewInit.idl: Added. >+ * testing/WebFakeXRDevice.cpp: Added. >+ (WebCore::WebFakeXRDevice::setViews): >+ (WebCore::WebFakeXRDevice::disconnect): >+ (WebCore::WebFakeXRDevice::setViewerOrigin): >+ (WebCore::WebFakeXRDevice::clearViewerOrigin): >+ (WebCore::WebFakeXRDevice::simulateVisibilityChange): >+ (WebCore::WebFakeXRDevice::setBoundsGeometry): >+ (WebCore::WebFakeXRDevice::setFloorOrigin): >+ (WebCore::WebFakeXRDevice::clearFloorOrigin): >+ (WebCore::WebFakeXRDevice::simulateResetPose): >+ (WebCore::WebFakeXRDevice::simulateInputSourceConnection): >+ * testing/WebFakeXRDevice.h: Added. >+ * testing/WebFakeXRDevice.idl: Added. >+ * testing/WebFakeXRInputController.cpp: Added. >+ (WebCore::WebFakeXRInputController::setHandedness): >+ (WebCore::WebFakeXRInputController::setTargetRayMode): >+ (WebCore::WebFakeXRInputController::setProfiles): >+ (WebCore::WebFakeXRInputController::setGripOrigin): >+ (WebCore::WebFakeXRInputController::clearGripOrigin): >+ (WebCore::WebFakeXRInputController::setPointerOrigin): >+ (WebCore::WebFakeXRInputController::disconnect): >+ (WebCore::WebFakeXRInputController::reconnect): >+ (WebCore::WebFakeXRInputController::startSelection): >+ (WebCore::WebFakeXRInputController::endSelection): >+ (WebCore::WebFakeXRInputController::simulateSelect): >+ (WebCore::WebFakeXRInputController::setSupportedButtons): >+ (WebCore::WebFakeXRInputController::updateButtonState): >+ * testing/WebFakeXRInputController.h: Added. >+ * testing/WebFakeXRInputController.idl: Added. >+ * testing/WebXRTest.cpp: Added. >+ (WebCore::WebXRTest::simulateDeviceConnection const): >+ (WebCore::WebXRTest::simulateUserActivation): >+ (WebCore::WebXRTest::disconnectAllDevices): >+ * testing/WebXRTest.h: Added. >+ (WebCore::WebXRTest::create): >+ * testing/WebXRTest.idl: Added. >+ * testing/XRSimulateUserActivationFunction.h: Added. >+ * testing/XRSimulateUserActivationFunction.idl: Added. >+ > 2020-04-08 Keith Rollin <krollin@apple.com> > > Enable the use of XCBuild by default in Apple builds >diff --git a/Source/WebCore/CMakeLists.txt b/Source/WebCore/CMakeLists.txt >index 912230178c1d2a3935b209a799a77359be77d455..ce939ec9848fa4585e84dffc327a396411cdda44 100644 >--- a/Source/WebCore/CMakeLists.txt >+++ b/Source/WebCore/CMakeLists.txt >@@ -159,6 +159,7 @@ set(WebCore_PRIVATE_INCLUDE_DIRECTORIES > "${WEBCORE_DIR}/svg/graphics" > "${WEBCORE_DIR}/svg/graphics/filters" > "${WEBCORE_DIR}/svg/properties" >+ "${WEBCORE_DIR}/testing" > "${WEBCORE_DIR}/websockets" > "${WEBCORE_DIR}/workers" > "${WEBCORE_DIR}/workers/service" >@@ -1194,6 +1195,7 @@ if (ENABLE_WEBXR) > Modules/webxr/WebXRSession.idl > Modules/webxr/WebXRSpace.idl > Modules/webxr/WebXRSystem.idl >+ Modules/webxr/WebXRSystemWebXRTest.idl > Modules/webxr/WebXRView.idl > Modules/webxr/WebXRViewerPose.idl > Modules/webxr/WebXRViewport.idl >@@ -1656,6 +1658,25 @@ list(APPEND WebCoreTestSupport_SOURCES > testing/js/WebCoreTestSupport.cpp > ) > >+ >+if (ENABLE_WEBXR) >+ list(APPEND WebCoreTestSupport_IDL_FILES >+ testing/FakeXRBoundsPoint.idl >+ testing/FakeXRButtonStateInit.idl >+ testing/FakeXRInputSourceInit.idl >+ testing/FakeXRRigidTransformInit.idl >+ testing/FakeXRViewInit.idl >+ testing/WebFakeXRDevice.idl >+ testing/WebFakeXRInputController.idl >+ testing/WebXRTest.idl >+ testing/XRSimulateUserActivationFunction.idl >+ ) >+ list(APPEND WebCoreTestSupport_SOURCES >+ testing/WebFakeXRDevice.cpp >+ testing/WebXRTest.cpp >+ ) >+endif () >+ > # Modules that the bindings generator scripts may use > set(SCRIPTS_RESOLVE_SUPPLEMENTAL > ${WEBCORE_DIR}/bindings/scripts/IDLParser.pm >diff --git a/Source/WebCore/DerivedSources.make b/Source/WebCore/DerivedSources.make >index 4e92568f0722916aea928586c64976328705fe95..d481bf64172291e0624d4f666d9cc50e1b329672 100644 >--- a/Source/WebCore/DerivedSources.make >+++ b/Source/WebCore/DerivedSources.make >@@ -473,6 +473,7 @@ JS_BINDING_IDLS = \ > $(WebCore)/Modules/webxr/WebXRSession.idl \ > $(WebCore)/Modules/webxr/WebXRSpace.idl \ > $(WebCore)/Modules/webxr/WebXRSystem.idl \ >+ $(WebCore)/Modules/webxr/WebXRSystemWebXRTest.idl \ > $(WebCore)/Modules/webxr/WebXRViewerPose.idl \ > $(WebCore)/Modules/webxr/WebXRView.idl \ > $(WebCore)/Modules/webxr/WebXRViewport.idl \ >@@ -1118,6 +1119,15 @@ JS_BINDING_IDLS = \ > $(WebCore)/testing/MockWebAuthenticationConfiguration.idl \ > $(WebCore)/testing/ServiceWorkerInternals.idl \ > $(WebCore)/testing/TypeConversions.idl \ >+ $(WebCore)/testing/FakeXRBoundsPoint.idl \ >+ $(WebCore)/testing/FakeXRButtonStateInit.idl \ >+ $(WebCore)/testing/FakeXRInputSourceInit.idl \ >+ $(WebCore)/testing/FakeXRRigidTransformInit.idl \ >+ $(WebCore)/testing/FakeXRViewInit.idl \ >+ $(WebCore)/testing/WebFakeXRDevice.idl \ >+ $(WebCore)/testing/WebFakeXRInputController.idl \ >+ $(WebCore)/testing/WebXRTest.idl \ >+ $(WebCore)/testing/XRSimulateUserActivationFunction.idl \ > $(WebCore)/workers/AbstractWorker.idl \ > $(WebCore)/workers/DedicatedWorkerGlobalScope.idl \ > $(WebCore)/workers/Worker.idl \ >@@ -1871,4 +1881,3 @@ $(WebCore_BUILTINS_WRAPPERS_PATTERNS) : $(WebCore_BUILTINS_SOURCES) WebCore_BUIL > all : $(notdir $(WebCore_BUILTINS_SOURCES:%.js=%Builtins.h)) $(WebCore_BUILTINS_WRAPPERS) > > # ------------------------ >- >diff --git a/Source/WebCore/Modules/webxr/WebXRSystem.cpp b/Source/WebCore/Modules/webxr/WebXRSystem.cpp >index 3ac4d5280344ea43611384e261a5ffdaf2c1310c..50fd65619c3f7fa27ba2d155cfcc6cecbb4517e5 100644 >--- a/Source/WebCore/Modules/webxr/WebXRSystem.cpp >+++ b/Source/WebCore/Modules/webxr/WebXRSystem.cpp >@@ -87,6 +87,14 @@ void WebXRSystem::stop() > { > } > >+WebXRTest& WebXRSystem::test() const >+{ >+ if (!m_test) >+ m_test = WebXRTest::create(); >+ >+ return *m_test; >+} >+ > } // namespace WebCore > > #endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/Modules/webxr/WebXRSystem.h b/Source/WebCore/Modules/webxr/WebXRSystem.h >index e9ab15d7aea445d1332fc212a456845dced9cee1..959063fe1c6c57eecd1dcc64e48dac4cef053abb 100644 >--- a/Source/WebCore/Modules/webxr/WebXRSystem.h >+++ b/Source/WebCore/Modules/webxr/WebXRSystem.h >@@ -30,6 +30,7 @@ > #include "ActiveDOMObject.h" > #include "EventTarget.h" > #include "JSDOMPromiseDeferred.h" >+#include "WebXRTest.h" > #include "XRSessionMode.h" > #include <wtf/IsoMalloc.h> > #include <wtf/RefCounted.h> >@@ -47,7 +48,7 @@ public: > using RequestSessionPromise = DOMPromiseDeferred<IDLInterface<WebXRSession>>; > > static Ref<WebXRSystem> create(ScriptExecutionContext&); >- virtual ~WebXRSystem(); >+ ~WebXRSystem(); > > using RefCounted<WebXRSystem>::ref; > using RefCounted<WebXRSystem>::deref; >@@ -55,6 +56,8 @@ public: > void isSessionSupported(XRSessionMode, IsSessionSupportedPromise&&); > void requestSession(XRSessionMode, const XRSessionInit&, RequestSessionPromise&&); > >+ WebXRTest& test() const; >+ > protected: > WebXRSystem(ScriptExecutionContext&); > >@@ -67,6 +70,9 @@ protected: > // ActiveDOMObject > const char* activeDOMObjectName() const override; > void stop() override; >+ >+private: >+ mutable RefPtr<WebXRTest> m_test; > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/WebXRSystemWebXRTest.h b/Source/WebCore/Modules/webxr/WebXRSystemWebXRTest.h >new file mode 100644 >index 0000000000000000000000000000000000000000..eb0a7fbdb114cf2a3f3006e7f88a896348efaa8d >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/WebXRSystemWebXRTest.h >@@ -0,0 +1,43 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+#include "WebXRSystem.h" >+ >+namespace WebCore { >+ >+class WebXRTest; >+ >+class WebXRSystemWebXRTest final { >+public: >+ static WebXRTest& test(WebXRSystem& system) { return system.test(); } >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/Modules/webxr/WebXRSystemWebXRTest.idl b/Source/WebCore/Modules/webxr/WebXRSystemWebXRTest.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..e293459f0bcda645e435d53a4099c1eb4eb4d161 >--- /dev/null >+++ b/Source/WebCore/Modules/webxr/WebXRSystemWebXRTest.idl >@@ -0,0 +1,31 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR >+] partial interface WebXRSystem { >+ [SameObject] readonly attribute WebXRTest test; >+}; >\ No newline at end of file >diff --git a/Source/WebCore/Modules/webxr/XRHandedness.h b/Source/WebCore/Modules/webxr/XRHandedness.h >index 9333034d0cd49ac8dee902a081644804378cbc2c..a12705ac89f0510ffe979d0f1c1438d717538115 100644 >--- a/Source/WebCore/Modules/webxr/XRHandedness.h >+++ b/Source/WebCore/Modules/webxr/XRHandedness.h >@@ -32,7 +32,7 @@ namespace WebCore { > enum class XRHandedness { > None, > Left, >- Right, >+ Right > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Modules/webxr/XRTargetRayMode.h b/Source/WebCore/Modules/webxr/XRTargetRayMode.h >index 1fca44e451b97c56026e145b522331f8165bae7f..4e2d2ffb8ec33556d1d0a67b6f66dd8e9a83c5f7 100644 >--- a/Source/WebCore/Modules/webxr/XRTargetRayMode.h >+++ b/Source/WebCore/Modules/webxr/XRTargetRayMode.h >@@ -32,7 +32,7 @@ namespace WebCore { > enum class XRTargetRayMode { > Gaze, > TrackedPointer, >- Screen, >+ Screen > }; > > } // namespace WebCore >diff --git a/Source/WebCore/Sources.txt b/Source/WebCore/Sources.txt >index b27050d62d2939b6bcd530c3a194ca70b9d65857..e48bfe906ebed0044e37d4895fb0f777fa43b723 100644 >--- a/Source/WebCore/Sources.txt >+++ b/Source/WebCore/Sources.txt >@@ -434,6 +434,10 @@ Modules/webxr/XRInputSourcesChangeEvent.cpp @no-unify > Modules/webxr/XRReferenceSpaceEvent.cpp @no-unify > Modules/webxr/XRSessionEvent.cpp @no-unify > >+testing/WebFakeXRDevice.cpp @no-unify >+testing/WebFakeXRInputController.cpp @no-unify >+testing/WebXRTest.cpp @no-unify >+ > #endif > > accessibility/AXObjectCache.cpp >@@ -3555,6 +3559,16 @@ JSXSLTProcessor.cpp > > #if ENABLE_WEBXR > >+JSFakeXRBoundsPoint.cpp >+JSFakeXRButtonStateInit.cpp >+JSFakeXRInputSourceInit.cpp >+JSFakeXRRigidTransformInit.cpp >+JSFakeXRViewInit.cpp >+JSWebFakeXRDevice.cpp >+JSWebFakeXRInputController.cpp >+JSWebXRTest.cpp >+JSXRSimulateUserActivationFunction.cpp >+ > JSWebXRBoundedReferenceSpace.cpp > JSXREnvironmentBlendMode.cpp > JSXREye.cpp >@@ -3578,6 +3592,7 @@ JSXRSessionInit.cpp > JSXRSessionMode.cpp > JSWebXRSpace.cpp > JSWebXRSystem.cpp >+JSWebXRSystemWebXRTest.cpp > JSXRTargetRayMode.cpp > JSWebXRView.cpp > JSWebXRViewerPose.cpp >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index 5979ec326e5bea0c552d25dfc33341f5055ce4a1..f59573c40a27085126a2cde65d06c08069e79d57 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -15142,8 +15142,47 @@ > E18536821F4E472700FE091B /* WebArchiveResourceFromNSAttributedString.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebArchiveResourceFromNSAttributedString.mm; sourceTree = "<group>"; }; > E18C35411F7196CD00FF632D /* WebArchiveResourceWebResourceHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebArchiveResourceWebResourceHandler.h; sourceTree = "<group>"; }; > E18C35421F71970100FF632D /* WebArchiveResourceWebResourceHandler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebArchiveResourceWebResourceHandler.mm; sourceTree = "<group>"; }; >+ E18D83DC243F71CB009247D6 /* FakeXRInputSourceInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRInputSourceInit.idl; sourceTree = "<group>"; }; >+ E18D83DD243F71CC009247D6 /* WebFakeXRInputController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFakeXRInputController.cpp; sourceTree = "<group>"; }; >+ E18D83DE243F71CD009247D6 /* FakeXRButtonStateInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRButtonStateInit.h; sourceTree = "<group>"; }; >+ E18D83DF243F71CD009247D6 /* FakeXRViewInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRViewInit.h; sourceTree = "<group>"; }; >+ E18D83E0243F71CE009247D6 /* WebXRTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebXRTest.cpp; sourceTree = "<group>"; }; >+ E18D83E1243F71CE009247D6 /* WebFakeXRInputController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebFakeXRInputController.idl; sourceTree = "<group>"; }; >+ E18D83E2243F71CF009247D6 /* FakeXRViewInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRViewInit.idl; sourceTree = "<group>"; }; >+ E18D83E3243F71CF009247D6 /* FakeXRButtonStateInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRButtonStateInit.idl; sourceTree = "<group>"; }; >+ E18D83E4243F71D0009247D6 /* FakeXRBoundsPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRBoundsPoint.h; sourceTree = "<group>"; }; >+ E18D83E5243F71D1009247D6 /* FakeXRRigidTransformInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRRigidTransformInit.h; sourceTree = "<group>"; }; >+ E18D83E6243F71D1009247D6 /* FakeXRRigidTransformInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRRigidTransformInit.idl; sourceTree = "<group>"; }; >+ E18D83E7243F71D2009247D6 /* WebFakeXRDevice.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebFakeXRDevice.idl; sourceTree = "<group>"; }; >+ E18D83E8243F71D2009247D6 /* WebXRTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebXRTest.h; sourceTree = "<group>"; }; >+ E18D83E9243F71D3009247D6 /* WebFakeXRDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFakeXRDevice.cpp; sourceTree = "<group>"; }; >+ E18D83EA243F71D4009247D6 /* FakeXRInputSourceInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRInputSourceInit.h; sourceTree = "<group>"; }; >+ E18D83EB243F71D5009247D6 /* WebXRTest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRTest.idl; sourceTree = "<group>"; }; >+ E18D83EC243F71D5009247D6 /* XRSimulateUserActivationFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRSimulateUserActivationFunction.h; sourceTree = "<group>"; }; >+ E18D83ED243F71D6009247D6 /* WebFakeXRDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFakeXRDevice.h; sourceTree = "<group>"; }; >+ E18D83EE243F71D7009247D6 /* WebFakeXRInputController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFakeXRInputController.h; sourceTree = "<group>"; }; >+ E18D83EF243F71D7009247D6 /* FakeXRBoundsPoint.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRBoundsPoint.idl; sourceTree = "<group>"; }; >+ E18D83F0243F71D8009247D6 /* XRSimulateUserActivationFunction.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRSimulateUserActivationFunction.idl; sourceTree = "<group>"; }; > E18DF33418AAF12C00773E59 /* SerializedCryptoKeyWrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedCryptoKeyWrap.h; sourceTree = "<group>"; }; > E18DF33618AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SerializedCryptoKeyWrapMac.mm; sourceTree = "<group>"; }; >+ E19490862434F15800416A99 /* WebXRView.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRView.idl; sourceTree = "<group>"; }; >+ E19490872434F15900416A99 /* WebXRViewport.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRViewport.idl; sourceTree = "<group>"; }; >+ E19490882434F15900416A99 /* WebXRFrame.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRFrame.idl; sourceTree = "<group>"; }; >+ E19490892434F15A00416A99 /* WebXRInputSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRInputSource.idl; sourceTree = "<group>"; }; >+ E194908F2434F15D00416A99 /* WebXRWebGLLayer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRWebGLLayer.idl; sourceTree = "<group>"; }; >+ E19490932434F16000416A99 /* WebXRInputSourceArray.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRInputSourceArray.idl; sourceTree = "<group>"; }; >+ E19490942434F16000416A99 /* WebXRBoundedReferenceSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRBoundedReferenceSpace.idl; sourceTree = "<group>"; }; >+ E19490952434F16100416A99 /* WebXRWebGLLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebXRWebGLLayer.h; sourceTree = "<group>"; }; >+ E19490982434F16200416A99 /* WebXRRigidTransform.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRRigidTransform.idl; sourceTree = "<group>"; }; >+ E194909A2434F16400416A99 /* WebXRSystem.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRSystem.idl; sourceTree = "<group>"; }; >+ E194909B2434F16400416A99 /* WebXRSystemWebXRTest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRSystemWebXRTest.idl; sourceTree = "<group>"; }; >+ E194909C2434F16500416A99 /* WebXRViewerPose.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRViewerPose.idl; sourceTree = "<group>"; }; >+ E194909E2434F16600416A99 /* WebXRSession.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRSession.idl; sourceTree = "<group>"; }; >+ E19490A12434F16800416A99 /* WebXRPose.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRPose.idl; sourceTree = "<group>"; }; >+ E19490A22434F16800416A99 /* WebXRSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRSpace.idl; sourceTree = "<group>"; }; >+ E19490A42434F16900416A99 /* WebXRRenderState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRRenderState.idl; sourceTree = "<group>"; }; >+ E19490A62434F16B00416A99 /* WebXRReferenceSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRReferenceSpace.idl; sourceTree = "<group>"; }; >+ E19490AA2434F16D00416A99 /* WebXRSystemWebXRTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebXRSystemWebXRTest.h; sourceTree = "<group>"; }; > E19727151820549E00592D51 /* CryptoKeyType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoKeyType.h; sourceTree = "<group>"; }; > E19AC3E61824DC7900349426 /* CryptoAlgorithmSHA224.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmSHA224.cpp; sourceTree = "<group>"; }; > E19AC3E71824DC7900349426 /* CryptoAlgorithmSHA224.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoAlgorithmSHA224.h; sourceTree = "<group>"; }; >@@ -18316,6 +18355,16 @@ > children = ( > A1763F3B1E2051AB001D58DE /* cocoa */, > 41815C1B138319630057AAA4 /* js */, >+ E18D83E4243F71D0009247D6 /* FakeXRBoundsPoint.h */, >+ E18D83EF243F71D7009247D6 /* FakeXRBoundsPoint.idl */, >+ E18D83DE243F71CD009247D6 /* FakeXRButtonStateInit.h */, >+ E18D83E3243F71CF009247D6 /* FakeXRButtonStateInit.idl */, >+ E18D83EA243F71D4009247D6 /* FakeXRInputSourceInit.h */, >+ E18D83DC243F71CB009247D6 /* FakeXRInputSourceInit.idl */, >+ E18D83E5243F71D1009247D6 /* FakeXRRigidTransformInit.h */, >+ E18D83E6243F71D1009247D6 /* FakeXRRigidTransformInit.idl */, >+ E18D83DF243F71CD009247D6 /* FakeXRViewInit.h */, >+ E18D83E2243F71CF009247D6 /* FakeXRViewInit.idl */, > 51714EA91CF65899004723C4 /* GCObservation.cpp */, > 51714EAA1CF65899004723C4 /* GCObservation.h */, > 51714EAB1CF65899004723C4 /* GCObservation.idl */, >@@ -18380,6 +18429,17 @@ > EB081CD81696084400553730 /* TypeConversions.h */, > EB081CD91696084400553730 /* TypeConversions.idl */, > E1BA67191742BEF400C20251 /* WebCoreTestShimLibrary.cpp */, >+ E18D83E9243F71D3009247D6 /* WebFakeXRDevice.cpp */, >+ E18D83ED243F71D6009247D6 /* WebFakeXRDevice.h */, >+ E18D83E7243F71D2009247D6 /* WebFakeXRDevice.idl */, >+ E18D83DD243F71CC009247D6 /* WebFakeXRInputController.cpp */, >+ E18D83EE243F71D7009247D6 /* WebFakeXRInputController.h */, >+ E18D83E1243F71CE009247D6 /* WebFakeXRInputController.idl */, >+ E18D83E0243F71CE009247D6 /* WebXRTest.cpp */, >+ E18D83E8243F71D2009247D6 /* WebXRTest.h */, >+ E18D83EB243F71D5009247D6 /* WebXRTest.idl */, >+ E18D83EC243F71D5009247D6 /* XRSimulateUserActivationFunction.h */, >+ E18D83F0243F71D8009247D6 /* XRSimulateUserActivationFunction.idl */, > ); > path = testing; > sourceTree = "<group>"; >@@ -27206,33 +27266,51 @@ > E1EE8B0E2412B17000E794D6 /* NavigatorWebXR.idl */, > E1EE8AD32412B17000E794D6 /* WebXRBoundedReferenceSpace.cpp */, > E1EE8AD12412B17000E794D6 /* WebXRBoundedReferenceSpace.h */, >+ E19490942434F16000416A99 /* WebXRBoundedReferenceSpace.idl */, > E1EE8AF02412B17000E794D6 /* WebXRFrame.cpp */, > E1EE8AE32412B17000E794D6 /* WebXRFrame.h */, >+ E19490882434F15900416A99 /* WebXRFrame.idl */, > E1EE8B0D2412B17000E794D6 /* WebXRInputSource.cpp */, > E1EE8B172412B17000E794D6 /* WebXRInputSource.h */, >+ E19490892434F15A00416A99 /* WebXRInputSource.idl */, > E1EE8AE62412B17000E794D6 /* WebXRInputSourceArray.cpp */, > E1EE8ADD2412B17000E794D6 /* WebXRInputSourceArray.h */, >+ E19490932434F16000416A99 /* WebXRInputSourceArray.idl */, > E1EE8AE52412B17000E794D6 /* WebXRPose.cpp */, > E1EE8AE12412B17000E794D6 /* WebXRPose.h */, >+ E19490A12434F16800416A99 /* WebXRPose.idl */, > E1EE8AD22412B17000E794D6 /* WebXRReferenceSpace.cpp */, > E1EE8B142412B17000E794D6 /* WebXRReferenceSpace.h */, >+ E19490A62434F16B00416A99 /* WebXRReferenceSpace.idl */, > E1EE8ACE2412B17000E794D6 /* WebXRRenderState.cpp */, > E1EE8AD52412B17000E794D6 /* WebXRRenderState.h */, >+ E19490A42434F16900416A99 /* WebXRRenderState.idl */, > E1EE8ACD2412B17000E794D6 /* WebXRRigidTransform.cpp */, > E1EE8B062412B17000E794D6 /* WebXRRigidTransform.h */, >+ E19490982434F16200416A99 /* WebXRRigidTransform.idl */, > E1EE8B0F2412B17000E794D6 /* WebXRSession.cpp */, > E1EE8B112412B17000E794D6 /* WebXRSession.h */, >+ E194909E2434F16600416A99 /* WebXRSession.idl */, > E1EE8AF82412B17000E794D6 /* WebXRSpace.cpp */, > E1EE8ACF2412B17000E794D6 /* WebXRSpace.h */, >+ E19490A22434F16800416A99 /* WebXRSpace.idl */, > E1EE8AE82412B17000E794D6 /* WebXRSystem.cpp */, > E1EE8AE22412B17000E794D6 /* WebXRSystem.h */, >+ E194909A2434F16400416A99 /* WebXRSystem.idl */, >+ E19490AA2434F16D00416A99 /* WebXRSystemWebXRTest.h */, >+ E194909B2434F16400416A99 /* WebXRSystemWebXRTest.idl */, > E1EE8B122412B17000E794D6 /* WebXRView.cpp */, > E1EE8AE02412B17000E794D6 /* WebXRView.h */, >+ E19490862434F15800416A99 /* WebXRView.idl */, > E1EE8B0B2412B17000E794D6 /* WebXRViewerPose.cpp */, > E1EE8AC72412B16F00E794D6 /* WebXRViewerPose.h */, >+ E194909C2434F16500416A99 /* WebXRViewerPose.idl */, > E1EE8AEB2412B17000E794D6 /* WebXRViewport.cpp */, > E1EE8AF42412B17000E794D6 /* WebXRViewport.h */, >+ E19490872434F15900416A99 /* WebXRViewport.idl */, > E1EE8AD82412B17000E794D6 /* WebXRWebGLLayer.cpp */, >+ E19490952434F16100416A99 /* WebXRWebGLLayer.h */, >+ E194908F2434F15D00416A99 /* WebXRWebGLLayer.idl */, > E1EE8AF72412B17000E794D6 /* XRBoundedReferenceSpace.idl */, > E1EE8B052412B17000E794D6 /* XREnvironmentBlendMode.h */, > E1EE8ADA2412B17000E794D6 /* XREnvironmentBlendMode.idl */, >diff --git a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >index c6205c5f6e6b16d82761a455f5f9f0528004e888..f06e422cc6da6f95cad994e6c5892f4dfcc006f5 100644 >--- a/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >+++ b/Source/WebCore/bindings/js/WebCoreBuiltinNames.h >@@ -75,6 +75,8 @@ namespace WebCore { > macro(EnterPictureInPictureEvent) \ > macro(ExtendableEvent) \ > macro(ExtendableMessageEvent) \ >+ macro(FakeXRDevice) \ >+ macro(FakeXRInputController) \ > macro(FetchEvent) \ > macro(FileSystem) \ > macro(FileSystemDirectoryEntry) \ >@@ -250,6 +252,7 @@ namespace WebCore { > macro(XRSessionEvent) \ > macro(XRSpace) \ > macro(XRSystem) \ >+ macro(XRTest) \ > macro(XRView) \ > macro(XRViewerPose) \ > macro(XRViewport) \ >diff --git a/Source/WebCore/page/RuntimeEnabledFeatures.cpp b/Source/WebCore/page/RuntimeEnabledFeatures.cpp >index 64b51f65f8632e0c9038bb43b299505693e4283c..30d3ddbc5ae678562a18a77acfe8dcd6f63e338b 100644 >--- a/Source/WebCore/page/RuntimeEnabledFeatures.cpp >+++ b/Source/WebCore/page/RuntimeEnabledFeatures.cpp >@@ -66,4 +66,12 @@ bool RuntimeEnabledFeatures::touchEventsEnabled() const > } > #endif > >+#if ENABLE(WEBXR) >+void RuntimeEnabledFeatures::setWebXRTestEnabled(bool isEnabled) >+{ >+ RELEASE_ASSERT_WITH_MESSAGE(m_webXREnabled || !isEnabled, "WebXR device API must be enabled to use the WebXR Test API"); >+ m_webXRTestEnabled = isEnabled; >+} >+#endif >+ > } // namespace WebCore >diff --git a/Source/WebCore/page/RuntimeEnabledFeatures.h b/Source/WebCore/page/RuntimeEnabledFeatures.h >index 1ee0d2771575112adb86024d90c18c06cab6693b..7b09b6fff86eea456f5f9a2eeb2190eff8a9cf56 100644 >--- a/Source/WebCore/page/RuntimeEnabledFeatures.h >+++ b/Source/WebCore/page/RuntimeEnabledFeatures.h >@@ -141,6 +141,9 @@ public: > #if ENABLE(WEBXR) > void setWebXREnabled(bool isEnabled) { m_webXREnabled = isEnabled; } > bool webXREnabled() const { return m_webXREnabled; } >+ >+ void setWebXRTestEnabled(bool); >+ bool webXRTestEnabled() const { return m_webXRTestEnabled; }; > #endif > > void setAccessibilityObjectModelEnabled(bool isEnabled) { m_accessibilityObjectModelEnabled = isEnabled; } >@@ -453,6 +456,7 @@ private: > bool m_inspectorAdditionsEnabled { false }; > #if ENABLE(WEBXR) > bool m_webXREnabled { false }; >+ bool m_webXRTestEnabled { false }; > #endif > bool m_accessibilityObjectModelEnabled { false }; > bool m_ariaReflectionEnabled { true }; >diff --git a/Source/WebCore/testing/FakeXRBoundsPoint.h b/Source/WebCore/testing/FakeXRBoundsPoint.h >new file mode 100644 >index 0000000000000000000000000000000000000000..2d7072868231eb293941712ae430fca8fb450643 >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRBoundsPoint.h >@@ -0,0 +1,39 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+namespace WebCore { >+ >+struct FakeXRBoundsPoint { >+ double x; >+ double z; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/FakeXRBoundsPoint.idl b/Source/WebCore/testing/FakeXRBoundsPoint.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..af7955d6bc7f40db3b493c45440843a47e3e823a >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRBoundsPoint.idl >@@ -0,0 +1,31 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] dictionary FakeXRBoundsPoint { >+ double x; double z; >+}; >diff --git a/Source/WebCore/testing/FakeXRButtonStateInit.h b/Source/WebCore/testing/FakeXRButtonStateInit.h >new file mode 100644 >index 0000000000000000000000000000000000000000..5ed98ed8dc4056fe3c806df681cd225d0e92b068 >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRButtonStateInit.h >@@ -0,0 +1,51 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+namespace WebCore { >+ >+struct FakeXRButtonStateInit { >+ enum class Type { >+ Grip, >+ Touchpad, >+ Thumbstick, >+ OptionalButton, >+ OptionalThumbstick >+ }; >+ >+ Type buttonType; >+ bool pressed; >+ bool touched; >+ float pressedValue; >+ float xValue { 0.0 }; >+ float yValue { 0.0 }; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/FakeXRButtonStateInit.idl b/Source/WebCore/testing/FakeXRButtonStateInit.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..0cbcf00bb9b93272466cd8208471694a8c8637a8 >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRButtonStateInit.idl >@@ -0,0 +1,56 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+// Bcause the primary button is always guaranteed to be present, and other buttons >+// should fulfill the role of validating any state from FakeXRButtonStateInit >+// the primary button is not present in this enum. >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] enum FakeXRButtonType { >+ "grip", >+ "touchpad", >+ "thumbstick", >+ // Represents a button whose position is not specified by the xr-standard mapping. >+ // Should appear at one past the last reserved button index. >+ "optional-button", >+ // Represents a thumbstick whose position is not specified by the xr-standard mapping. >+ // Should appear at two past the last reserved button index. >+ "optional-thumbstick" >+}; >+ >+// Used to update the state of optionally supported buttons. >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] dictionary FakeXRButtonStateInit { >+ required FakeXRButtonType buttonType; >+ required boolean pressed; >+ required boolean touched; >+ required float pressedValue; >+ // x and y value are ignored if the FakeXRButtonType is not touchpad, thumbstick, or optional-thumbstick >+ float xValue = 0.0; >+ float yValue = 0.0; >+}; >diff --git a/Source/WebCore/testing/FakeXRInputSourceInit.h b/Source/WebCore/testing/FakeXRInputSourceInit.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ec42a4b3100182b30e3431ef0a48d9e16289840a >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRInputSourceInit.h >@@ -0,0 +1,52 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+#include "FakeXRButtonStateInit.h" >+#include "FakeXRRigidTransformInit.h" >+#include "XREye.h" >+#include "XRHandedness.h" >+#include "XRTargetRayMode.h" >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+struct FakeXRInputSourceInit { >+ XRHandedness handedness; >+ XRTargetRayMode targetRayMode; >+ FakeXRRigidTransformInit pointerOrigin; >+ Vector<String> profiles; >+ bool selectionStarted { false }; >+ bool selectionClicked { false }; >+ Vector<FakeXRButtonStateInit> supportedButtons; >+ FakeXRRigidTransformInit gripOrigin; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/FakeXRInputSourceInit.idl b/Source/WebCore/testing/FakeXRInputSourceInit.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..ab966de8b1f308b4436be13f84283061dae7d7b6 >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRInputSourceInit.idl >@@ -0,0 +1,44 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] dictionary FakeXRInputSourceInit { >+ required XRHandedness handedness; >+ required XRTargetRayMode targetRayMode; >+ required FakeXRRigidTransformInit pointerOrigin; >+ required sequence<DOMString> profiles; >+ // was the primary action pressed when this was connected? >+ boolean selectionStarted = false; >+ // should this input source send a select immediately upon connection? >+ boolean selectionClicked = false; >+ // Initial button state for any buttons beyond the primary that are supported. >+ // If empty, only the primary button is supported. >+ // Note that if any FakeXRButtonType is repeated the behavior is undefined. >+ sequence<FakeXRButtonStateInit> supportedButtons; >+ // If not set the controller is assumed to not be tracked. >+ FakeXRRigidTransformInit gripOrigin; >+}; >\ No newline at end of file >diff --git a/Source/WebCore/testing/FakeXRRigidTransformInit.h b/Source/WebCore/testing/FakeXRRigidTransformInit.h >new file mode 100644 >index 0000000000000000000000000000000000000000..a718329382bb01e44efdb353c55d95c57fbb02ac >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRRigidTransformInit.h >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+struct FakeXRRigidTransformInit { >+ Vector<float> position; >+ Vector<float> orientation; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/FakeXRRigidTransformInit.idl b/Source/WebCore/testing/FakeXRRigidTransformInit.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..4c97d5ecdbf809847d96c169883a32e4a63db2d0 >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRRigidTransformInit.idl >@@ -0,0 +1,35 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+// https://immersive-web.github.io/webxr/#xrrigidtransform >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] dictionary FakeXRRigidTransformInit { >+ // must have three elements >+ required sequence<float> position; >+ // must have four elements >+ required sequence<float> orientation; >+}; >diff --git a/Source/WebCore/testing/FakeXRViewInit.h b/Source/WebCore/testing/FakeXRViewInit.h >new file mode 100644 >index 0000000000000000000000000000000000000000..6f57018e88af3c61b0f077907c8c10a70e657bde >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRViewInit.h >@@ -0,0 +1,57 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+#include "FakeXRRigidTransformInit.h" >+#include "XREye.h" >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+struct FakeXRViewInit { >+ struct DeviceResolution { >+ int width; >+ int height; >+ }; >+ struct FieldOfViewInit { >+ float upDegrees; >+ float downDegrees; >+ float leftDegrees; >+ float rightDegrees; >+ }; >+ >+ XREye eye; >+ Vector<float> projectionMatrix; >+ DeviceResolution resolution; >+ FakeXRRigidTransformInit viewOffset; >+ FieldOfViewInit fieldOfView; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/FakeXRViewInit.idl b/Source/WebCore/testing/FakeXRViewInit.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..4faafcb7723333d63633d759db122200b1c6a9af >--- /dev/null >+++ b/Source/WebCore/testing/FakeXRViewInit.idl >@@ -0,0 +1,67 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+// This represents the native resolution of the device, but may not reflect the viewport exposed to the page. >+// https://immersive-web.github.io/webxr/#xrviewport >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] dictionary FakeXRDeviceResolution { >+ required long width; >+ required long height; >+}; >+ >+// A set of 4 angles which describe the view from a center point, units are degrees. >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] dictionary FakeXRFieldOfViewInit { >+ required float upDegrees; >+ required float downDegrees; >+ required float leftDegrees; >+ required float rightDegrees; >+}; >+ >+// https://immersive-web.github.io/webxr/#xrview >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] dictionary FakeXRViewInit { >+ required XREye eye; >+ // https://immersive-web.github.io/webxr/#view-projection-matrix >+ required sequence<float> projectionMatrix; >+ // https://immersive-web.github.io/webxr/#dom-xrwebgllayer-getviewport >+ required FakeXRDeviceResolution resolution; >+ // https://immersive-web.github.io/webxr/#view-offset >+ // This is the origin of the view in the viewer space. In other words, this is >+ // a transform from the view space to the viewer space. >+ required FakeXRRigidTransformInit viewOffset; >+ // This is an optional means of specifying a decomposed form of the projection >+ // matrix. If specified, the projectionMatrix should be ignored. >+ // Any test that wishes to test clip planes or similar features that would require >+ // decomposing/recomposing the projectionMatrix should use this instead of >+ // the projection matrix. >+ FakeXRFieldOfViewInit fieldOfView; >+}; >diff --git a/Source/WebCore/testing/WebFakeXRDevice.cpp b/Source/WebCore/testing/WebFakeXRDevice.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..2ca5131ff8e0ebb5803973e9c6e94806021361fb >--- /dev/null >+++ b/Source/WebCore/testing/WebFakeXRDevice.cpp >@@ -0,0 +1,68 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WebFakeXRDevice.h" >+ >+#if ENABLE(WEBXR) >+ >+#include "JSDOMPromiseDeferred.h" >+#include "WebFakeXRInputController.h" >+ >+namespace WebCore { >+ >+void WebFakeXRDevice::setViews(Vector<FakeXRViewInit>) { } >+ >+void WebFakeXRDevice::disconnect(DOMPromiseDeferred<void>&& promise) >+{ >+ promise.resolve(); >+} >+ >+void WebFakeXRDevice::setViewerOrigin(FakeXRRigidTransformInit origin, bool emulatedPosition) >+{ >+ UNUSED_PARAM(origin); >+ UNUSED_PARAM(emulatedPosition); >+} >+ >+void WebFakeXRDevice::clearViewerOrigin() { } >+ >+void WebFakeXRDevice::simulateVisibilityChange(XRVisibilityState) { } >+ >+void WebFakeXRDevice::setBoundsGeometry(Vector<FakeXRBoundsPoint>) { } >+ >+void WebFakeXRDevice::setFloorOrigin(FakeXRRigidTransformInit) { } >+ >+void WebFakeXRDevice::clearFloorOrigin() { } >+ >+void WebFakeXRDevice::simulateResetPose() { } >+ >+WebFakeXRInputController WebFakeXRDevice::simulateInputSourceConnection(FakeXRInputSourceInit) >+{ >+ return WebFakeXRInputController(); >+} >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/WebFakeXRDevice.h b/Source/WebCore/testing/WebFakeXRDevice.h >new file mode 100644 >index 0000000000000000000000000000000000000000..d123de6976bf5805eade4c33be6853b8f356f8f6 >--- /dev/null >+++ b/Source/WebCore/testing/WebFakeXRDevice.h >@@ -0,0 +1,67 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+#include "FakeXRBoundsPoint.h" >+#include "FakeXRInputSourceInit.h" >+#include "FakeXRViewInit.h" >+#include "JSDOMPromiseDeferred.h" >+#include "WebFakeXRInputController.h" >+#include "XRVisibilityState.h" >+#include <wtf/RefCounted.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class WebFakeXRDevice : public RefCounted<WebFakeXRDevice> { >+public: >+ >+void setViews(Vector<FakeXRViewInit>); >+ >+void disconnect(DOMPromiseDeferred<void>&&); >+ >+void setViewerOrigin(FakeXRRigidTransformInit origin, bool emulatedPosition = false); >+ >+void clearViewerOrigin(); >+ >+void simulateVisibilityChange(XRVisibilityState); >+ >+void setBoundsGeometry(Vector<FakeXRBoundsPoint> boundsCoordinates); >+ >+void setFloorOrigin(FakeXRRigidTransformInit); >+ >+void clearFloorOrigin(); >+ >+void simulateResetPose(); >+ >+WebFakeXRInputController simulateInputSourceConnection(FakeXRInputSourceInit); >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/WebFakeXRDevice.idl b/Source/WebCore/testing/WebFakeXRDevice.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..a958c59bc90a1a9d9f58f25a424ea92694175588 >--- /dev/null >+++ b/Source/WebCore/testing/WebFakeXRDevice.idl >@@ -0,0 +1,62 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+ InterfaceName=FakeXRDevice, >+ ImplementationLacksVTable, >+] interface WebFakeXRDevice { >+ // Sets the values to be used for subsequent >+ // requestAnimationFrame() callbacks. >+ void setViews(sequence<FakeXRViewInit> views); >+ >+ // behaves as if device was disconnected >+ Promise<void> disconnect(); >+ >+ // Sets the origin of the viewer >+ void setViewerOrigin(FakeXRRigidTransformInit origin, optional boolean emulatedPosition = false); >+ >+ // If an origin is not specified, then the device is assumed to not be tracking, emulatedPosition should >+ // be assumed for cases where the UA must always provide a pose. >+ void clearViewerOrigin(); >+ >+ // Simulates devices focusing and blurring sessions. >+ void simulateVisibilityChange(XRVisibilityState visibilityState); >+ >+ void setBoundsGeometry(sequence<FakeXRBoundsPoint> boundsCoordinates); >+ // Sets the native origin of the physical floor >+ void setFloorOrigin(FakeXRRigidTransformInit floorOrigin); >+ >+ // Indicates that the device can no longer identify the location of the physical floor. >+ void clearFloorOrigin(); >+ >+ // Used to simulate a major change in tracking and that a reset pose event should be fired >+ // https://immersive-web.github.io/webxr/#event-types >+ void simulateResetPose(); >+ >+ // Used to connect and send input events >+ WebFakeXRInputController simulateInputSourceConnection(FakeXRInputSourceInit inputSource); >+}; >\ No newline at end of file >diff --git a/Source/WebCore/testing/WebFakeXRInputController.cpp b/Source/WebCore/testing/WebFakeXRInputController.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..93cb9395872dbcb69d42c0fab88c13770b551f62 >--- /dev/null >+++ b/Source/WebCore/testing/WebFakeXRInputController.cpp >@@ -0,0 +1,69 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WebFakeXRInputController.h" >+ >+#if ENABLE(WEBXR) >+ >+namespace WebCore { >+ >+void WebFakeXRInputController::setHandedness(XRHandedness) { } >+ >+void WebFakeXRInputController::setTargetRayMode(XRTargetRayMode) { } >+ >+void WebFakeXRInputController::setProfiles(Vector<String>) { } >+ >+void WebFakeXRInputController::setGripOrigin(FakeXRRigidTransformInit gripOrigin, bool emulatedPosition) >+{ >+ UNUSED_PARAM(gripOrigin); >+ UNUSED_PARAM(emulatedPosition); >+} >+ >+void WebFakeXRInputController::clearGripOrigin() { } >+ >+void WebFakeXRInputController::setPointerOrigin(FakeXRRigidTransformInit pointerOrigin, bool emulatedPosition) >+{ >+ UNUSED_PARAM(pointerOrigin); >+ UNUSED_PARAM(emulatedPosition); >+} >+ >+void WebFakeXRInputController::disconnect() { } >+ >+void WebFakeXRInputController::reconnect() { } >+ >+void WebFakeXRInputController::startSelection() { } >+ >+void WebFakeXRInputController::endSelection() { } >+ >+void WebFakeXRInputController::simulateSelect() { } >+ >+void WebFakeXRInputController::setSupportedButtons(Vector<FakeXRButtonStateInit>) { } >+ >+void WebFakeXRInputController::updateButtonState(FakeXRButtonStateInit) { } >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/WebFakeXRInputController.h b/Source/WebCore/testing/WebFakeXRInputController.h >new file mode 100644 >index 0000000000000000000000000000000000000000..b47de9635046babeb377d0cdd3b405e2d8c06ee7 >--- /dev/null >+++ b/Source/WebCore/testing/WebFakeXRInputController.h >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+#include "FakeXRButtonStateInit.h" >+#include "FakeXRRigidTransformInit.h" >+#include "XRHandedness.h" >+#include "XRTargetRayMode.h" >+#include <wtf/RefCounted.h> >+#include <wtf/Vector.h> >+ >+namespace WebCore { >+ >+class WebFakeXRInputController : public RefCounted<WebFakeXRInputController> { >+public: >+ >+void setHandedness(XRHandedness); >+ >+void setTargetRayMode(XRTargetRayMode); >+ >+void setProfiles(Vector<String>); >+ >+void setGripOrigin(FakeXRRigidTransformInit gripOrigin, bool emulatedPosition = false); >+ >+void clearGripOrigin(); >+ >+void setPointerOrigin(FakeXRRigidTransformInit pointerOrigin, bool emulatedPosition = false); >+ >+void disconnect(); >+ >+void reconnect(); >+ >+void startSelection(); >+ >+void endSelection(); >+ >+void simulateSelect(); >+ >+void setSupportedButtons(Vector<FakeXRButtonStateInit>); >+ >+void updateButtonState(FakeXRButtonStateInit); >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/WebFakeXRInputController.idl b/Source/WebCore/testing/WebFakeXRInputController.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..e83ca336ceea648aaf439f298b62655b0a3ab8fc >--- /dev/null >+++ b/Source/WebCore/testing/WebFakeXRInputController.idl >@@ -0,0 +1,76 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+ ImplementationLacksVTable, >+ InterfaceName=FakeXRInputController >+] interface WebFakeXRInputController { >+ // Indicates that the handedness of the device has changed. >+ void setHandedness(XRHandedness handedness); >+ >+ // Indicates that the target ray mode of the device has changed. >+ void setTargetRayMode(XRTargetRayMode targetRayMode); >+ >+ // Indicates that the list of profiles representing the device has changed. >+ void setProfiles(sequence<DOMString> profiles); >+ >+ // Sets or clears the position of the controller. If not set, the controller is assumed to >+ // not be tracked. >+ void setGripOrigin(FakeXRRigidTransformInit gripOrigin, optional boolean emulatedPosition = false); >+ void clearGripOrigin(); >+ >+ // Sets the pointer origin for the controller. >+ void setPointerOrigin(FakeXRRigidTransformInit pointerOrigin, optional boolean emulatedPosition = false); >+ >+ // Temporarily disconnect the input device >+ void disconnect(); >+ >+ // Reconnect a disconnected input device >+ void reconnect(); >+ >+ // Start a selection for the current frame with the primary input >+ // If a gamepad is supported, should update the state of the primary button accordingly. >+ void startSelection(); >+ >+ // End selection for the current frame with the primary input >+ // If a gamepad is supported, should update the state of the primary button accordingly. >+ void endSelection(); >+ >+ // Simulates a start/endSelection for the current frame with the primary input >+ // If a gamepad is supported, should update the state of the primary button accordingly. >+ void simulateSelect(); >+ >+ // Updates the set of supported buttons, including any initial state. >+ // Note that this method should not be generally used to update the state of the >+ // buttons, as the UA may treat this as re-creating the Gamepad. >+ // Note that if any FakeXRButtonType is repeated the behavior is undefined. >+ void setSupportedButtons(sequence<FakeXRButtonStateInit> supportedButtons); >+ >+ // Used to update the state of a button currently supported by the input source >+ // Will not add support for that button if it is not currently supported. >+ void updateButtonState(FakeXRButtonStateInit buttonState); >+}; >diff --git a/Source/WebCore/testing/WebXRTest.cpp b/Source/WebCore/testing/WebXRTest.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..d732a85dbbec093ed446cad1703d1f3dd8598970 >--- /dev/null >+++ b/Source/WebCore/testing/WebXRTest.cpp >@@ -0,0 +1,41 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "WebXRTest.h" >+ >+#if ENABLE(WEBXR) >+ >+namespace WebCore { >+ >+void WebXRTest::simulateDeviceConnection(FakeXRDeviceInit, WebFakeXRDevicePromise&&) const { } >+ >+void WebXRTest::simulateUserActivation(XRSimulateUserActivationFunction&) { } >+ >+void WebXRTest::disconnectAllDevices(DOMPromiseDeferred<void>&&) { } >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/WebXRTest.h b/Source/WebCore/testing/WebXRTest.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1614ed79bc472260eac9fa8d774ce922dd49b731 >--- /dev/null >+++ b/Source/WebCore/testing/WebXRTest.h >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+#include "JSDOMPromiseDeferred.h" >+#include "WebFakeXRDevice.h" >+#include "XRSessionMode.h" >+#include "XRSimulateUserActivationFunction.h" >+#include <JavaScriptCore/JSCJSValue.h> >+#include <wtf/Optional.h> >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class WebXRTest : public RefCounted<WebXRTest> { >+public: >+ struct FakeXRDeviceInit { >+ bool supportsImmersive { false }; >+ Optional<Vector<XRSessionMode>> supportedModes; >+ Vector<FakeXRViewInit> views; >+ >+ Optional<Vector<JSC::JSValue>> supportedFeatures; >+ >+ Optional<Vector<FakeXRBoundsPoint>> boundsCoordinates; >+ >+ Optional<FakeXRRigidTransformInit> floorOrigin; >+ Optional<FakeXRRigidTransformInit> viewerOrigin; >+ }; >+ >+ static Ref<WebXRTest> create() { return adoptRef(*new WebXRTest()); } >+ >+ using WebFakeXRDevicePromise = DOMPromiseDeferred<IDLInterface<WebFakeXRDevice>>; >+ void simulateDeviceConnection(FakeXRDeviceInit, WebFakeXRDevicePromise&&) const; >+ >+ // Simulates a user activation (aka user gesture) for the current scope. >+ // The activation is only guaranteed to be valid in the provided function and only applies to WebXR >+ // Device API methods. >+ void simulateUserActivation(XRSimulateUserActivationFunction&); >+ >+ // Disconnect all fake devices >+ void disconnectAllDevices(DOMPromiseDeferred<void>&&); >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/WebXRTest.idl b/Source/WebCore/testing/WebXRTest.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..29a33da5779d0d82b3f59d65e9db3e4f2e93f48e >--- /dev/null >+++ b/Source/WebCore/testing/WebXRTest.idl >@@ -0,0 +1,81 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+ ExportMacro=WEBCORE_TESTSUPPORT_EXPORT, >+ Exposed=Window, >+ InterfaceName=XRTest, >+ ImplementationLacksVTable, >+] interface WebXRTest { >+ // Simulates connecting a device to the system. >+ // Used to instantiate a fake device for use in tests. >+ Promise<WebFakeXRDevice> simulateDeviceConnection(FakeXRDeviceInit init); >+ >+ // Simulates a user activation (aka user gesture) for the current scope. >+ // The activation is only guaranteed to be valid in the provided function and only applies to WebXR >+ // Device API methods. >+ void simulateUserActivation(XRSimulateUserActivationFunction f); >+ >+ // Disconnect all fake devices >+ Promise<void> disconnectAllDevices(); >+}; >+ >+[ >+ EnabledAtRuntime=WebXRTest, >+ Conditional=WEBXR, >+] dictionary FakeXRDeviceInit { >+ // Deprecated - use `supportedModes` instead. >+ required boolean supportsImmersive; >+ // Sequence of modes that should be supported by this device. >+ sequence<XRSessionMode> supportedModes; >+ required sequence<FakeXRViewInit> views; >+ >+ // https://immersive-web.github.io/webxr/#feature-name >+ // The list of feature names that this device supports. >+ // Any requests for features not in this list should be rejected, with the exception of those >+ // that are guaranteed regardless of device availability (e.g. 'viewer'). >+ // If not specified/empty, the device supports no features. >+ // NOTE: This is meant to emulate hardware support, not whether a feature is >+ // currently available (e.g. bounds not being tracked per below) >+ sequence<any> supportedFeatures; >+ >+ // The bounds coordinates. If empty, no bounded reference space is currently tracked. >+ // If not, must have at least three elements. >+ sequence<FakeXRBoundsPoint> boundsCoordinates; >+ >+ // A transform used to identify the physical position of the user's floor. >+ // If not set, indicates that the device cannot identify the physical floor. >+ FakeXRRigidTransformInit floorOrigin; >+ >+ // native origin of the viewer >+ // If not set, the device is currently assumed to not be tracking, and xrFrame.getViewerPose should >+ // not return a pose. >+ // >+ // This sets the viewer origin *shortly after* initialization; since the viewer origin at initialization >+ // is used to provide a reference origin for all matrices. >+ FakeXRRigidTransformInit viewerOrigin; >+}; >diff --git a/Source/WebCore/testing/XRSimulateUserActivationFunction.h b/Source/WebCore/testing/XRSimulateUserActivationFunction.h >new file mode 100644 >index 0000000000000000000000000000000000000000..bf3b871c26123c8120bf7696ffbd398a3bb8a825 >--- /dev/null >+++ b/Source/WebCore/testing/XRSimulateUserActivationFunction.h >@@ -0,0 +1,47 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(WEBXR) >+ >+#include "ActiveDOMCallback.h" >+#include "CallbackResult.h" >+#include <wtf/RefCounted.h> >+ >+namespace WebCore { >+ >+class WebXRFrame; >+ >+class XRSimulateUserActivationFunction : public RefCounted<XRSimulateUserActivationFunction>, public ActiveDOMCallback { >+public: >+ using ActiveDOMCallback::ActiveDOMCallback; >+ >+ virtual CallbackResult<void> handleEvent(JSC::JSValue) = 0; >+}; >+ >+} // namespace WebCore >+ >+#endif // ENABLE(WEBXR) >diff --git a/Source/WebCore/testing/XRSimulateUserActivationFunction.idl b/Source/WebCore/testing/XRSimulateUserActivationFunction.idl >new file mode 100644 >index 0000000000000000000000000000000000000000..5ebf959f04e39049ca05b5cb7b21dc993ea8d2fc >--- /dev/null >+++ b/Source/WebCore/testing/XRSimulateUserActivationFunction.idl >@@ -0,0 +1,28 @@ >+/* >+ * Copyright (C) 2020 Igalia S.L. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY >+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES >+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; >+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON >+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+[ >+ Conditional=WEBXR, >+ EnabledAtRuntime=WebXRTest >+] callback XRSimulateUserActivationFunction = void (any... arguments);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
dino
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 209859
:
395179
| 395954 |
396646
|
396688
|
396748
|
397078
|
397108