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
|
// 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_BROWSER_TEST_H_
#define CHROME_BROWSER_VR_TEST_WEBXR_BROWSER_TEST_H_
#include "chrome/browser/vr/test/xr_browser_test.h"
#include "content/public/browser/web_contents.h"
namespace vr {
// Base browser test class for running WebXR/WebVR-related tests.
class WebXrBrowserTestBase : public XrBrowserTestBase {
public:
// Checks whether an XRDevice was actually found.
virtual bool XrDeviceFound(content::WebContents* web_contents);
// Enters a WebXR or WebVR session of some kind.
virtual void EnterSessionWithUserGesture(
content::WebContents* web_contents) = 0;
// Enters a WebXR or WebVR session of some kind and waits until the page
// page reports it is finished with its JavaScript step.
void EnterSessionWithUserGestureAndWait(content::WebContents* web_contents);
// Attempts to enter a WebXR or WebVR session of some kind, failing if it is
// unable to.
virtual void EnterSessionWithUserGestureOrFail(
content::WebContents* web_contents) = 0;
// Ends whatever type of session a subclass enters with
// EnterSessionWithUserGesture.
virtual void EndSession(content::WebContents* web_contents) = 0;
// Attempts to end whatever type of session a subclass enters with
// EnterSessionWithUserGesture, failing if it is unable to.
virtual void EndSessionOrFail(content::WebContents* web_contents) = 0;
// Waits for a session to be ended.
virtual void WaitForSessionEndOrFail(content::WebContents* web_contents) = 0;
// Convenience function for calling XrDeviceFound with the return value of
// GetCurrentWebContents.
bool XrDeviceFound();
// Convenience function for calling EnterSessionWithUserGesture with the
// return value of GetCurrentWebContents.
void EnterSessionWithUserGesture();
// Convenience function for calling EnterSessionWithUserGestureAndWait with
// the return value of GetCurrentWebContents.
void EnterSessionWithUserGestureAndWait();
// Convenience function for calling EnterSessionWithUserGestureOrFail with the
// return value of GetCurrentWebContents.
void EnterSessionWithUserGestureOrFail();
// Convenience function for calling EndSession with the return value of
// GetCurrentWebContents.
void EndSession();
// Convenience function for calling EndSessionOrFail with the return value of
// GetCurrentWebContents.
void EndSessionOrFail();
// Convenience function for calling `WaitForSessionEndOrFail` with the return
// value of GetCurrentWebContents.
void WaitForSessionEndOrFail();
};
} // namespace vr
#endif // CHROME_BROWSER_VR_TEST_WEBXR_BROWSER_TEST_H_
|