lacrosfixt

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

Package lacrosfixt contains tools for working with lacros fixtures.

Index

Constants

View Source
const LacrosDeployedBinary = "lacrosDeployedBinary"

LacrosDeployedBinary contains the Fixture Var necessary to run lacros. This should be used by any lacros fixtures defined outside this file.

View Source
const LacrosLogPath = "/home/chronos/user/lacros/lacros.log"

LacrosLogPath is where the lacros log file ought to be. N.B. If lacros is launched multiple times (via command line launch, the current default), then this logfile will be overwritten. Launching means starting a new lacros process entirely, not just creating a new window or tab.

View Source
const (
	// LacrosSquashFSPath indicates the location of the rootfs lacros squashfs filesystem.
	LacrosSquashFSPath = "/opt/google/lacros/lacros.squash"
)

Variables

This section is empty.

Functions

func ExtensionArgs

func ExtensionArgs(extID, extList string) []string

ExtensionArgs returns a list of args needed to pass to a lacros instance to enable the test extension.

func NewComposedFixture

func NewComposedFixture(selection lacros.Selection, makeValue func(v FixtValue, pv interface{}) interface{},
	fOpt chrome.OptionsCallback) testing.FixtureImpl

NewComposedFixture is similar to NewFixture but allows tests to customise the FixtValue used. This lets tests compose fixtures via struct embedding.

func NewFixture

func NewFixture(selection lacros.Selection, fOpt chrome.OptionsCallback) testing.FixtureImpl

NewFixture creates a new fixture that can launch Lacros chrome with the given selection and Chrome options.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

Config holds runtime vars or other variables needed to set up Lacros.

func NewConfigFromState

func NewConfigFromState(s TestingState, ops ...Option) *Config

NewConfigFromState creates a new LacrosConfig instance. TestingState allows both testing.FixtState and testing.State to be passed in.

func (*Config) Opts

func (cfg *Config) Opts() ([]chrome.Option, error)

Opts returns common chrome options for Lacros for the Config.

type FixtValue

type FixtValue interface {
	chrome.HasChrome
	TestAPIConn() *chrome.TestConn
}

The FixtValue object is made available to users of this fixture via:

func DoSomething(ctx context.Context, s *testing.State) {
	d := s.FixtValue().(lacros.FixtValue)
	...
}

type Option

type Option func(*Config)

Option is the function signature used to specify options of Config.

func ChromeOptions

func ChromeOptions(opts ...chrome.Option) Option

ChromeOptions returns an Option which appends the given chrome.Options to lacros.Config. The options will be returned in lacros.Config.Opts.

func EnableWebAppInstall

func EnableWebAppInstall() Option

EnableWebAppInstall returns whether to automatically install essential web apps on Lacros.

func KeepAlive

func KeepAlive(on bool) Option

KeepAlive returns an Option which sets lacros keep-alive to the desired value.

func Mode

func Mode(mode lacros.Mode) Option

Mode returns an Option which sets the mode on the lacros config.

func Selection

func Selection(selection lacros.Selection) Option

Selection returns an Option which sets the selection on the lacros config.

type TestingState

type TestingState interface {
	Var(string) (string, bool)
}

TestingState is a mixin interface that allows both testing.FixtState and testing.State to be passed into NewConfigFromState.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL