Title: [260432] trunk
Revision
260432
Author
svil...@igalia.com
Date
2020-04-21 09:30:31 -0700 (Tue, 21 Apr 2020)

Log Message

[WebXR] Test IDLs and stubs
https://bugs.webkit.org/show_bug.cgi?id=209859

Reviewed by Dean Jackson and Youenn Fablet.

Source/WebCore:

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.

In order not to expose the API to the web we're adding the XRTest
interface to Internals instead. The mapping from internals.xrTest to
navigator.xr.test happens in the WPT code.

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: Added new files.
* DerivedSources.make: Ditto.
* Modules/webxr/NavigatorWebXR.h: Export API to be used in testing code.
* Modules/webxr/WebXRSystem.h: Export ::from and ::xr methods.
* Sources.txt: Added new files.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* bindings/js/WebCoreBuiltinNames.h: Added some new macros.
* 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/Internals.cpp:
(WebCore::Internals::xrTest): Added WebXRTest to Internals.
* testing/Internals.h: Added xrTest() accessor.
* testing/Internals.idl: Added xrTest attribute.
* 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: Ditto.

LayoutTests:

* platform/wpe/TestExpectations: Added bug number to the passing webxr test.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (260431 => 260432)


--- trunk/LayoutTests/ChangeLog	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/LayoutTests/ChangeLog	2020-04-21 16:30:31 UTC (rev 260432)
@@ -1,3 +1,12 @@
+2020-04-21  Sergio Villar Senin  <svil...@igalia.com>
+
+        [WebXR] Test IDLs and stubs
+        https://bugs.webkit.org/show_bug.cgi?id=209859
+
+        Reviewed by Dean Jackson and Youenn Fablet.
+
+        * platform/wpe/TestExpectations: Added bug number to the passing webxr test.
+
 2020-04-21  Carlos Alberto Lopez Perez  <clo...@igalia.com>
 
         [GTK] Gardening of  WPT tests for Intersection Observer v2 after r260388

Modified: trunk/LayoutTests/platform/wpe/TestExpectations (260431 => 260432)


--- trunk/LayoutTests/platform/wpe/TestExpectations	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/LayoutTests/platform/wpe/TestExpectations	2020-04-21 16:30:31 UTC (rev 260432)
@@ -1022,7 +1022,8 @@
 # Passing since r257562.
 imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-013.html [ Pass ]
 
-imported/w3c/web-platform-tests/webxr/idlharness.https.window.html [ Pass ]
+# WebXR
+webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/idlharness.https.window.html [ Pass ]
 
 #////////////////////////////////////////////////////////////////////////////////////////
 # 5. TESTS CRASHING

Modified: trunk/Source/WebCore/CMakeLists.txt (260431 => 260432)


--- trunk/Source/WebCore/CMakeLists.txt	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/CMakeLists.txt	2020-04-21 16:30:31 UTC (rev 260432)
@@ -159,6 +159,7 @@
     "${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"
@@ -1656,6 +1657,25 @@
     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

Modified: trunk/Source/WebCore/ChangeLog (260431 => 260432)


--- trunk/Source/WebCore/ChangeLog	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/ChangeLog	2020-04-21 16:30:31 UTC (rev 260432)
@@ -1,3 +1,86 @@
+2020-04-16  Sergio Villar Senin  <svil...@igalia.com>
+
+        [WebXR] Test IDLs and stubs
+        https://bugs.webkit.org/show_bug.cgi?id=209859
+
+        Reviewed by Dean Jackson and Youenn Fablet.
+
+        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.
+
+        In order not to expose the API to the web we're adding the XRTest
+        interface to Internals instead. The mapping from internals.xrTest to
+        navigator.xr.test happens in the WPT code.
+
+        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: Added new files.
+        * DerivedSources.make: Ditto.
+        * Modules/webxr/NavigatorWebXR.h: Export API to be used in testing code.
+        * Modules/webxr/WebXRSystem.h: Export ::from and ::xr methods.
+        * Sources.txt: Added new files.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * bindings/js/WebCoreBuiltinNames.h: Added some new macros.
+        * 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/Internals.cpp:
+        (WebCore::Internals::xrTest): Added WebXRTest to Internals.
+        * testing/Internals.h: Added xrTest() accessor.
+        * testing/Internals.idl: Added xrTest attribute.
+        * 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: Ditto.
+
 2020-04-21  Claudio Saavedra  <csaave...@igalia.com>
 
         [GTK4] Adapt to GtkIconTheme API changes

Modified: trunk/Source/WebCore/DerivedSources.make (260431 => 260432)


--- trunk/Source/WebCore/DerivedSources.make	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/DerivedSources.make	2020-04-21 16:30:31 UTC (rev 260432)
@@ -1118,6 +1118,15 @@
     $(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 \

Modified: trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h (260431 => 260432)


--- trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -39,11 +39,11 @@
 class NavigatorWebXR final : public Supplement<Navigator> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
+    WEBCORE_EXPORT static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
 
+    WEBCORE_EXPORT static NavigatorWebXR& from(Navigator&);
+
 private:
-    static NavigatorWebXR& from(Navigator&);
-
     RefPtr<WebXRSystem> m_xr;
 };
 

Modified: trunk/Source/WebCore/Modules/webxr/WebXRSystem.h (260431 => 260432)


--- trunk/Source/WebCore/Modules/webxr/WebXRSystem.h	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/Modules/webxr/WebXRSystem.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -33,6 +33,7 @@
 #include "XRSessionMode.h"
 #include <wtf/IsoMalloc.h>
 #include <wtf/RefCounted.h>
+#include <wtf/WeakPtr.h>
 
 namespace WebCore {
 
@@ -40,7 +41,7 @@
 class WebXRSession;
 struct XRSessionInit;
 
-class WebXRSystem final : public RefCounted<WebXRSystem>, public EventTargetWithInlineData, public ActiveDOMObject {
+class WebXRSystem final : public RefCounted<WebXRSystem>, public EventTargetWithInlineData, public ActiveDOMObject, public CanMakeWeakPtr<WebXRSystem> {
     WTF_MAKE_ISO_ALLOCATED(WebXRSystem);
 public:
     using IsSessionSupportedPromise = DOMPromiseDeferred<IDLBoolean>;
@@ -47,7 +48,7 @@
     using RequestSessionPromise = DOMPromiseDeferred<IDLInterface<WebXRSession>>;
 
     static Ref<WebXRSystem> create(ScriptExecutionContext&);
-    virtual ~WebXRSystem();
+    ~WebXRSystem();
 
     using RefCounted<WebXRSystem>::ref;
     using RefCounted<WebXRSystem>::deref;
@@ -55,9 +56,7 @@
     void isSessionSupported(XRSessionMode, IsSessionSupportedPromise&&);
     void requestSession(XRSessionMode, const XRSessionInit&, RequestSessionPromise&&);
 
-private:
-    WebXRSystem(ScriptExecutionContext&);
-
+protected:
     // EventTarget
     EventTargetInterface eventTargetInterface() const override { return WebXRSystemEventTargetInterfaceType; }
     ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); }
@@ -67,6 +66,9 @@
     // ActiveDOMObject
     const char* activeDOMObjectName() const override;
     void stop() override;
+
+private:
+    WebXRSystem(ScriptExecutionContext&);
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Sources.txt (260431 => 260432)


--- trunk/Source/WebCore/Sources.txt	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/Sources.txt	2020-04-21 16:30:31 UTC (rev 260432)
@@ -434,6 +434,10 @@
 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/AXLogger.cpp
@@ -3558,6 +3562,16 @@
 
 #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

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (260431 => 260432)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-04-21 16:30:31 UTC (rev 260432)
@@ -15148,8 +15148,45 @@
 		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>"; };
+		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>"; };
 		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>"; };
@@ -18325,6 +18362,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 */,
@@ -18389,6 +18436,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>";
@@ -27221,33 +27279,49 @@
 				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 */,
 				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 */,

Modified: trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h (260431 => 260432)


--- trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -75,6 +75,8 @@
     macro(EnterPictureInPictureEvent) \
     macro(ExtendableEvent) \
     macro(ExtendableMessageEvent) \
+    macro(FakeXRDevice) \
+    macro(FakeXRInputController) \
     macro(FetchEvent) \
     macro(FileSystem) \
     macro(FileSystemDirectoryEntry) \
@@ -251,6 +253,7 @@
     macro(XRSession) \
     macro(XRSessionEvent) \
     macro(XRSpace) \
+    macro(XRTest) \
     macro(XRView) \
     macro(XRViewerPose) \
     macro(XRViewport) \

Copied: trunk/Source/WebCore/testing/FakeXRBoundsPoint.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRBoundsPoint.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRBoundsPoint.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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)

Copied: trunk/Source/WebCore/testing/FakeXRBoundsPoint.idl (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRBoundsPoint.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRBoundsPoint.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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=WebXR,
+    Conditional=WEBXR,
+] dictionary FakeXRBoundsPoint {
+    double x; double z;
+};

