0

Stop looking for Oculus and OpenVR specific runtimes

Oculus and OpenVR both have beta runtimes that will allow running their
devices via OpenXR. In order to simplify the Chrome codebase, we will
stop running Oculus and OpenVR against their own runtimes (which have
not shipped), and run them via their OpenXR implementations.

Note that with OpenVR being removed, the test macros needed to be
modified to stop running against it, as well as a few OpenVR specific
tests needing to be removed. Oculus runtime was never tested in an
automatic fashion.

Bug:1121624

Change-Id: Ibdf13532e922db1290062186fd5ec45885d5b46b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2373392
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Brian Sheedy <bsheedy@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Klaus Weidner <klausw@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802077}
This commit is contained in:
Alexander Cooper
2020-08-27 02:26:40 +00:00
committed by Commit Bot
parent 51fbcb70ad
commit fc1b3bfec2
12 changed files with 34 additions and 500 deletions

@ -63,6 +63,17 @@
MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread(this); \
}
// In this case IN_PROC_BROWSER_TEST_F could realistically be used; however, in
// some cases, we're conditionally enabling runtimes. This method thus enables
// easily "switching" between having only one runtime enabled and having two or
// more runtimes enabled, and helps make the "ALL_RUNTIMES" macros possible.
#define IN_PROC_MULTI_CLASS_BROWSER_TEST_F1(test_class1, base_class, \
test_name) \
DEFINE_RUN_TEST_IMPL_(test_name, base_class) \
DEFINE_BROWSER_TEST_(test_class1, test_name) \
void MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread( \
base_class* t)
#define IN_PROC_MULTI_CLASS_BROWSER_TEST_F2(test_class1, test_class2, \
base_class, test_name) \
DEFINE_RUN_TEST_IMPL_(test_name, base_class) \
@ -71,15 +82,6 @@
void MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread( \
base_class* t)
#define IN_PROC_MULTI_CLASS_BROWSER_TEST_F3( \
test_class1, test_class2, test_class3, base_class, test_name) \
DEFINE_RUN_TEST_IMPL_(test_name, base_class) \
DEFINE_BROWSER_TEST_(test_class1, test_name) \
DEFINE_BROWSER_TEST_(test_class2, test_name) \
DEFINE_BROWSER_TEST_(test_class3, test_name) \
void MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread( \
base_class* t)
#define IN_PROC_MULTI_CLASS_PLUS_INCOGNITO_BROWSER_TEST_F2( \
test_class1, test_class2, base_class, test_name) \
DEFINE_RUN_TEST_IMPL_(test_name, base_class) \
@ -90,45 +92,43 @@
void MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread( \
base_class* t)
#define IN_PROC_MULTI_CLASS_PLUS_INCOGNITO_BROWSER_TEST_F3( \
test_class1, test_class2, test_class3, base_class, test_name) \
// In this case IN_PROC_BROWSER_TEST_F could realistically be used; however, in
// some cases, we're conditionally enabling runtimes. This method thus enables
// easily "switching" between having only one runtime enabled and having two or
// more runtimes enabled, and helps make the "ALL_RUNTIMES" macros possible.
#define IN_PROC_MULTI_CLASS_PLUS_INCOGNITO_BROWSER_TEST_F1( \
test_class1, base_class, test_name) \
DEFINE_RUN_TEST_IMPL_(test_name, base_class) \
DEFINE_BROWSER_TEST_(test_class1, test_name) \
DEFINE_BROWSER_TEST_(test_class2, test_name) \
DEFINE_BROWSER_TEST_(test_class3, test_name) \
DEFINE_INCOGNITO_BROWSER_TEST_(test_class1, test_name) \
DEFINE_INCOGNITO_BROWSER_TEST_(test_class2, test_name) \
DEFINE_INCOGNITO_BROWSER_TEST_(test_class3, test_name) \
void MULTI_CLASS_RUNNER_NAME_(test_name)::ActuallyRunTestOnMainThread( \
base_class* t)
// Helper macro to cut down on duplicate code since most uses of
// IN_PROC_MULTI_CLASS_BROWSER_TEST_F3 are passed the same OpenVR, WMR, and
// OpenXR classes and the same base class
// IN_PROC_MULTI_CLASS_BROWSER_TEST_F2 are passed the same WMR, and OpenXR
// classes and the same base class
#if BUILDFLAG(ENABLE_OPENXR)
#define WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(test_name) \
IN_PROC_MULTI_CLASS_BROWSER_TEST_F3( \
WebXrVrOpenVrBrowserTest, WebXrVrWmrBrowserTest, \
WebXrVrOpenXrBrowserTest, WebXrVrBrowserTestBase, test_name)
#else
#define WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(test_name) \
IN_PROC_MULTI_CLASS_BROWSER_TEST_F2(WebXrVrOpenVrBrowserTest, \
WebXrVrWmrBrowserTest, \
IN_PROC_MULTI_CLASS_BROWSER_TEST_F2(WebXrVrWmrBrowserTest, \
WebXrVrOpenXrBrowserTest, \
WebXrVrBrowserTestBase, test_name)
#else
#define WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(test_name) \
IN_PROC_MULTI_CLASS_BROWSER_TEST_F1(WebXrVrWmrBrowserTest, \
WebXrVrBrowserTestBase, test_name)
#endif // BUILDFLAG(ENABLE_OPENXR)
// The same as WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F, but runs the tests in
// incognito mode as well.
#if BUILDFLAG(ENABLE_OPENXR)
#define WEBXR_VR_ALL_RUNTIMES_PLUS_INCOGNITO_BROWSER_TEST_F(test_name) \
IN_PROC_MULTI_CLASS_PLUS_INCOGNITO_BROWSER_TEST_F3( \
WebXrVrOpenVrBrowserTest, WebXrVrWmrBrowserTest, \
WebXrVrOpenXrBrowserTest, WebXrVrBrowserTestBase, test_name)
#else
#define WEBXR_VR_ALL_RUNTIMES_PLUS_INCOGNITO_BROWSER_TEST_F(test_name) \
IN_PROC_MULTI_CLASS_PLUS_INCOGNITO_BROWSER_TEST_F2( \
WebXrVrOpenVrBrowserTest, WebXrVrWmrBrowserTest, WebXrVrBrowserTestBase, \
WebXrVrOpenXrBrowserTest, WebXrVrWmrBrowserTest, WebXrVrBrowserTestBase, \
test_name)
#else
#define WEBXR_VR_ALL_RUNTIMES_PLUS_INCOGNITO_BROWSER_TEST_F(test_name) \
IN_PROC_MULTI_CLASS_PLUS_INCOGNITO_BROWSER_TEST_F1( \
WebXrVrWmrBrowserTest, WebXrVrBrowserTestBase, test_name)
#endif // ENABLE_OPENXR
// Helper class to disable a specific runtime of the above

@ -99,28 +99,6 @@ WebXrVrRuntimelessBrowserTestSensorless::
#if defined(OS_WIN)
WebXrVrOpenVrBrowserTestBase::WebXrVrOpenVrBrowserTestBase() {
enable_features_.push_back(device::features::kOpenVR);
#if BUILDFLAG(ENABLE_WINDOWS_MR)
disable_features_.push_back(device::features::kWindowsMixedReality);
#endif
#if BUILDFLAG(ENABLE_OPENXR)
disable_features_.push_back(device::features::kOpenXR);
#endif
}
XrBrowserTestBase::RuntimeType WebXrVrOpenVrBrowserTestBase::GetRuntimeType()
const {
return XrBrowserTestBase::RuntimeType::RUNTIME_OPENVR;
}
gfx::Vector3dF WebXrVrOpenVrBrowserTestBase::GetControllerOffset() const {
// The 0.08f comes from the slight adjustment we perform in
// openvr_render_loop.cc to account for OpenVR reporting the controller
// position at the tip, but WebXR using the position at the grip.
return gfx::Vector3dF(0, 0, 0.08f);
}
WebXrVrWmrBrowserTestBase::WebXrVrWmrBrowserTestBase() {
#if BUILDFLAG(ENABLE_WINDOWS_MR)
enable_features_.push_back(device::features::kWindowsMixedReality);
@ -159,12 +137,6 @@ XrBrowserTestBase::RuntimeType WebXrVrOpenXrBrowserTestBase::GetRuntimeType()
}
#endif // BUILDFLAG(ENABLE_OPENXR)
WebXrVrOpenVrBrowserTest::WebXrVrOpenVrBrowserTest() {
// We know at this point that we're going to be running with both OpenVR and
// WebXR enabled, so enforce the DirectX 11.1 requirement.
runtime_requirements_.push_back(XrTestRequirement::DIRECTX_11_1);
}
WebXrVrWmrBrowserTest::WebXrVrWmrBrowserTest() {
runtime_requirements_.push_back(XrTestRequirement::DIRECTX_11_1);
}
@ -176,10 +148,6 @@ WebXrVrOpenXrBrowserTest::WebXrVrOpenXrBrowserTest() {
#endif // BUILDFLAG(ENABLE_OPENXR)
// Test classes with WebXR disabled.
WebXrVrOpenVrBrowserTestWebXrDisabled::WebXrVrOpenVrBrowserTestWebXrDisabled() {
disable_features_.push_back(features::kWebXr);
}
WebXrVrWmrBrowserTestWebXrDisabled::WebXrVrWmrBrowserTestWebXrDisabled() {
disable_features_.push_back(features::kWebXr);
}

@ -53,7 +53,7 @@ class WebXrVrBrowserTestBase : public WebXrBrowserTestBase {
permissions::PermissionRequestManager::ACCEPT_ALL;
};
// Test class with OpenVR disabled.
// Test class with all runtimes disabled.
class WebXrVrRuntimelessBrowserTest : public WebXrVrBrowserTestBase {
public:
WebXrVrRuntimelessBrowserTest();
@ -65,16 +65,8 @@ class WebXrVrRuntimelessBrowserTestSensorless
WebXrVrRuntimelessBrowserTestSensorless();
};
// OpenVR and WMR feature only defined on Windows.
// WMR feature only defined on Windows.
#ifdef OS_WIN
// OpenVR-specific subclass of WebXrVrBrowserTestBase.
class WebXrVrOpenVrBrowserTestBase : public WebXrVrBrowserTestBase {
public:
WebXrVrOpenVrBrowserTestBase();
XrBrowserTestBase::RuntimeType GetRuntimeType() const override;
gfx::Vector3dF GetControllerOffset() const override;
};
// WMR-specific subclass of WebXrVrBrowserTestBase.
class WebXrVrWmrBrowserTestBase : public WebXrVrBrowserTestBase {
public:
@ -102,12 +94,6 @@ class WebXrVrOpenXrBrowserTestBase : public WebXrVrBrowserTestBase {
};
#endif // BUILDFLAG(ENABLE_OPENXR)
// Test class with standard features enabled: WebXR and OpenVR.
class WebXrVrOpenVrBrowserTest : public WebXrVrOpenVrBrowserTestBase {
public:
WebXrVrOpenVrBrowserTest();
};
class WebXrVrWmrBrowserTest : public WebXrVrWmrBrowserTestBase {
public:
WebXrVrWmrBrowserTest();
@ -120,13 +106,6 @@ class WebXrVrOpenXrBrowserTest : public WebXrVrOpenXrBrowserTestBase {
};
#endif // BUILDFLAG(ENABLE_OPENXR)
// Test classes with WebXR disabled.
class WebXrVrOpenVrBrowserTestWebXrDisabled
: public WebXrVrOpenVrBrowserTestBase {
public:
WebXrVrOpenVrBrowserTestWebXrDisabled();
};
class WebXrVrWmrBrowserTestWebXrDisabled : public WebXrVrWmrBrowserTestBase {
public:
WebXrVrWmrBrowserTestWebXrDisabled();

@ -73,7 +73,6 @@ class XrBrowserTestBase : public InProcessBrowserTest {
enum class RuntimeType {
RUNTIME_NONE = 0,
RUNTIME_OPENVR = 1,
RUNTIME_WMR = 2,
RUNTIME_OPENXR = 3
};

@ -8,7 +8,6 @@
#include "chrome/browser/vr/test/multi_class_browser_test.h"
#include "chrome/browser/vr/test/webxr_vr_browser_test.h"
#include "device/vr/public/mojom/browser_test_interfaces.mojom.h"
#include "third_party/openvr/src/headers/openvr.h"
// Browser test equivalent of
// chrome/android/javatests/src/.../browser/vr/WebXrVrInputTest.java.
@ -355,139 +354,6 @@ WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(TestInputSourcesChange) {
t->EndTest();
}
// Ensure that when an input source's profiles array changes, an input source
// change event is fired and a new input source is created.
// OpenVR-only since WMR/OpenXR only supports one kind of gamepad, so it's not
// possible to update the connected gamepad functionality to force the profiles
// array to change.
IN_PROC_BROWSER_TEST_F(WebXrVrOpenVrBrowserTest, TestInputProfilesChange) {
WebXrControllerInputMock my_mock;
unsigned int controller_index = my_mock.CreateAndConnectMinimalGamepad();
LoadFileAndAwaitInitialization("test_webxr_input_same_object");
EnterSessionWithUserGestureOrFail();
// Wait for the first changed event
PollJavaScriptBooleanOrFail("inputChangeEvents === 1",
WebXrVrBrowserTestBase::kPollTimeoutShort);
// We only expect one input source, cache it.
RunJavaScriptOrFail("validateInputSourceLength(1)");
RunJavaScriptOrFail("updateCachedInputSource(0)");
// Add a touchpad so that the profiles array changes and verify that we get a
// change event.
uint64_t supported_buttons =
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrigger) |
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrackpad);
std::map<device::XrButtonId, unsigned int> axis_types = {
{device::XrButtonId::kAxisTrackpad, device::XrAxisType::kTrackpad},
{device::XrButtonId::kAxisTrigger, device::XrAxisType::kTrigger},
};
my_mock.UpdateControllerSupport(controller_index, axis_types,
supported_buttons);
PollJavaScriptBooleanOrFail("inputChangeEvents === 2",
WebXrVrBrowserTestBase::kPollTimeoutShort);
RunJavaScriptOrFail("validateCachedSourcePresence(false)");
RunJavaScriptOrFail("validateInputSourceLength(1)");
RunJavaScriptOrFail("done()");
EndTest();
}
// Ensure that changes to a gamepad object respect that it is the same object
// and that if whether or not an input source has a gamepad changes that the
// input source change event is fired and a new input source is created.
// OpenVR-only since WMR/OpenXR doesn't support the notion of an incomplete
// gamepad except if using voice input.
IN_PROC_BROWSER_TEST_F(WebXrVrOpenVrBrowserTest, TestInputGamepadSameObject) {
WebXrControllerInputMock my_mock;
// Create a set of buttons and axes that don't have enough data to be made
// into an xr-standard gamepad (which we expect the runtimes to not report).
// Even just setting the select trigger is now enough to create an xr-standard
// gamepad, so we only set the grip trigger in this case.
uint64_t insufficient_buttons =
device::XrButtonMaskFromId(device::XrButtonId::kGrip);
std::map<device::XrButtonId, unsigned int> insufficient_axis_types = {};
// Create a set of buttons and axes that we expect to have enough data to be
// made into an xr-standard gamepad (which we expect the runtimes to report).
uint64_t sufficient_buttons =
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrigger) |
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrackpad);
std::map<device::XrButtonId, unsigned int> sufficient_axis_types = {
{device::XrButtonId::kAxisTrackpad, device::XrAxisType::kTrackpad},
{device::XrButtonId::kAxisTrigger, device::XrAxisType::kTrigger},
};
// Start off without a gamepad.
unsigned int controller_index = my_mock.CreateAndConnectController(
device::ControllerRole::kControllerRoleRight, insufficient_axis_types,
insufficient_buttons);
LoadFileAndAwaitInitialization("test_webxr_input_same_object");
EnterSessionWithUserGestureOrFail();
// We should only have seen the first change indicating we have input sources.
PollJavaScriptBooleanOrFail("inputChangeEvents === 1", kPollTimeoutShort);
// We only expect one input source, cache it.
RunJavaScriptOrFail("validateInputSourceLength(1)");
RunJavaScriptOrFail("updateCachedInputSource(0)");
// Toggle a button and confirm that the controller is still the same.
my_mock.ToggleButtons(controller_index, insufficient_buttons);
RunJavaScriptOrFail("validateCachedSourcePresence(true)");
RunJavaScriptOrFail("validateCurrentAndCachedGamepadMatch()");
// Update the controller to now support a gamepad and verify that we get a
// change event and that the old controller isn't present. Then cache the new
// one.
my_mock.UpdateControllerSupport(controller_index, sufficient_axis_types,
sufficient_buttons);
PollJavaScriptBooleanOrFail("inputChangeEvents === 2", kPollTimeoutShort);
RunJavaScriptOrFail("validateCachedSourcePresence(false)");
RunJavaScriptOrFail("validateInputSourceLength(1)");
RunJavaScriptOrFail("updateCachedInputSource(0)");
// Toggle a button and confirm that the controller is still the same.
my_mock.PressReleasePrimaryTrigger(controller_index);
RunJavaScriptOrFail("validateCachedSourcePresence(true)");
RunJavaScriptOrFail("validateCurrentAndCachedGamepadMatch()");
// Switch back to the insufficient gamepad and confirm that we get the change.
my_mock.UpdateControllerSupport(controller_index, insufficient_axis_types,
insufficient_buttons);
PollJavaScriptBooleanOrFail("inputChangeEvents === 3", kPollTimeoutShort);
RunJavaScriptOrFail("validateCachedSourcePresence(false)");
RunJavaScriptOrFail("validateInputSourceLength(1)");
RunJavaScriptOrFail("done()");
EndTest();
}
// Ensure that if the controller lacks enough data to be considered a Gamepad
// that the input source that it is associated with does not have a Gamepad.
// OpenVR-only because WMR/OpenXR does not currently support the notion of
// incomplete gamepads other than voice input.
IN_PROC_BROWSER_TEST_F(WebXrVrOpenVrBrowserTest, TestGamepadIncompleteData) {
WebXrControllerInputMock my_mock;
// Create a controller that only supports select, i.e. it lacks enough data
// to be considered a gamepad.
uint64_t supported_buttons =
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrigger);
my_mock.CreateAndConnectController(
device::ControllerRole::kControllerRoleRight, {}, supported_buttons);
LoadFileAndAwaitInitialization("test_webxr_gamepad_support");
EnterSessionWithUserGestureOrFail();
PollJavaScriptBooleanOrFail("inputSourceHasNoGamepad()", kPollTimeoutShort);
PollJavaScriptBooleanOrFail("isProfileCountEqualTo(0)", kPollTimeoutShort);
RunJavaScriptOrFail("done()");
EndTest();
}
// Ensure that if a Gamepad has the minimum required number of axes/buttons to
// be considered an xr-standard Gamepad, that it is exposed as such, and that
// we can check the state of it's priamry axes/button.
@ -530,10 +396,6 @@ WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(TestGamepadMinimumData) {
VerifyInputSourceProfilesArray(
t, {"windows-mixed-reality",
"generic-trigger-squeeze-touchpad-thumbstick"});
} else if (t->GetRuntimeType() ==
XrBrowserTestBase::RuntimeType::RUNTIME_OPENVR) {
VerifyInputSourceProfilesArray(
t, {"test-value-test-value", "generic-trigger"});
} else if (t->GetRuntimeType() ==
XrBrowserTestBase::RuntimeType::RUNTIME_OPENXR) {
// OpenXR will still report having squeeze, menu, touchpad, and thumbstick
@ -612,10 +474,6 @@ WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(TestMultipleGamepads) {
VerifyInputSourceProfilesArray(
t, {"windows-mixed-reality",
"generic-trigger-squeeze-touchpad-thumbstick"});
} else if (t->GetRuntimeType() ==
XrBrowserTestBase::RuntimeType::RUNTIME_OPENVR) {
VerifyInputSourceProfilesArray(
t, {"test-value-test-value", "generic-trigger"});
} else if (t->GetRuntimeType() ==
XrBrowserTestBase::RuntimeType::RUNTIME_OPENXR) {
// OpenXR will still report having squeeze, menu, touchpad, and thumbstick
@ -720,11 +578,6 @@ WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(TestGamepadCompleteData) {
VerifyInputSourceProfilesArray(
t, {"windows-mixed-reality",
"generic-trigger-squeeze-touchpad-thumbstick"});
} else if (t->GetRuntimeType() ==
XrBrowserTestBase::RuntimeType::RUNTIME_OPENVR) {
VerifyInputSourceProfilesArray(
t, {"test-value-test-value",
"generic-trigger-squeeze-touchpad-thumbstick"});
} else if (t->GetRuntimeType() ==
XrBrowserTestBase::RuntimeType::RUNTIME_OPENXR) {
// OpenXR will still report having squeeze, menu, touchpad, and thumbstick
@ -739,161 +592,6 @@ WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(TestGamepadCompleteData) {
t->EndTest();
}
// Tests that axes data is still reported on the secondary axes even if
// the button is not supported (we see this case with WMR through OpenVR where
// the secondary axes button is reserved by the system, but we still get valid
// data for the axes, there may be other controllers where this is the case).
// Because this is specifically a bug in the OpenVR runtime/with configurable
// controllers, not testing WMR/OpenXR.
IN_PROC_BROWSER_TEST_F(WebXrVrOpenVrBrowserTest, TestInputAxesWithNoButton) {
WebXrControllerInputMock my_mock;
// Create a controller that supports all reserved buttons, except the
// secondary axis. (Though it is a valid axis)
uint64_t supported_buttons =
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrigger) |
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrackpad) |
device::XrButtonMaskFromId(device::XrButtonId::kGrip);
std::map<device::XrButtonId, unsigned int> axis_types = {
{device::XrButtonId::kAxisTrackpad, device::XrAxisType::kTrackpad},
{device::XrButtonId::kAxisTrigger, device::XrAxisType::kTrigger},
{device::XrButtonId::kAxisThumbstick, device::XrAxisType::kJoystick},
};
unsigned int controller_index = my_mock.CreateAndConnectController(
device::ControllerRole::kControllerRoleRight, axis_types,
supported_buttons);
LoadFileAndAwaitInitialization("test_webxr_gamepad_support");
EnterSessionWithUserGestureOrFail();
VerifyInputCounts(this, 1, 1);
// Setup some state on the optional buttons (as TestGamepadMinimumData should
// ensure proper state on the required buttons).
// Set a value on the secondary set of axes.
my_mock.SetAxes(controller_index, device::XrButtonId::kAxisThumbstick, 0.25,
-0.25);
// Controller should meet the requirements for the 'xr-standard' mapping.
PollJavaScriptBooleanOrFail("isMappingEqualTo('xr-standard')",
WebXrVrBrowserTestBase::kPollTimeoutShort);
// Controller should have all required and optional xr-standard buttons
PollJavaScriptBooleanOrFail("isButtonCountEqualTo(4)",
WebXrVrBrowserTestBase::kPollTimeoutShort);
// The secondary set of axes should be set appropriately.
PollJavaScriptBooleanOrFail("areAxesValuesEqualTo(1, 0.25, -0.25)",
WebXrVrBrowserTestBase::kPollTimeoutShort);
// If we have a non-zero axis value, the button should be touched.
PollJavaScriptBooleanOrFail("isButtonTouchedEqualTo(3, true)",
WebXrVrBrowserTestBase::kPollTimeoutShort);
RunJavaScriptOrFail("done()");
EndTest();
}
// Ensure that if a Gamepad has all required buttons, an extra button not
// mapped in the xr-standard specification, and is missing reserved buttons
// from the XR Standard specification, that the extra button does not appear
// in either of the reserved button slots. OpenVR-only since WMR/OpenXR only
// supports one controller type.
IN_PROC_BROWSER_TEST_F(WebXrVrOpenVrBrowserTest, TestGamepadReservedData) {
WebXrControllerInputMock my_mock;
// Create a controller that is missing reserved buttons, but supports an
// extra button to guarantee that the reserved button is held.
uint64_t supported_buttons =
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrigger) |
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrackpad) |
device::XrButtonMaskFromId(device::XrButtonId::kA);
std::map<device::XrButtonId, unsigned int> axis_types = {
{device::XrButtonId::kAxisTrackpad, device::XrAxisType::kTrackpad},
{device::XrButtonId::kAxisTrigger, device::XrAxisType::kTrigger},
};
unsigned int controller_index = my_mock.CreateAndConnectController(
device::ControllerRole::kControllerRoleRight, axis_types,
supported_buttons);
LoadFileAndAwaitInitialization("test_webxr_gamepad_support");
EnterSessionWithUserGestureOrFail();
VerifyInputCounts(this, 1, 1);
// Claim that all buttons are pressed, note that any non-supported buttons
// should be ignored.
my_mock.ToggleButtons(controller_index, UINT64_MAX);
// Index 1 and 3 are reserved for the grip and joystick.
// As our controller doesn't support them, they should be present but not
// pressed, and our "extra" button should be index 4 and should be pressed.
PollJavaScriptBooleanOrFail("isMappingEqualTo('xr-standard')",
kPollTimeoutShort);
PollJavaScriptBooleanOrFail("isButtonCountEqualTo(5)", kPollTimeoutShort);
PollJavaScriptBooleanOrFail("isButtonPressedEqualTo(0, true)",
kPollTimeoutShort);
PollJavaScriptBooleanOrFail("isButtonPressedEqualTo(1, false)",
kPollTimeoutShort);
PollJavaScriptBooleanOrFail("isButtonPressedEqualTo(2, true)",
kPollTimeoutShort);
PollJavaScriptBooleanOrFail("isButtonPressedEqualTo(3, false)",
kPollTimeoutShort);
PollJavaScriptBooleanOrFail("isButtonPressedEqualTo(4, true)",
kPollTimeoutShort);
VerifyInputSourceProfilesArray(
this, {"test-value-test-value", "generic-trigger-touchpad"});
RunJavaScriptOrFail("done()");
EndTest();
}
// Ensure that if a gamepad has a grip, but not any extra buttons or a secondary
// axis, that no trailing placeholder button is added. This is a slight
// variation on TestGamepadMinimalData, but won't re-test whether or not buttons
// get sent up. Note that since WMR/OpenXR always builds the WMR/OpenXR
// controller which supports all required and optional buttons specified by the
// xr-standard mapping, this test is OpenVR-only.
IN_PROC_BROWSER_TEST_F(WebXrVrOpenVrBrowserTest, TestGamepadOptionalData) {
WebXrControllerInputMock my_mock;
// Create a controller that supports the trigger, primary axis, and grip
uint64_t supported_buttons =
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrigger) |
device::XrButtonMaskFromId(device::XrButtonId::kAxisTrackpad) |
device::XrButtonMaskFromId(device::XrButtonId::kGrip);
std::map<device::XrButtonId, unsigned int> axis_types = {
{device::XrButtonId::kAxisTrackpad, device::XrAxisType::kTrackpad},
{device::XrButtonId::kAxisTrigger, device::XrAxisType::kTrigger},
};
my_mock.CreateAndConnectController(
device::ControllerRole::kControllerRoleRight, axis_types,
supported_buttons);
LoadFileAndAwaitInitialization("test_webxr_gamepad_support");
EnterSessionWithUserGestureOrFail();
VerifyInputCounts(this, 1, 1);
// There should be enough buttons for an xr-standard mapping, and it should
// have one optional button, but not the other.
PollJavaScriptBooleanOrFail("isMappingEqualTo('xr-standard')",
kPollTimeoutShort);
PollJavaScriptBooleanOrFail("isButtonCountEqualTo(3)", kPollTimeoutShort);
VerifyInputSourceProfilesArray(
this, {"test-value-test-value", "generic-trigger-squeeze-touchpad"});
RunJavaScriptOrFail("done()");
EndTest();
}
#if BUILDFLAG(ENABLE_OPENXR)
// Ensure that if OpenXR Runtime receive interaction profile chagnes event,
// input profile name will be changed accordingly.
@ -1000,8 +698,6 @@ IN_PROC_BROWSER_TEST_F(WebXrVrWmrBrowserTest, TestVoiceSelectRegistered) {
// Equivalent to
// WebXrVrInputTest#testControllerClicksRegisteredOnDaydream_WebXr.
WEBXR_VR_ALL_RUNTIMES_BROWSER_TEST_F(TestControllerInputRegistered) {
// TODO(crbug.com/1033087): Test is flaky on OpenVR
WEBXR_VR_DISABLE_TEST_ON(XrBrowserTestBase::RuntimeType::RUNTIME_OPENVR);
WebXrControllerInputMock my_mock;
unsigned int controller_index = my_mock.CreateAndConnectMinimalGamepad();

@ -37,14 +37,12 @@ IN_PROC_BROWSER_TEST_F(WebXrVrRuntimelessBrowserTest,
#ifdef OS_WIN
#if BUILDFLAG(ENABLE_OPENXR)
IN_PROC_MULTI_CLASS_BROWSER_TEST_F3(WebXrVrOpenVrBrowserTestWebXrDisabled,
WebXrVrWmrBrowserTestWebXrDisabled,
IN_PROC_MULTI_CLASS_BROWSER_TEST_F2(WebXrVrWmrBrowserTestWebXrDisabled,
WebXrVrOpenXrBrowserTestWebXrDisabled,
WebXrVrBrowserTestBase,
TestWebXrDisabledWithoutFlagSet) {
#else
IN_PROC_MULTI_CLASS_BROWSER_TEST_F2(WebXrVrOpenVrBrowserTestWebXrDisabled,
WebXrVrWmrBrowserTestWebXrDisabled,
IN_PROC_MULTI_CLASS_BROWSER_TEST_F1(WebXrVrWmrBrowserTestWebXrDisabled,
WebXrVrBrowserTestBase,
TestWebXrDisabledWithoutFlagSet) {
#endif // BUILDFLAG(ENABLE_OPENXR)

@ -914,8 +914,6 @@ const char kWebXrRuntimeNone[] = "no-vr-runtime";
const char kWebXrRuntimeOrientationSensors[] = "orientation-sensors";
// The following are the runtimes that WebXr supports.
const char kWebXrRuntimeOculus[] = "oculus";
const char kWebXrRuntimeOpenVr[] = "openvr";
const char kWebXrRuntimeOpenXr[] = "openxr";
const char kWebXrRuntimeWMR[] = "windows-mixed-reality";

@ -248,8 +248,6 @@ CONTENT_EXPORT extern const char kDisableScrollToTextFragment[];
CONTENT_EXPORT extern const char kWebXrForceRuntime[];
CONTENT_EXPORT extern const char kWebXrRuntimeNone[];
CONTENT_EXPORT extern const char kWebXrRuntimeOrientationSensors[];
CONTENT_EXPORT extern const char kWebXrRuntimeOculus[];
CONTENT_EXPORT extern const char kWebXrRuntimeOpenVr[];
CONTENT_EXPORT extern const char kWebXrRuntimeOpenXr[];
CONTENT_EXPORT extern const char kWebXrRuntimeWMR[];

@ -12,14 +12,6 @@
#include "device/base/features.h"
#include "device/vr/buildflags/buildflags.h"
#if BUILDFLAG(ENABLE_OPENVR)
#include "device/vr/openvr/openvr_device.h"
#endif
#if BUILDFLAG(ENABLE_OCULUS_VR)
#include "device/vr/oculus/oculus_device.h"
#endif
#if BUILDFLAG(ENABLE_WINDOWS_MR)
#include "device/vr/windows_mixed_reality/mixed_reality_device.h"
#include "device/vr/windows_mixed_reality/mixed_reality_statics.h"
@ -128,24 +120,6 @@ void IsolatedXRRuntimeProvider::PollForDeviceChanges() {
}
#endif
#if BUILDFLAG(ENABLE_OCULUS_VR)
if (!preferred_device_enabled && IsOculusVrHardwareAvailable()) {
SetOculusVrRuntimeStatus(RuntimeStatus::kEnable);
preferred_device_enabled = true;
} else {
SetOculusVrRuntimeStatus(RuntimeStatus::kDisable);
}
#endif
#if BUILDFLAG(ENABLE_OPENVR)
if (!preferred_device_enabled && IsOpenVrHardwareAvailable()) {
SetOpenVrRuntimeStatus(RuntimeStatus::kEnable);
preferred_device_enabled = true;
} else {
SetOpenVrRuntimeStatus(RuntimeStatus::kDisable);
}
#endif
// Schedule this function to run again later.
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE,
@ -162,22 +136,6 @@ void IsolatedXRRuntimeProvider::SetupPollingForDeviceChanges() {
// we'll get an error for 'command_line' being unused.
ALLOW_UNUSED_LOCAL(command_line);
#if BUILDFLAG(ENABLE_OCULUS_VR)
if (IsEnabled(command_line, device::features::kOculusVR,
switches::kWebXrRuntimeOculus)) {
should_check_oculus_ = device::OculusDevice::IsApiAvailable();
any_runtimes_available |= should_check_oculus_;
}
#endif
#if BUILDFLAG(ENABLE_OPENVR)
if (IsEnabled(command_line, device::features::kOpenVR,
switches::kWebXrRuntimeOpenVr)) {
should_check_openvr_ = device::OpenVRDevice::IsApiAvailable();
any_runtimes_available |= should_check_openvr_;
}
#endif
#if BUILDFLAG(ENABLE_WINDOWS_MR)
if (IsEnabled(command_line, device::features::kWindowsMixedReality,
switches::kWebXrRuntimeWMR)) {
@ -211,34 +169,6 @@ void IsolatedXRRuntimeProvider::RequestDevices(
client_->OnDevicesEnumerated();
}
#if BUILDFLAG(ENABLE_OCULUS_VR)
bool IsolatedXRRuntimeProvider::IsOculusVrHardwareAvailable() {
return should_check_oculus_ &&
((oculus_device_ && oculus_device_->IsAvailable()) ||
device::OculusDevice::IsHwAvailable());
}
void IsolatedXRRuntimeProvider::SetOculusVrRuntimeStatus(RuntimeStatus status) {
SetRuntimeStatus(client_.get(), status,
base::BindOnce(&CreateDevice<device::OculusDevice>),
&oculus_device_);
}
#endif // BUILDFLAG(ENABLE_OCULUS_VR)
#if BUILDFLAG(ENABLE_OPENVR)
bool IsolatedXRRuntimeProvider::IsOpenVrHardwareAvailable() {
return should_check_openvr_ &&
((openvr_device_ && openvr_device_->IsAvailable()) ||
device::OpenVRDevice::IsHwAvailable());
}
void IsolatedXRRuntimeProvider::SetOpenVrRuntimeStatus(RuntimeStatus status) {
SetRuntimeStatus(client_.get(), status,
base::BindOnce(&CreateDevice<device::OpenVRDevice>),
&openvr_device_);
}
#endif // BUILDFLAG(ENABLE_OPENVR)
#if BUILDFLAG(ENABLE_WINDOWS_MR)
bool IsolatedXRRuntimeProvider::IsWMRHardwareAvailable() {
return should_check_wmr_ && wmr_statics_->IsHardwareAvailable();

@ -13,8 +13,6 @@
#include "mojo/public/cpp/bindings/remote.h"
namespace device {
class OculusDevice;
class OpenVRDevice;
class MixedRealityDevice;
class MixedRealityDeviceStatics;
class OpenXrDevice;
@ -37,20 +35,6 @@ class IsolatedXRRuntimeProvider
void PollForDeviceChanges();
void SetupPollingForDeviceChanges();
#if BUILDFLAG(ENABLE_OCULUS_VR)
bool IsOculusVrHardwareAvailable();
void SetOculusVrRuntimeStatus(RuntimeStatus status);
bool should_check_oculus_ = false;
std::unique_ptr<device::OculusDevice> oculus_device_;
#endif
#if BUILDFLAG(ENABLE_OPENVR)
bool IsOpenVrHardwareAvailable();
void SetOpenVrRuntimeStatus(RuntimeStatus status);
bool should_check_openvr_ = false;
std::unique_ptr<device::OpenVRDevice> openvr_device_;
#endif
#if BUILDFLAG(ENABLE_WINDOWS_MR)
bool IsWMRHardwareAvailable();
void SetWMRRuntimeStatus(RuntimeStatus status);

@ -39,16 +39,6 @@ const base::Feature kWebXrOrientationSensorDevice {
};
#endif // BUILDFLAG(ENABLE_VR)
namespace features {
#if BUILDFLAG(ENABLE_OCULUS_VR)
// Controls WebXR support for the Oculus Runtime.
const base::Feature kOculusVR{"OculusVR", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // ENABLE_OCULUS_VR
#if BUILDFLAG(ENABLE_OPENVR)
// Controls WebXR support for the OpenVR Runtime.
const base::Feature kOpenVR{"OpenVR", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // ENABLE_OPENVR
#if BUILDFLAG(ENABLE_OPENXR)
// Controls WebXR support for the OpenXR Runtime.
const base::Feature kOpenXR{"OpenXR", base::FEATURE_ENABLED_BY_DEFAULT};

@ -28,12 +28,6 @@ DEVICE_BASE_EXPORT extern const base::Feature kWebXrOrientationSensorDevice;
// New features should be added to the device::features namespace.
namespace features {
#if BUILDFLAG(ENABLE_OCULUS_VR)
DEVICE_BASE_EXPORT extern const base::Feature kOculusVR;
#endif // ENABLE_OCULUS_VR
#if BUILDFLAG(ENABLE_OPENVR)
DEVICE_BASE_EXPORT extern const base::Feature kOpenVR;
#endif // ENABLE_OPENVR
#if BUILDFLAG(ENABLE_OPENXR)
DEVICE_BASE_EXPORT extern const base::Feature kOpenXR;
#endif // ENABLE_OPENXR