1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_VR_TEST_WEBXR_VR_BROWSER_TEST_H_
#define CHROME_BROWSER_VR_TEST_WEBXR_VR_BROWSER_TEST_H_
#include "build/build_config.h"
#include "chrome/browser/vr/test/conditional_skipping.h"
#include "chrome/browser/vr/test/webxr_browser_test.h"
#include "chrome/browser/vr/test/xr_browser_test.h"
#include "components/permissions/permission_request_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_features.h"
#include "device/vr/buildflags/buildflags.h"
#include "ui/gfx/geometry/vector3d_f.h"
#if BUILDFLAG(IS_WIN)
#include "sandbox/policy/features.h"
#endif
namespace permissions {
class MockPermissionPromptFactory;
}
namespace vr {
// WebXR for VR-specific test base class without any particular runtime.
class WebXrVrBrowserTestBase : public WebXrBrowserTestBase {
public:
WebXrVrBrowserTestBase();
~WebXrVrBrowserTestBase() override;
void EnterSessionWithUserGesture(content::WebContents* web_contents) override;
void EnterSessionWithUserGestureOrFail(
content::WebContents* web_contents) override;
void EndSession(content::WebContents* web_contents) override;
void EndSessionOrFail(content::WebContents* web_contents) override;
void WaitForSessionEndOrFail(content::WebContents* web_contents) override;
permissions::MockPermissionPromptFactory* GetPermissionPromptFactory();
void SetPermissionAutoResponse(
permissions::PermissionRequestManager::AutoResponseType
permission_auto_response);
virtual gfx::Vector3dF GetControllerOffset() const;
// Necessary to use the WebContents-less versions of functions.
using WebXrBrowserTestBase::EndSession;
using WebXrBrowserTestBase::EndSessionOrFail;
using WebXrBrowserTestBase::EnterSessionWithUserGesture;
using WebXrBrowserTestBase::EnterSessionWithUserGestureAndWait;
using WebXrBrowserTestBase::EnterSessionWithUserGestureOrFail;
using WebXrBrowserTestBase::WaitForSessionEndOrFail;
using WebXrBrowserTestBase::XrDeviceFound;
private:
void OnBeforeLoadFile() override;
permissions::PermissionRequestManager::AutoResponseType
permission_auto_response_ =
permissions::PermissionRequestManager::ACCEPT_ALL;
base::flat_map<content::WebContents*,
std::unique_ptr<permissions::MockPermissionPromptFactory>>
mock_permissions_map_;
};
// Test class with all runtimes disabled.
class WebXrVrRuntimelessBrowserTest : public WebXrVrBrowserTestBase {
public:
WebXrVrRuntimelessBrowserTest();
};
class WebXrVrRuntimelessBrowserTestSensorless
: public WebXrVrRuntimelessBrowserTest {
public:
WebXrVrRuntimelessBrowserTestSensorless();
};
#if BUILDFLAG(ENABLE_OPENXR)
// OpenXR-specific subclass of WebXrVrBrowserTestBase.
class WebXrVrOpenXrBrowserTestBase : public WebXrVrBrowserTestBase {
public:
WebXrVrOpenXrBrowserTestBase();
~WebXrVrOpenXrBrowserTestBase() override;
XrBrowserTestBase::RuntimeType GetRuntimeType() const override;
};
class WebXrVrOpenXrBrowserTest : public WebXrVrOpenXrBrowserTestBase {
public:
WebXrVrOpenXrBrowserTest();
};
class WebXrVrOpenXrBrowserTestWebXrDisabled
: public WebXrVrOpenXrBrowserTestBase {
public:
WebXrVrOpenXrBrowserTestWebXrDisabled();
};
#endif // BUIDFLAG(ENABLE_OPENXR)
} // namespace vr
#endif // CHROME_BROWSER_VR_TEST_WEBXR_VR_BROWSER_TEST_H_
|