Copied: trunk/Source/WebCore/testing/FakeXRButtonStateInit.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRButtonStateInit.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRButtonStateInit.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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)

Copied: trunk/Source/WebCore/testing/FakeXRButtonStateInit.idl (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRButtonStateInit.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRButtonStateInit.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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.
+ */
+
+// Because 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=WebXR,
+    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=WebXR,
+    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;
+};

Copied: trunk/Source/WebCore/testing/FakeXRInputSourceInit.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRInputSourceInit.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRInputSourceInit.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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)

Copied: trunk/Source/WebCore/testing/FakeXRInputSourceInit.idl (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRInputSourceInit.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRInputSourceInit.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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=WebXR,
+    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

Copied: trunk/Source/WebCore/testing/FakeXRRigidTransformInit.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRRigidTransformInit.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRRigidTransformInit.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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)

Copied: trunk/Source/WebCore/testing/FakeXRRigidTransformInit.idl (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRRigidTransformInit.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRRigidTransformInit.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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=WebXR,
+    Conditional=WEBXR,
+] dictionary FakeXRRigidTransformInit {
+    // must have three elements
+    required sequence<float> position;
+    // must have four elements
+    required sequence<float> orientation;
+};

Copied: trunk/Source/WebCore/testing/FakeXRViewInit.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRViewInit.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRViewInit.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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)

Added: trunk/Source/WebCore/testing/FakeXRViewInit.idl (0 => 260432)


--- trunk/Source/WebCore/testing/FakeXRViewInit.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/FakeXRViewInit.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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=WebXR,
+    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=WebXR,
+    Conditional=WEBXR,
+] dictionary FakeXRFieldOfViewInit {
+    required float upDegrees;
+    required float downDegrees;
+    required float leftDegrees;
+    required float rightDegrees;
+};
+
+// https://immersive-web.github.io/webxr/#xrview
+[
+    EnabledAtRuntime=WebXR,
+    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;
+};
Property changes on: trunk/Source/WebCore/testing/FakeXRViewInit.idl
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Modified: trunk/Source/WebCore/testing/Internals.cpp (260431 => 260432)


--- trunk/Source/WebCore/testing/Internals.cpp	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/testing/Internals.cpp	2020-04-21 16:30:31 UTC (rev 260432)
@@ -310,6 +310,12 @@
 #include "PaymentCoordinator.h"
 #endif
 
+#if ENABLE(WEBXR)
+#include "NavigatorWebXR.h"
+#include "WebXRSystem.h"
+#include "WebXRTest.h"
+#endif
+
 #if PLATFORM(MAC) && USE(LIBWEBRTC)
 #include <webrtc/sdk/WebKit/VideoProcessingSoftLink.h>
 #endif
@@ -5655,4 +5661,30 @@
     return m_sleepDisablers.remove(identifier);
 }
 
+#if ENABLE(WEBXR)
+
+ExceptionOr<RefPtr<WebXRTest>> Internals::xrTest()
+{
+    if (!RuntimeEnabledFeatures::sharedFeatures().webXREnabled())
+        return Exception { InvalidAccessError };
+
+    if (!m_xrTest) {
+        if (!contextDocument() || !contextDocument()->domWindow())
+            return Exception { InvalidAccessError };
+
+        auto* navigator = contextDocument()->domWindow()->optionalNavigator();
+        if (!navigator)
+            return Exception { InvalidAccessError };
+
+        auto& navigatorXR = NavigatorWebXR::from(*navigator);
+        auto& xrSystem = navigatorXR.xr(*scriptExecutionContext(), *navigator);
+
+        m_xrTest = WebXRTest::create(makeWeakPtr(&xrSystem));
+    }
+    return m_xrTest.get();
+}
+
+#endif
+
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/testing/Internals.h (260431 => 260432)


--- trunk/Source/WebCore/testing/Internals.h	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/testing/Internals.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -117,6 +117,10 @@
 class ServiceWorker;
 #endif
 
+#if ENABLE(WEBXR)
+class WebXRTest;
+#endif
+
 template<typename IDLType> class DOMPromiseDeferred;
 
 struct MockWebAuthenticationConfiguration;
@@ -1002,6 +1006,10 @@
     unsigned createSleepDisabler(const String& reason, bool display);
     bool destroySleepDisabler(unsigned identifier);
 
