haikuwebkit/Source/WebCore/testing/FakeXRInputSourceInit.h

53 lines
1.9 KiB
C
Raw Permalink Normal View History

[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. Canonical link: https://commits.webkit.org/223740@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@260505 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-04-22 10:19:30 +00:00
/*
* 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)