Documentation ¶
Overview ¶
Package testutil provides utilities to setup testing environment for camera tests.
Package testutil provides utilities to setup testing environment for camera tests.
Package testutil provides utilities to setup testing environment for camera tests.
Index ¶
- func CaptureDevicesFromV4L2Test(ctx context.Context) ([]string, error)
- func ChromeWithFakeCamera() testing.Precondition
- func CloseApp(ctx context.Context, cr *chrome.Chrome, appConn *chrome.Conn, ...) error
- func IsVividDriverLoaded(ctx context.Context) bool
- func MIPICamerasFromCrOSCameraTool(ctx context.Context) ([]map[string]string, error)
- func USBCamerasFromV4L2Test(ctx context.Context) ([]string, error)
- type AppLauncher
- type AppWindow
- func (a *AppWindow) ClosingItself(ctx context.Context) (bool, error)
- func (a *AppWindow) Errors(ctx context.Context) ([]ErrorInfo, error)
- func (a *AppWindow) NotifyReady(ctx context.Context) error
- func (a *AppWindow) Perfs(ctx context.Context) ([]PerfEntry, error)
- func (a *AppWindow) Release(ctx context.Context) error
- func (a *AppWindow) WaitUntilClosed(ctx context.Context) error
- func (a *AppWindow) WaitUntilWindowBound(ctx context.Context) (string, error)
- type ErrorInfo
- type ErrorLevel
- type PerfEntry
- type TestBridge
- type UseCameraType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CaptureDevicesFromV4L2Test ¶
CaptureDevicesFromV4L2Test returns a list of usb camera paths.
func ChromeWithFakeCamera ¶
func ChromeWithFakeCamera() testing.Precondition
ChromeWithFakeCamera returns a precondition that Chrome is already logged in with fake camera.
func CloseApp ¶
func CloseApp(ctx context.Context, cr *chrome.Chrome, appConn *chrome.Conn, useSWAWindow bool) error
CloseApp closes the camera app and ensure the window is closed via autotest private API.
func IsVividDriverLoaded ¶
IsVividDriverLoaded returns whether vivid driver is loaded on the device.
func MIPICamerasFromCrOSCameraTool ¶
MIPICamerasFromCrOSCameraTool returns a list of MIPI camera information outputted from cros-camera-tool.
Types ¶
type AppLauncher ¶
type AppLauncher struct { LaunchApp func(ctx context.Context, tconn *chrome.TestConn) error UseSWAWindow bool }
AppLauncher is used during the launch process of CCA. We could launch CCA by launchApp event, camera intent or any other ways.
type AppWindow ¶
type AppWindow struct {
// contains filtered or unexported fields
}
AppWindow is used to comminicate with CCA foreground window.
func LaunchApp ¶
func LaunchApp(ctx context.Context, cr *chrome.Chrome, tb *TestBridge, appLauncher AppLauncher) (*chrome.Conn, *AppWindow, error)
LaunchApp launches the camera app and handles the communication flow between tests and app.
func RefreshApp ¶
RefreshApp refreshes the camera app and rebuilds the communication flow between tests and app.
func (*AppWindow) ClosingItself ¶
ClosingItself checks if CCA intends to close itself.
func (*AppWindow) NotifyReady ¶
NotifyReady notifies CCA that the setup on test side is ready so it can continue the execution.
func (*AppWindow) WaitUntilClosed ¶
WaitUntilClosed waits until the corresponding CCA window is closed.
type ErrorInfo ¶
type ErrorInfo struct { ErrorType string `json:"type"` Level ErrorLevel `json:"level"` Stack string `json:"stack"` Time int64 `json:"time"` ErrorName string `json:"name"` }
ErrorInfo stores the information of an error.
type ErrorLevel ¶
type ErrorLevel string
ErrorLevel represents the severity level of an error.
const ( // ErrorLevelWarning is used when it should not cause test failure. ErrorLevelWarning ErrorLevel = "WARNING" // ErrorLevelError is used when it should fail the test. ErrorLevelError = "ERROR" )
type PerfEntry ¶
type PerfEntry struct { Event string `json:"event"` Duration float64 `json:"duration"` PerfInfo struct { Facing string `json:"facing"` } `json:"perfInfo"` }
PerfEntry stores the information of a perf event.
type TestBridge ¶
type TestBridge struct { // TODO(b/177800595): Store this information in fixture. CameraType UseCameraType // contains filtered or unexported fields }
TestBridge is used to comminicate with CCA for test specific logic, such as test environment set-up/tear-down flow, performance/error monitoring.
func NewTestBridge ¶
func NewTestBridge(ctx context.Context, cr *chrome.Chrome, cameraType UseCameraType) (*TestBridge, error)
NewTestBridge returns a new test bridge instance.
func NewTestBridgeWithoutTestConfig ¶
func NewTestBridgeWithoutTestConfig(ctx context.Context, cr *chrome.Chrome, cameraType UseCameraType) (*TestBridge, error)
NewTestBridgeWithoutTestConfig returns a new test bridge instance without test config.
type UseCameraType ¶
type UseCameraType int
UseCameraType defines what camera type is used in a test.
const ( // UseRealCamera is used when the test should test with real camera which exercises cros-camera service. UseRealCamera UseCameraType = iota // UseVividCamera is used when the test should use vivid camera, which is virtual video test driver. UseVividCamera // UseFakeCamera is used when the test should use fake camera in Chrome stack instead. UseFakeCamera )