lacros

package
Version: v0.0.0-...-3acf0f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package lacros implements a library used for utilities and communication with lacros-chrome on ChromeOS.

Package lacros implements a library used for utilities and communication with lacros-chrome on ChromeOS.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseAboutBlank

func CloseAboutBlank(ctx context.Context, tconn *chrome.TestConn, ds *cdputil.Session, windowsExpectedClosed int) error

CloseAboutBlank finds all targets that are about:blank, closes them, then waits until they are gone. windowsExpectedClosed indicates how many windows that we expect to be closed from doing this operation.

func CloseLacrosChrome

func CloseLacrosChrome(ctx context.Context, l *launcher.LacrosChrome)

CloseLacrosChrome closes the given lacros-chrome, if it is non-nil. Otherwise, it does nothing.

func FindFirstBlankWindow

func FindFirstBlankWindow(ctx context.Context, ctconn *chrome.TestConn) (*ash.Window, error)

FindFirstBlankWindow finds the first window whose title is 'about:blank'.

func FindFirstNonBlankWindow

func FindFirstNonBlankWindow(ctx context.Context, ctconn *chrome.TestConn) (*ash.Window, error)

FindFirstNonBlankWindow finds the first window whose title is not 'about:blank'.

func GetChrome

func GetChrome(ctx context.Context, f interface{}) (*chrome.Chrome, error)

GetChrome gets the *chrome.Chrome object given some FixtData, which may be lacros launcher.FixtData.

func Setup

func Setup(ctx context.Context, f interface{}, artifactPath string, crt ChromeType) (*chrome.Chrome, *launcher.LacrosChrome, ash.ConnSource, error)

Setup runs lacros-chrome if indicated by the given ChromeType and returns some objects and interfaces useful in tests. If the ChromeType is ChromeTypeLacros, it will return a non-nil LacrosChrome instance or an error. If the ChromeType is ChromeTypeChromeOS it will return a nil LacrosChrome instance. TODO(crbug.com/1127165): Remove the artifactPath argument when we can use Data in fixtures.

Types

type ChromeType

type ChromeType string

ChromeType indicates which type of Chrome browser to be used.

const (
	// ChromeTypeChromeOS indicates we are using the ChromeOS system's Chrome browser.
	ChromeTypeChromeOS ChromeType = "chromeos"
	// ChromeTypeLacros indicates we are using lacros-chrome.
	ChromeTypeLacros ChromeType = "lacros"
)

type CleanupCallback

type CleanupCallback func(context.Context) error

CleanupCallback is a callback that should be deferred to clean up test resources.

func CombineCleanup

func CombineCleanup(ctx context.Context, existing, new func(context.Context) error, msg string) CleanupCallback

CombineCleanup combines two CleanupCallbacks so they are executed in the same order that they would be if they had been deferred.

func SetupCrosTestWithPage

func SetupCrosTestWithPage(ctx context.Context, f launcher.FixtData, url string) (*chrome.Conn, CleanupCallback, error)

SetupCrosTestWithPage opens a cros-chrome page after waiting for a stable environment (CPU temperature, etc).

func SetupLacrosTestWithPage

func SetupLacrosTestWithPage(ctx context.Context, f launcher.FixtData, artifactPath, url string) (
	retConn *chrome.Conn, retTConn *chrome.TestConn, retL *launcher.LacrosChrome, retCleanup CleanupCallback, retErr error)

SetupLacrosTestWithPage opens a lacros-chrome page after waiting for a stable environment (CPU temperature, etc). TODO(crbug.com/1127165): Remove the artifactPath argument when we can use Data in fixtures.

func SetupPerfTest

func SetupPerfTest(ctx context.Context, tconn *chrome.TestConn, name string) (retCleanup CleanupCallback, retErr error)

SetupPerfTest sets up a stable environment for a lacros performance test. The returned CleanupCallback should be deferred to be executed upon test completion.

Directories

Path Synopsis
Package faillog provides a way to record logs on test failure.
Package faillog provides a way to record logs on test failure.
Package launcher implements a library used to setup and launch lacros-chrome.
Package launcher implements a library used to setup and launch lacros-chrome.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto