Changeset 260505 in webkit


Ignore:
Timestamp:
Apr 22, 2020 3:19:30 AM (4 years ago)
Author:
svillar@igalia.com
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.
  • 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.
Location:
trunk
Files:
5 added
12 edited
16 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r260503 r260505  
     12020-04-21  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [WebXR] Test IDLs and stubs
     4        https://bugs.webkit.org/show_bug.cgi?id=209859
     5
     6        Reviewed by Dean Jackson and Youenn Fablet.
     7
     8        * platform/wpe/TestExpectations: Added bug number to the passing webxr test.
     9
    1102020-04-22  Diego Pino Garcia  <dpino@igalia.com>
    211
  • trunk/LayoutTests/platform/wpe/TestExpectations

    r260494 r260505  
    10231023imported/w3c/web-platform-tests/css/css-text/white-space/pre-wrap-013.html [ Pass ]
    10241024
    1025 imported/w3c/web-platform-tests/webxr/idlharness.https.window.html [ Pass ]
     1025# WebXR
     1026webkit.org/b/209859 imported/w3c/web-platform-tests/webxr/idlharness.https.window.html [ Pass ]
    10261027
    10271028#////////////////////////////////////////////////////////////////////////////////////////
  • trunk/Source/WebCore/CMakeLists.txt

    r260436 r260505  
    16571657)
    16581658
     1659
     1660if (ENABLE_WEBXR)
     1661    list(APPEND WebCoreTestSupport_IDL_FILES
     1662        testing/FakeXRBoundsPoint.idl
     1663        testing/FakeXRButtonStateInit.idl
     1664        testing/FakeXRInputSourceInit.idl
     1665        testing/FakeXRRigidTransformInit.idl
     1666        testing/FakeXRViewInit.idl
     1667        testing/WebFakeXRDevice.idl
     1668        testing/WebFakeXRInputController.idl
     1669        testing/WebXRTest.idl
     1670        testing/XRSimulateUserActivationFunction.idl
     1671    )
     1672    list(APPEND WebCoreTestSupport_SOURCES
     1673        testing/WebFakeXRDevice.cpp
     1674        testing/WebFakeXRInputController.cpp
     1675        testing/WebXRTest.cpp
     1676    )
     1677endif ()
     1678
    16591679# Modules that the bindings generator scripts may use
    16601680set(SCRIPTS_RESOLVE_SUPPLEMENTAL
  • trunk/Source/WebCore/ChangeLog

    r260504 r260505  
     12020-04-21  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        [WebXR] Test IDLs and stubs
     4        https://bugs.webkit.org/show_bug.cgi?id=209859
     5
     6        Reviewed by Dean Jackson and Youenn Fablet.
     7
     8        WebXR testing is hard as it might involve interaction with actual
     9        devices. That's why the WebXR testing
     10        API (https://immersive-web.github.io/webxr-test-api/) was
     11        proposed. In fact, all the current WebXR tests from
     12        web-platform-tests are using that testing API. This new testing
     13        API supplements navigator.xr and is accessed through
     14        navigator.xr.test.
     15
     16        In order not to expose the API to the web we're adding the XRTest
     17        interface to Internals instead. The mapping from internals.xrTest to
     18        navigator.xr.test happens in the WPT code.
     19
     20        We're adding the required IDLs and very basic (mostly empty)
     21        implementations for testing methods. We're adding testing
     22        infrastructure, adding tests make no sense for this change.
     23
     24        * CMakeLists.txt: Added new files.
     25        * DerivedSources.make: Ditto.
     26        * Modules/webxr/NavigatorWebXR.h: Export API to be used in testing code.
     27        * Modules/webxr/WebXRSystem.h: Export ::from and ::xr methods.
     28        * WebCore.xcodeproj/project.pbxproj: Ditto.
     29        * bindings/js/WebCoreBuiltinNames.h: Added some new macros.
     30        * testing/FakeXRBoundsPoint.h: Added.
     31        * testing/FakeXRBoundsPoint.idl: Added.
     32        * testing/FakeXRButtonStateInit.h: Added.
     33        * testing/FakeXRButtonStateInit.idl: Added.
     34        * testing/FakeXRInputSourceInit.h: Added.
     35        * testing/FakeXRInputSourceInit.idl: Added.
     36        * testing/FakeXRRigidTransformInit.h: Added.
     37        * testing/FakeXRRigidTransformInit.idl: Added.
     38        * testing/FakeXRViewInit.h: Added.
     39        * testing/FakeXRViewInit.idl: Added.
     40        * testing/Internals.cpp:
     41        (WebCore::Internals::xrTest): Added WebXRTest to Internals.
     42        * testing/Internals.h: Added xrTest() accessor.
     43        * testing/Internals.idl: Added xrTest attribute.
     44        * testing/WebFakeXRDevice.cpp: Added.
     45        (WebCore::WebFakeXRDevice::setViews):
     46        (WebCore::WebFakeXRDevice::disconnect):
     47        (WebCore::WebFakeXRDevice::setViewerOrigin):
     48        (WebCore::WebFakeXRDevice::clearViewerOrigin):
     49        (WebCore::WebFakeXRDevice::simulateVisibilityChange):
     50        (WebCore::WebFakeXRDevice::setBoundsGeometry):
     51        (WebCore::WebFakeXRDevice::setFloorOrigin):
     52        (WebCore::WebFakeXRDevice::clearFloorOrigin):
     53        (WebCore::WebFakeXRDevice::simulateResetPose):
     54        (WebCore::WebFakeXRDevice::simulateInputSourceConnection):
     55        * testing/WebFakeXRDevice.h: Added.
     56        * testing/WebFakeXRDevice.idl: Added.
     57        * testing/WebFakeXRInputController.cpp: Added.
     58        (WebCore::WebFakeXRInputController::setHandedness):
     59        (WebCore::WebFakeXRInputController::setTargetRayMode):
     60        (WebCore::WebFakeXRInputController::setProfiles):
     61        (WebCore::WebFakeXRInputController::setGripOrigin):
     62        (WebCore::WebFakeXRInputController::clearGripOrigin):
     63        (WebCore::WebFakeXRInputController::setPointerOrigin):
     64        (WebCore::WebFakeXRInputController::disconnect):
     65        (WebCore::WebFakeXRInputController::reconnect):
     66        (WebCore::WebFakeXRInputController::startSelection):
     67        (WebCore::WebFakeXRInputController::endSelection):
     68        (WebCore::WebFakeXRInputController::simulateSelect):
     69        (WebCore::WebFakeXRInputController::setSupportedButtons):
     70        (WebCore::WebFakeXRInputController::updateButtonState):
     71        * testing/WebFakeXRInputController.h: Added.
     72        * testing/WebFakeXRInputController.idl: Added.
     73        * testing/WebXRTest.cpp: Added.
     74        (WebCore::WebXRTest::simulateDeviceConnection const):
     75        (WebCore::WebXRTest::simulateUserActivation):
     76        (WebCore::WebXRTest::disconnectAllDevices):
     77        * testing/WebXRTest.h: Added.
     78        (WebCore::WebXRTest::create):
     79        * testing/WebXRTest.idl: Added.
     80        * testing/XRSimulateUserActivationFunction.h: Added.
     81        * testing/XRSimulateUserActivationFunction.idl: Ditto.
     82
    1832020-04-21  Antoine Quint  <graouts@apple.com>
    284
  • trunk/Source/WebCore/DerivedSources.make

    r260436 r260505  
    11191119    $(WebCore)/testing/ServiceWorkerInternals.idl \
    11201120    $(WebCore)/testing/TypeConversions.idl \
     1121    $(WebCore)/testing/FakeXRBoundsPoint.idl \
     1122    $(WebCore)/testing/FakeXRButtonStateInit.idl \
     1123    $(WebCore)/testing/FakeXRInputSourceInit.idl \
     1124    $(WebCore)/testing/FakeXRRigidTransformInit.idl \
     1125    $(WebCore)/testing/FakeXRViewInit.idl \
     1126    $(WebCore)/testing/WebFakeXRDevice.idl \
     1127    $(WebCore)/testing/WebFakeXRInputController.idl \
     1128    $(WebCore)/testing/WebXRTest.idl \
     1129    $(WebCore)/testing/XRSimulateUserActivationFunction.idl \
    11211130    $(WebCore)/workers/AbstractWorker.idl \
    11221131    $(WebCore)/workers/DedicatedWorkerGlobalScope.idl \
  • trunk/Source/WebCore/Modules/webxr/NavigatorWebXR.h

    r260436 r260505  
    4040    WTF_MAKE_FAST_ALLOCATED;
    4141public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
     42    WEBCORE_EXPORT static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
     43
     44    WEBCORE_EXPORT static NavigatorWebXR& from(Navigator&);
    4345
    4446private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    4747    RefPtr<WebXRSystem> m_xr;
    4848};
  • trunk/Source/WebCore/Modules/webxr/WebXRSystem.h

    r260436 r260505  
    3434#include <wtf/IsoMalloc.h>
    3535#include <wtf/RefCounted.h>
     36#include <wtf/WeakPtr.h>
    3637
    3738namespace WebCore {
     
    4142struct XRSessionInit;
    4243
    43 class WebXRSystem final : public RefCounted<WebXRSystem>, public EventTargetWithInlineData, public ActiveDOMObject {
     44class WebXRSystem final : public RefCounted<WebXRSystem>, public EventTargetWithInlineData, public ActiveDOMObject, public CanMakeWeakPtr<WebXRSystem> {
    4445    WTF_MAKE_ISO_ALLOCATED(WebXRSystem);
    4546public:
     
    4849
    4950    static Ref<WebXRSystem> create(ScriptExecutionContext&);
    50     virtual ~WebXRSystem();
     51    ~WebXRSystem();
    5152
    5253    using RefCounted<WebXRSystem>::ref;
     
    5657    void requestSession(XRSessionMode, const XRSessionInit&, RequestSessionPromise&&);
    5758
    58 private:
    59     WebXRSystem(ScriptExecutionContext&);
    60 
     59protected:
    6160    // EventTarget
    6261    EventTargetInterface eventTargetInterface() const override { return WebXRSystemEventTargetInterfaceType; }
     
    6867    const char* activeDOMObjectName() const override;
    6968    void stop() override;
     69
     70private:
     71    WebXRSystem(ScriptExecutionContext&);
    7072};
    7173
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r260504 r260505  
    1515215152                E18C35411F7196CD00FF632D /* WebArchiveResourceWebResourceHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebArchiveResourceWebResourceHandler.h; sourceTree = "<group>"; };
    1515315153                E18C35421F71970100FF632D /* WebArchiveResourceWebResourceHandler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = WebArchiveResourceWebResourceHandler.mm; sourceTree = "<group>"; };
     15154                E18D83DC243F71CB009247D6 /* FakeXRInputSourceInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRInputSourceInit.idl; sourceTree = "<group>"; };
     15155                E18D83DD243F71CC009247D6 /* WebFakeXRInputController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFakeXRInputController.cpp; sourceTree = "<group>"; };
     15156                E18D83DE243F71CD009247D6 /* FakeXRButtonStateInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRButtonStateInit.h; sourceTree = "<group>"; };
     15157                E18D83DF243F71CD009247D6 /* FakeXRViewInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRViewInit.h; sourceTree = "<group>"; };
     15158                E18D83E0243F71CE009247D6 /* WebXRTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebXRTest.cpp; sourceTree = "<group>"; };
     15159                E18D83E1243F71CE009247D6 /* WebFakeXRInputController.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebFakeXRInputController.idl; sourceTree = "<group>"; };
     15160                E18D83E2243F71CF009247D6 /* FakeXRViewInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRViewInit.idl; sourceTree = "<group>"; };
     15161                E18D83E3243F71CF009247D6 /* FakeXRButtonStateInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRButtonStateInit.idl; sourceTree = "<group>"; };
     15162                E18D83E4243F71D0009247D6 /* FakeXRBoundsPoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRBoundsPoint.h; sourceTree = "<group>"; };
     15163                E18D83E5243F71D1009247D6 /* FakeXRRigidTransformInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRRigidTransformInit.h; sourceTree = "<group>"; };
     15164                E18D83E6243F71D1009247D6 /* FakeXRRigidTransformInit.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRRigidTransformInit.idl; sourceTree = "<group>"; };
     15165                E18D83E7243F71D2009247D6 /* WebFakeXRDevice.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebFakeXRDevice.idl; sourceTree = "<group>"; };
     15166                E18D83E8243F71D2009247D6 /* WebXRTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebXRTest.h; sourceTree = "<group>"; };
     15167                E18D83E9243F71D3009247D6 /* WebFakeXRDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebFakeXRDevice.cpp; sourceTree = "<group>"; };
     15168                E18D83EA243F71D4009247D6 /* FakeXRInputSourceInit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FakeXRInputSourceInit.h; sourceTree = "<group>"; };
     15169                E18D83EB243F71D5009247D6 /* WebXRTest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRTest.idl; sourceTree = "<group>"; };
     15170                E18D83EC243F71D5009247D6 /* XRSimulateUserActivationFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XRSimulateUserActivationFunction.h; sourceTree = "<group>"; };
     15171                E18D83ED243F71D6009247D6 /* WebFakeXRDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFakeXRDevice.h; sourceTree = "<group>"; };
     15172                E18D83EE243F71D7009247D6 /* WebFakeXRInputController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebFakeXRInputController.h; sourceTree = "<group>"; };
     15173                E18D83EF243F71D7009247D6 /* FakeXRBoundsPoint.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = FakeXRBoundsPoint.idl; sourceTree = "<group>"; };
     15174                E18D83F0243F71D8009247D6 /* XRSimulateUserActivationFunction.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = XRSimulateUserActivationFunction.idl; sourceTree = "<group>"; };
    1515415175                E18DF33418AAF12C00773E59 /* SerializedCryptoKeyWrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SerializedCryptoKeyWrap.h; sourceTree = "<group>"; };
    1515515176                E18DF33618AAF14D00773E59 /* SerializedCryptoKeyWrapMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SerializedCryptoKeyWrapMac.mm; sourceTree = "<group>"; };
     15177                E19490862434F15800416A99 /* WebXRView.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRView.idl; sourceTree = "<group>"; };
     15178                E19490872434F15900416A99 /* WebXRViewport.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRViewport.idl; sourceTree = "<group>"; };
     15179                E19490882434F15900416A99 /* WebXRFrame.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRFrame.idl; sourceTree = "<group>"; };
     15180                E19490892434F15A00416A99 /* WebXRInputSource.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRInputSource.idl; sourceTree = "<group>"; };
     15181                E194908F2434F15D00416A99 /* WebXRWebGLLayer.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRWebGLLayer.idl; sourceTree = "<group>"; };
     15182                E19490932434F16000416A99 /* WebXRInputSourceArray.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRInputSourceArray.idl; sourceTree = "<group>"; };
     15183                E19490942434F16000416A99 /* WebXRBoundedReferenceSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRBoundedReferenceSpace.idl; sourceTree = "<group>"; };
     15184                E19490952434F16100416A99 /* WebXRWebGLLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebXRWebGLLayer.h; sourceTree = "<group>"; };
     15185                E19490982434F16200416A99 /* WebXRRigidTransform.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRRigidTransform.idl; sourceTree = "<group>"; };
     15186                E194909A2434F16400416A99 /* WebXRSystem.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRSystem.idl; sourceTree = "<group>"; };
     15187                E194909C2434F16500416A99 /* WebXRViewerPose.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRViewerPose.idl; sourceTree = "<group>"; };
     15188                E194909E2434F16600416A99 /* WebXRSession.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRSession.idl; sourceTree = "<group>"; };
     15189                E19490A12434F16800416A99 /* WebXRPose.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRPose.idl; sourceTree = "<group>"; };
     15190                E19490A22434F16800416A99 /* WebXRSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRSpace.idl; sourceTree = "<group>"; };
     15191                E19490A42434F16900416A99 /* WebXRRenderState.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRRenderState.idl; sourceTree = "<group>"; };
     15192                E19490A62434F16B00416A99 /* WebXRReferenceSpace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebXRReferenceSpace.idl; sourceTree = "<group>"; };
    1515615193                E19727151820549E00592D51 /* CryptoKeyType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CryptoKeyType.h; sourceTree = "<group>"; };
    1515715194                E19AC3E61824DC7900349426 /* CryptoAlgorithmSHA224.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CryptoAlgorithmSHA224.cpp; sourceTree = "<group>"; };
     
    1832918366                                A1763F3B1E2051AB001D58DE /* cocoa */,
    1833018367                                41815C1B138319630057AAA4 /* js */,
     18368                                E18D83E4243F71D0009247D6 /* FakeXRBoundsPoint.h */,
     18369                                E18D83EF243F71D7009247D6 /* FakeXRBoundsPoint.idl */,
     18370                                E18D83DE243F71CD009247D6 /* FakeXRButtonStateInit.h */,
     18371                                E18D83E3243F71CF009247D6 /* FakeXRButtonStateInit.idl */,
     18372                                E18D83EA243F71D4009247D6 /* FakeXRInputSourceInit.h */,
     18373                                E18D83DC243F71CB009247D6 /* FakeXRInputSourceInit.idl */,
     18374                                E18D83E5243F71D1009247D6 /* FakeXRRigidTransformInit.h */,
     18375                                E18D83E6243F71D1009247D6 /* FakeXRRigidTransformInit.idl */,
     18376                                E18D83DF243F71CD009247D6 /* FakeXRViewInit.h */,
     18377                                E18D83E2243F71CF009247D6 /* FakeXRViewInit.idl */,
    1833118378                                51714EA91CF65899004723C4 /* GCObservation.cpp */,
    1833218379                                51714EAA1CF65899004723C4 /* GCObservation.h */,
     
    1839318440                                EB081CD91696084400553730 /* TypeConversions.idl */,
    1839418441                                E1BA67191742BEF400C20251 /* WebCoreTestShimLibrary.cpp */,
     18442                                E18D83E9243F71D3009247D6 /* WebFakeXRDevice.cpp */,
     18443                                E18D83ED243F71D6009247D6 /* WebFakeXRDevice.h */,
     18444                                E18D83E7243F71D2009247D6 /* WebFakeXRDevice.idl */,
     18445                                E18D83DD243F71CC009247D6 /* WebFakeXRInputController.cpp */,
     18446                                E18D83EE243F71D7009247D6 /* WebFakeXRInputController.h */,
     18447                                E18D83E1243F71CE009247D6 /* WebFakeXRInputController.idl */,
     18448                                E18D83E0243F71CE009247D6 /* WebXRTest.cpp */,
     18449                                E18D83E8243F71D2009247D6 /* WebXRTest.h */,
     18450                                E18D83EB243F71D5009247D6 /* WebXRTest.idl */,
     18451                                E18D83EC243F71D5009247D6 /* XRSimulateUserActivationFunction.h */,
     18452                                E18D83F0243F71D8009247D6 /* XRSimulateUserActivationFunction.idl */,
    1839518453                        );
    1839618454                        path = testing;
     
    2722727285                                E1EE8AD32412B17000E794D6 /* WebXRBoundedReferenceSpace.cpp */,
    2722827286                                E1EE8AD12412B17000E794D6 /* WebXRBoundedReferenceSpace.h */,
     27287                                E19490942434F16000416A99 /* WebXRBoundedReferenceSpace.idl */,
    2722927288                                E1EE8AF02412B17000E794D6 /* WebXRFrame.cpp */,
    2723027289                                E1EE8AE32412B17000E794D6 /* WebXRFrame.h */,
     27290                                E19490882434F15900416A99 /* WebXRFrame.idl */,
    2723127291                                E1EE8B0D2412B17000E794D6 /* WebXRInputSource.cpp */,
    2723227292                                E1EE8B172412B17000E794D6 /* WebXRInputSource.h */,
     27293                                E19490892434F15A00416A99 /* WebXRInputSource.idl */,
    2723327294                                E1EE8AE62412B17000E794D6 /* WebXRInputSourceArray.cpp */,
    2723427295                                E1EE8ADD2412B17000E794D6 /* WebXRInputSourceArray.h */,
     27296                                E19490932434F16000416A99 /* WebXRInputSourceArray.idl */,
    2723527297                                E1EE8AE52412B17000E794D6 /* WebXRPose.cpp */,
    2723627298                                E1EE8AE12412B17000E794D6 /* WebXRPose.h */,
     27299                                E19490A12434F16800416A99 /* WebXRPose.idl */,
    2723727300                                E1EE8AD22412B17000E794D6 /* WebXRReferenceSpace.cpp */,
    2723827301                                E1EE8B142412B17000E794D6 /* WebXRReferenceSpace.h */,
     27302                                E19490A62434F16B00416A99 /* WebXRReferenceSpace.idl */,
    2723927303                                E1EE8ACE2412B17000E794D6 /* WebXRRenderState.cpp */,
    2724027304                                E1EE8AD52412B17000E794D6 /* WebXRRenderState.h */,
     27305                                E19490A42434F16900416A99 /* WebXRRenderState.idl */,
    2724127306                                E1EE8ACD2412B17000E794D6 /* WebXRRigidTransform.cpp */,
    2724227307                                E1EE8B062412B17000E794D6 /* WebXRRigidTransform.h */,
     27308                                E19490982434F16200416A99 /* WebXRRigidTransform.idl */,
    2724327309                                E1EE8B0F2412B17000E794D6 /* WebXRSession.cpp */,
    2724427310                                E1EE8B112412B17000E794D6 /* WebXRSession.h */,
     27311                                E194909E2434F16600416A99 /* WebXRSession.idl */,
    2724527312                                E1EE8AF82412B17000E794D6 /* WebXRSpace.cpp */,
    2724627313                                E1EE8ACF2412B17000E794D6 /* WebXRSpace.h */,
     27314                                E19490A22434F16800416A99 /* WebXRSpace.idl */,
    2724727315                                E1EE8AE82412B17000E794D6 /* WebXRSystem.cpp */,
    2724827316                                E1EE8AE22412B17000E794D6 /* WebXRSystem.h */,
     27317                                E194909A2434F16400416A99 /* WebXRSystem.idl */,
    2724927318                                E1EE8B122412B17000E794D6 /* WebXRView.cpp */,
    2725027319                                E1EE8AE02412B17000E794D6 /* WebXRView.h */,
     27320                                E19490862434F15800416A99 /* WebXRView.idl */,
    2725127321                                E1EE8B0B2412B17000E794D6 /* WebXRViewerPose.cpp */,
    2725227322                                E1EE8AC72412B16F00E794D6 /* WebXRViewerPose.h */,
     27323                                E194909C2434F16500416A99 /* WebXRViewerPose.idl */,
    2725327324                                E1EE8AEB2412B17000E794D6 /* WebXRViewport.cpp */,
    2725427325                                E1EE8AF42412B17000E794D6 /* WebXRViewport.h */,
     27326                                E19490872434F15900416A99 /* WebXRViewport.idl */,
    2725527327                                E1EE8AD82412B17000E794D6 /* WebXRWebGLLayer.cpp */,
     27328                                E19490952434F16100416A99 /* WebXRWebGLLayer.h */,
     27329                                E194908F2434F15D00416A99 /* WebXRWebGLLayer.idl */,
    2725627330                                E1EE8AF72412B17000E794D6 /* XRBoundedReferenceSpace.idl */,
    2725727331                                E1EE8B052412B17000E794D6 /* XREnvironmentBlendMode.h */,
  • trunk/Source/WebCore/bindings/js/WebCoreBuiltinNames.h

    r260436 r260505  
    7676    macro(ExtendableEvent) \
    7777    macro(ExtendableMessageEvent) \
     78    macro(FakeXRDevice) \
     79    macro(FakeXRInputController) \
    7880    macro(FetchEvent) \
    7981    macro(FileSystem) \
     
    252254    macro(XRSessionEvent) \
    253255    macro(XRSpace) \
     256    macro(XRTest) \
    254257    macro(XRView) \
    255258    macro(XRViewerPose) \
  • trunk/Source/WebCore/testing/FakeXRBoundsPoint.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
    32 
    3330namespace WebCore {
    3431
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
    38 
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     32struct FakeXRBoundsPoint {
     33    double x;
     34    double z;
    4835};
    4936
  • trunk/Source/WebCore/testing/FakeXRBoundsPoint.idl

    r260504 r260505  
    2424 */
    2525
    26 #pragma once
    27 
    28 #if ENABLE(WEBXR)
    29 
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
    32 
    33 namespace WebCore {
    34 
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
    38 
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     26[
     27    EnabledAtRuntime=WebXR,
     28    Conditional=WEBXR,
     29] dictionary FakeXRBoundsPoint {
     30    double x; double z;
    4831};
    49 
    50 } // namespace WebCore
    51 
    52 #endif // ENABLE(WEBXR)
  • trunk/Source/WebCore/testing/FakeXRButtonStateInit.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
    32 
    3330namespace WebCore {
    3431
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
     32struct FakeXRButtonStateInit {
     33    enum class Type {
     34        Grip,
     35        Touchpad,
     36        Thumbstick,
     37        OptionalButton,
     38        OptionalThumbstick
     39    };
    3840
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     41    Type buttonType;
     42    bool pressed;
     43    bool touched;
     44    float pressedValue;
     45    float xValue { 0.0 };
     46    float yValue { 0.0 };
    4847};
    4948
  • trunk/Source/WebCore/testing/FakeXRButtonStateInit.idl

    r260504 r260505  
    2424 */
    2525
    26 #pragma once
    27 
    28 #if ENABLE(WEBXR)
    29 
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
    32 
    33 namespace WebCore {
    34 
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
    38 
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     26// Because the primary button is always guaranteed to be present, and other buttons
     27// should fulfill the role of validating any state from FakeXRButtonStateInit
     28// the primary button is not present in this enum.
     29[
     30    EnabledAtRuntime=WebXR,
     31    Conditional=WEBXR,
     32] enum FakeXRButtonType {
     33    "grip",
     34    "touchpad",
     35    "thumbstick",
     36    // Represents a button whose position is not specified by the xr-standard mapping.
     37    // Should appear at one past the last reserved button index.
     38    "optional-button",
     39    // Represents a thumbstick whose position is not specified by the xr-standard mapping.
     40    // Should appear at two past the last reserved button index.
     41    "optional-thumbstick"
    4842};
    4943
    50 } // namespace WebCore
    51 
    52 #endif // ENABLE(WEBXR)
     44// Used to update the state of optionally supported buttons.
     45[
     46    EnabledAtRuntime=WebXR,
     47    Conditional=WEBXR,
     48] dictionary FakeXRButtonStateInit {
     49    required FakeXRButtonType buttonType;
     50    required boolean pressed;
     51    required boolean touched;
     52    required float pressedValue;
     53    // x and y value are ignored if the FakeXRButtonType is not touchpad, thumbstick, or optional-thumbstick
     54    float xValue = 0.0;
     55    float yValue = 0.0;
     56};
  • trunk/Source/WebCore/testing/FakeXRInputSourceInit.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
     30#include "FakeXRButtonStateInit.h"
     31#include "FakeXRRigidTransformInit.h"
     32#include "XREye.h"
     33#include "XRHandedness.h"
     34#include "XRTargetRayMode.h"
     35#include <wtf/Vector.h>
    3236
    3337namespace WebCore {
    3438
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
    38 
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     39struct FakeXRInputSourceInit {
     40    XRHandedness handedness;
     41    XRTargetRayMode targetRayMode;
     42    FakeXRRigidTransformInit pointerOrigin;
     43    Vector<String> profiles;
     44    bool selectionStarted { false };
     45    bool selectionClicked { false };
     46    Vector<FakeXRButtonStateInit> supportedButtons;
     47    FakeXRRigidTransformInit gripOrigin;
    4848};
    4949
  • trunk/Source/WebCore/testing/FakeXRInputSourceInit.idl

    r260504 r260505  
    2424 */
    2525
    26 #pragma once
    27 
    28 #if ENABLE(WEBXR)
    29 
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
    32 
    33 namespace WebCore {
    34 
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
    38 
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     26[
     27    EnabledAtRuntime=WebXR,
     28    Conditional=WEBXR,
     29] dictionary FakeXRInputSourceInit {
     30    required XRHandedness handedness;
     31    required XRTargetRayMode targetRayMode;
     32    required FakeXRRigidTransformInit pointerOrigin;
     33    required sequence<DOMString> profiles;
     34    // was the primary action pressed when this was connected?
     35    boolean selectionStarted = false;
     36    // should this input source send a select immediately upon connection?
     37    boolean selectionClicked = false;
     38    // Initial button state for any buttons beyond the primary that are supported.
     39    // If empty, only the primary button is supported.
     40    // Note that if any FakeXRButtonType is repeated the behavior is undefined.
     41    sequence<FakeXRButtonStateInit> supportedButtons;
     42    // If not set the controller is assumed to not be tracked.
     43    FakeXRRigidTransformInit gripOrigin;
    4844};
    49 
    50 } // namespace WebCore
    51 
    52 #endif // ENABLE(WEBXR)
  • trunk/Source/WebCore/testing/FakeXRRigidTransformInit.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
     30#include <wtf/Vector.h>
    3231
    3332namespace WebCore {
    3433
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
    38 
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     34struct FakeXRRigidTransformInit {
     35    Vector<float> position;
     36    Vector<float> orientation;
    4837};
    4938
  • trunk/Source/WebCore/testing/FakeXRRigidTransformInit.idl

    r260504 r260505  
    2424 */
    2525
    26 #pragma once
    27 
    28 #if ENABLE(WEBXR)
    29 
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
    32 
    33 namespace WebCore {
    34 
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
    38 
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     26// https://immersive-web.github.io/webxr/#xrrigidtransform
     27[
     28    EnabledAtRuntime=WebXR,
     29    Conditional=WEBXR,
     30] dictionary FakeXRRigidTransformInit {
     31    // must have three elements
     32    required sequence<float> position;
     33    // must have four elements
     34    required sequence<float> orientation;
    4835};
    49 
    50 } // namespace WebCore
    51 
    52 #endif // ENABLE(WEBXR)
  • trunk/Source/WebCore/testing/FakeXRViewInit.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
     30#include "FakeXRRigidTransformInit.h"
     31#include "XREye.h"
     32#include <wtf/Vector.h>
    3233
    3334namespace WebCore {
    3435
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
     36struct FakeXRViewInit {
     37    struct DeviceResolution {
     38        int width;
     39        int height;
     40    };
     41    struct FieldOfViewInit {
     42        float upDegrees;
     43        float downDegrees;
     44        float leftDegrees;
     45        float rightDegrees;
     46    };
    3847
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
    43 
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     48    XREye eye;
     49    Vector<float> projectionMatrix;
     50    DeviceResolution resolution;
     51    FakeXRRigidTransformInit viewOffset;
     52    FieldOfViewInit fieldOfView;
    4853};
    4954
  • trunk/Source/WebCore/testing/Internals.cpp

    r260436 r260505  
    311311#endif
    312312
     313#if ENABLE(WEBXR)
     314#include "NavigatorWebXR.h"
     315#include "WebXRSystem.h"
     316#include "WebXRTest.h"
     317#endif
     318
    313319#if PLATFORM(MAC) && USE(LIBWEBRTC)
    314320#include <webrtc/sdk/WebKit/VideoProcessingSoftLink.h>
     
    56565662}
    56575663
     5664#if ENABLE(WEBXR)
     5665
     5666ExceptionOr<RefPtr<WebXRTest>> Internals::xrTest()
     5667{
     5668    if (!RuntimeEnabledFeatures::sharedFeatures().webXREnabled())
     5669        return Exception { InvalidAccessError };
     5670
     5671    if (!m_xrTest) {
     5672        if (!contextDocument() || !contextDocument()->domWindow())
     5673            return Exception { InvalidAccessError };
     5674
     5675        auto* navigator = contextDocument()->domWindow()->optionalNavigator();
     5676        if (!navigator)
     5677            return Exception { InvalidAccessError };
     5678
     5679        auto& navigatorXR = NavigatorWebXR::from(*navigator);
     5680        auto& xrSystem = navigatorXR.xr(*scriptExecutionContext(), *navigator);
     5681
     5682        m_xrTest = WebXRTest::create(makeWeakPtr(&xrSystem));
     5683    }
     5684    return m_xrTest.get();
     5685}
     5686
     5687#endif
     5688
     5689
    56585690} // namespace WebCore
  • trunk/Source/WebCore/testing/Internals.h

    r260436 r260505  
    118118#endif
    119119
     120#if ENABLE(WEBXR)
     121class WebXRTest;
     122#endif
     123
    120124template<typename IDLType> class DOMPromiseDeferred;
    121125
     
    10031007    bool destroySleepDisabler(unsigned identifier);
    10041008
     1009#if ENABLE(WEBXR)
     1010    ExceptionOr<RefPtr<WebXRTest>> xrTest();
     1011#endif
     1012
    10051013private:
    10061014    explicit Internals(Document&);
     
    10271035
    10281036    HashMap<unsigned, std::unique_ptr<WebCore::SleepDisabler>> m_sleepDisablers;
     1037
     1038#if ENABLE(WEBXR)
     1039    RefPtr<WebXRTest> m_xrTest;
     1040#endif
    10291041};
    10301042
  • trunk/Source/WebCore/testing/Internals.idl

    r260436 r260505  
    907907    unsigned long createSleepDisabler(DOMString reason, boolean display);
    908908    boolean destroySleepDisabler(unsigned long identifier);
    909 };
     909
     910    [Conditional=WEBXR, MayThrowException] readonly attribute WebXRTest xrTest;
     911};
  • trunk/Source/WebCore/testing/WebFakeXRDevice.cpp

    r260504 r260505  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "WebFakeXRDevice.h"
    2728
    2829#if ENABLE(WEBXR)
    2930
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
     31#include "JSDOMPromiseDeferred.h"
     32#include "WebFakeXRInputController.h"
    3233
    3334namespace WebCore {
    3435
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
     36void WebFakeXRDevice::setViews(Vector<FakeXRViewInit>)
     37{
     38}
    3839
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
     40void WebFakeXRDevice::disconnect(DOMPromiseDeferred<void>&& promise)
     41{
     42    promise.resolve();
     43}
    4344
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
     45void WebFakeXRDevice::setViewerOrigin(FakeXRRigidTransformInit origin, bool emulatedPosition)
     46{
     47    UNUSED_PARAM(origin);
     48    UNUSED_PARAM(emulatedPosition);
     49}
    4650
    47     RefPtr<WebXRSystem> m_xr;
    48 };
     51void WebFakeXRDevice::clearViewerOrigin()
     52{
     53}
     54
     55void WebFakeXRDevice::simulateVisibilityChange(XRVisibilityState)
     56{
     57}
     58
     59void WebFakeXRDevice::setBoundsGeometry(Vector<FakeXRBoundsPoint>)
     60{
     61}
     62
     63void WebFakeXRDevice::setFloorOrigin(FakeXRRigidTransformInit)
     64{
     65}
     66
     67void WebFakeXRDevice::clearFloorOrigin()
     68{
     69}
     70
     71void WebFakeXRDevice::simulateResetPose()
     72{
     73}
     74
     75WebFakeXRInputController WebFakeXRDevice::simulateInputSourceConnection(FakeXRInputSourceInit)
     76{
     77    return WebFakeXRInputController();
     78}
    4979
    5080} // namespace WebCore
  • trunk/Source/WebCore/testing/WebFakeXRDevice.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
     30#include "FakeXRBoundsPoint.h"
     31#include "FakeXRInputSourceInit.h"
     32#include "FakeXRViewInit.h"
     33#include "JSDOMPromiseDeferred.h"
     34#include "WebFakeXRInputController.h"
     35#include "XRVisibilityState.h"
     36#include <wtf/RefCounted.h>
     37#include <wtf/Vector.h>
    3238
    3339namespace WebCore {
    3440
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
     41class WebFakeXRDevice final : public RefCounted<WebFakeXRDevice> {
     42public:
     43    void setViews(Vector<FakeXRViewInit>);
    3844
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
     45    void disconnect(DOMPromiseDeferred<void>&&);
    4346
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
     47    void setViewerOrigin(FakeXRRigidTransformInit origin, bool emulatedPosition = false);
    4648
    47     RefPtr<WebXRSystem> m_xr;
     49    void clearViewerOrigin();
     50
     51    void simulateVisibilityChange(XRVisibilityState);
     52
     53    void setBoundsGeometry(Vector<FakeXRBoundsPoint> boundsCoordinates);
     54
     55    void setFloorOrigin(FakeXRRigidTransformInit);
     56
     57    void clearFloorOrigin();
     58
     59    void simulateResetPose();
     60
     61    WebFakeXRInputController simulateInputSourceConnection(FakeXRInputSourceInit);
    4862};
    4963
  • trunk/Source/WebCore/testing/WebFakeXRInputController.cpp

    r260504 r260505  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "WebFakeXRInputController.h"
    2728
    2829#if ENABLE(WEBXR)
    2930
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
    32 
    3331namespace WebCore {
    3432
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
     33void WebFakeXRInputController::setHandedness(XRHandedness)
     34{
     35}
    3836
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
     37void WebFakeXRInputController::setTargetRayMode(XRTargetRayMode)
     38{
     39}
    4340
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
     41void WebFakeXRInputController::setProfiles(Vector<String>)
     42{
     43}
    4644
    47     RefPtr<WebXRSystem> m_xr;
    48 };
     45void WebFakeXRInputController::setGripOrigin(FakeXRRigidTransformInit gripOrigin, bool emulatedPosition)
     46{
     47    UNUSED_PARAM(gripOrigin);
     48    UNUSED_PARAM(emulatedPosition);
     49}
     50
     51void WebFakeXRInputController::clearGripOrigin()
     52{
     53}
     54
     55void WebFakeXRInputController::setPointerOrigin(FakeXRRigidTransformInit pointerOrigin, bool emulatedPosition)
     56{
     57    UNUSED_PARAM(pointerOrigin);
     58    UNUSED_PARAM(emulatedPosition);
     59}
     60
     61void WebFakeXRInputController::disconnect()
     62{
     63}
     64
     65void WebFakeXRInputController::reconnect()
     66{
     67}
     68
     69void WebFakeXRInputController::startSelection()
     70{
     71}
     72
     73void WebFakeXRInputController::endSelection()
     74{
     75}
     76
     77void WebFakeXRInputController::simulateSelect()
     78{
     79}
     80
     81void WebFakeXRInputController::setSupportedButtons(Vector<FakeXRButtonStateInit>)
     82{
     83}
     84
     85void WebFakeXRInputController::updateButtonState(FakeXRButtonStateInit)
     86{
     87}
    4988
    5089} // namespace WebCore
  • trunk/Source/WebCore/testing/WebFakeXRInputController.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
     30#include "FakeXRButtonStateInit.h"
     31#include "FakeXRRigidTransformInit.h"
     32#include "XRHandedness.h"
     33#include "XRTargetRayMode.h"
     34#include <wtf/RefCounted.h>
     35#include <wtf/Vector.h>
    3236
    3337namespace WebCore {
    3438
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
     39class WebFakeXRInputController final : public RefCounted<WebFakeXRInputController> {
     40public:
     41    void setHandedness(XRHandedness);
    3842
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
     43    void setTargetRayMode(XRTargetRayMode);
    4344
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
     45    void setProfiles(Vector<String>);
    4646
    47     RefPtr<WebXRSystem> m_xr;
     47    void setGripOrigin(FakeXRRigidTransformInit gripOrigin, bool emulatedPosition = false);
     48
     49    void clearGripOrigin();
     50
     51    void setPointerOrigin(FakeXRRigidTransformInit pointerOrigin, bool emulatedPosition = false);
     52
     53    void disconnect();
     54
     55    void reconnect();
     56
     57    void startSelection();
     58
     59    void endSelection();
     60
     61    void simulateSelect();
     62
     63    void setSupportedButtons(Vector<FakeXRButtonStateInit>);
     64
     65    void updateButtonState(FakeXRButtonStateInit);
    4866};
    4967
  • trunk/Source/WebCore/testing/WebXRTest.cpp

    r260504 r260505  
    2424 */
    2525
    26 #pragma once
     26#include "config.h"
     27#include "WebXRTest.h"
    2728
    2829#if ENABLE(WEBXR)
    2930
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
    32 
    3331namespace WebCore {
    3432
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
     33void WebXRTest::simulateDeviceConnection(FakeXRDeviceInit, WebFakeXRDevicePromise&&) const
     34{
     35}
    3836
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
    41 public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
     37void WebXRTest::simulateUserActivation(XRSimulateUserActivationFunction&)
     38{
     39}
    4340
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
    48 };
     41void WebXRTest::disconnectAllDevices(DOMPromiseDeferred<void>&&)
     42{
     43}
    4944
    5045} // namespace WebCore
  • trunk/Source/WebCore/testing/WebXRTest.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "ActiveDOMObject.h"
    31 #include "EventTarget.h"
    3230#include "JSDOMPromiseDeferred.h"
     31#include "WebFakeXRDevice.h"
    3332#include "XRSessionMode.h"
    34 #include <wtf/IsoMalloc.h>
     33#include "XRSimulateUserActivationFunction.h"
     34#include <JavaScriptCore/JSCJSValue.h>
     35#include <wtf/Optional.h>
    3536#include <wtf/RefCounted.h>
    3637
    3738namespace WebCore {
    3839
    39 class ScriptExecutionContext;
    40 class WebXRSession;
    41 struct XRSessionInit;
     40class WebXRSystem;
    4241
    43 class WebXRSystem final : public RefCounted<WebXRSystem>, public EventTargetWithInlineData, public ActiveDOMObject {
    44     WTF_MAKE_ISO_ALLOCATED(WebXRSystem);
     42class WebXRTest final : public RefCounted<WebXRTest> {
    4543public:
    46     using IsSessionSupportedPromise = DOMPromiseDeferred<IDLBoolean>;
    47     using RequestSessionPromise = DOMPromiseDeferred<IDLInterface<WebXRSession>>;
     44    struct FakeXRDeviceInit {
     45        bool supportsImmersive { false };
     46        Optional<Vector<XRSessionMode>> supportedModes;
     47        Vector<FakeXRViewInit> views;
    4848
    49     static Ref<WebXRSystem> create(ScriptExecutionContext&);
    50     virtual ~WebXRSystem();
     49        Optional<Vector<JSC::JSValue>> supportedFeatures;
    5150
    52     using RefCounted<WebXRSystem>::ref;
    53     using RefCounted<WebXRSystem>::deref;
     51        Optional<Vector<FakeXRBoundsPoint>> boundsCoordinates;
    5452
    55     void isSessionSupported(XRSessionMode, IsSessionSupportedPromise&&);
    56     void requestSession(XRSessionMode, const XRSessionInit&, RequestSessionPromise&&);
     53        Optional<FakeXRRigidTransformInit> floorOrigin;
     54        Optional<FakeXRRigidTransformInit> viewerOrigin;
     55    };
     56
     57    static Ref<WebXRTest> create(WeakPtr<WebXRSystem>&& system) { return adoptRef(*new WebXRTest(WTFMove(system))); }
     58
     59    using WebFakeXRDevicePromise = DOMPromiseDeferred<IDLInterface<WebFakeXRDevice>>;
     60    void simulateDeviceConnection(FakeXRDeviceInit, WebFakeXRDevicePromise&&) const;
     61
     62    // Simulates a user activation (aka user gesture) for the current scope.
     63    // The activation is only guaranteed to be valid in the provided function and only applies to WebXR
     64    // Device API methods.
     65    void simulateUserActivation(XRSimulateUserActivationFunction&);
     66
     67    // Disconnect all fake devices
     68    void disconnectAllDevices(DOMPromiseDeferred<void>&&);
    5769
    5870private:
    59     WebXRSystem(ScriptExecutionContext&);
     71    WebXRTest(WeakPtr<WebXRSystem>&& system)
     72        : m_context(WTFMove(system)) { }
    6073
    61     // EventTarget
    62     EventTargetInterface eventTargetInterface() const override { return WebXRSystemEventTargetInterfaceType; }
    63     ScriptExecutionContext* scriptExecutionContext() const override { return ActiveDOMObject::scriptExecutionContext(); }
    64     void refEventTarget() override { ref(); }
    65     void derefEventTarget() override { deref(); }
    66 
    67     // ActiveDOMObject
    68     const char* activeDOMObjectName() const override;
    69     void stop() override;
     74    WeakPtr<WebXRSystem> m_context;
    7075};
    7176
  • trunk/Source/WebCore/testing/XRSimulateUserActivationFunction.h

    r260504 r260505  
    2828#if ENABLE(WEBXR)
    2929
    30 #include "Supplementable.h"
    31 #include <wtf/RefPtr.h>
     30#include "ActiveDOMCallback.h"
     31#include "CallbackResult.h"
     32#include <wtf/RefCounted.h>
    3233
    3334namespace WebCore {
    3435
    35 class Navigator;
    36 class ScriptExecutionContext;
    37 class WebXRSystem;
     36class WebXRFrame;
    3837
    39 class NavigatorWebXR final : public Supplement<Navigator> {
    40     WTF_MAKE_FAST_ALLOCATED;
     38class XRSimulateUserActivationFunction : public RefCounted<XRSimulateUserActivationFunction>, public ActiveDOMCallback {
    4139public:
    42     static WebXRSystem& xr(ScriptExecutionContext&, Navigator&);
     40    using ActiveDOMCallback::ActiveDOMCallback;
    4341
    44 private:
    45     static NavigatorWebXR& from(Navigator&);
    46 
    47     RefPtr<WebXRSystem> m_xr;
     42    virtual CallbackResult<void> handleEvent(JSC::JSValue) = 0;
    4843};
    4944
Note: See TracChangeset for help on using the changeset viewer.