+#if ENABLE(WEBXR)
+    ExceptionOr<RefPtr<WebXRTest>> xrTest();
+#endif
+
 private:
     explicit Internals(Document&);
     Document* contextDocument() const;
@@ -1026,6 +1034,10 @@
     RefPtr<CacheStorageConnection> m_cacheStorageConnection;
 
     HashMap<unsigned, std::unique_ptr<WebCore::SleepDisabler>> m_sleepDisablers;
+
+#if ENABLE(WEBXR)
+    RefPtr<WebXRTest> m_xrTest;
+#endif
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/testing/Internals.idl (260431 => 260432)


--- trunk/Source/WebCore/testing/Internals.idl	2020-04-21 16:21:31 UTC (rev 260431)
+++ trunk/Source/WebCore/testing/Internals.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -906,4 +906,6 @@
 
     unsigned long createSleepDisabler(DOMString reason, boolean display);
     boolean destroySleepDisabler(unsigned long identifier);
+
+    [Conditional=WEBXR, MayThrowException] readonly attribute WebXRTest xrTest;
 };

Copied: trunk/Source/WebCore/testing/WebFakeXRDevice.cpp (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/WebFakeXRDevice.cpp	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebFakeXRDevice.cpp	2020-04-21 16:30:31 UTC (rev 260432)
@@ -0,0 +1,82 @@
+/*
+ * 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)

Copied: trunk/Source/WebCore/testing/WebFakeXRDevice.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/WebFakeXRDevice.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebFakeXRDevice.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -0,0 +1,66 @@
+/*
+ * 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 final : 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)

Added: trunk/Source/WebCore/testing/WebFakeXRDevice.idl (0 => 260432)


--- trunk/Source/WebCore/testing/WebFakeXRDevice.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebFakeXRDevice.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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=WebXR,
+    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
Property changes on: trunk/Source/WebCore/testing/WebFakeXRDevice.idl
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Copied: trunk/Source/WebCore/testing/WebFakeXRInputController.cpp (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/WebFakeXRInputController.cpp	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebFakeXRInputController.cpp	2020-04-21 16:30:31 UTC (rev 260432)
@@ -0,0 +1,91 @@
+/*
+ * 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)

Copied: trunk/Source/WebCore/testing/WebFakeXRInputController.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/WebFakeXRInputController.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebFakeXRInputController.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -0,0 +1,70 @@
+/*
+ * 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 final : 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)

Added: trunk/Source/WebCore/testing/WebFakeXRInputController.idl (0 => 260432)


--- trunk/Source/WebCore/testing/WebFakeXRInputController.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebFakeXRInputController.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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=WebXR,
+    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);
+};
Property changes on: trunk/Source/WebCore/testing/WebFakeXRInputController.idl
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Copied: trunk/Source/WebCore/testing/WebXRTest.cpp (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/WebXRTest.cpp	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebXRTest.cpp	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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.
+ */
+
+#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)

Copied: trunk/Source/WebCore/testing/WebXRTest.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/WebXRSystem.h) (0 => 260432)


--- trunk/Source/WebCore/testing/WebXRTest.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebXRTest.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -0,0 +1,79 @@
+/*
+ * 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 <_javascript_Core/JSCJSValue.h>
+#include <wtf/Optional.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class WebXRSystem;
+
+class WebXRTest final : 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(WeakPtr<WebXRSystem>&& system) { return adoptRef(*new WebXRTest(WTFMove(system))); }
+
+    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>&&);
+
+private:
+    WebXRTest(WeakPtr<WebXRSystem>&& system)
+        : m_context(WTFMove(system)) { }
+
+    WeakPtr<WebXRSystem> m_context;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBXR)

Added: trunk/Source/WebCore/testing/WebXRTest.idl (0 => 260432)


--- trunk/Source/WebCore/testing/WebXRTest.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/WebXRTest.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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=WebXR,
+    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=WebXR,
+    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;
+};
Property changes on: trunk/Source/WebCore/testing/WebXRTest.idl
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property

Copied: trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.h (from rev 260431, trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h) (0 => 260432)


--- trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.h	                        (rev 0)
+++ trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.h	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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)

Added: trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.idl (0 => 260432)


--- trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.idl	                        (rev 0)
+++ trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.idl	2020-04-21 16:30:31 UTC (rev 260432)
@@ -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=WebXR
+] callback XRSimulateUserActivationFunction = void (any... arguments);
Property changes on: trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.idl
___________________________________________________________________

Added: svn:eol-style

+LF \ No newline at end of property
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to