Documentation ¶
Overview ¶
Package chrome implements a library used for communication with Chrome.
Index ¶
- Constants
- func AddTastLibrary(ctx context.Context, conn *Conn) error
- func ComputeExtensionID(dir string) (string, error)
- func CurrentLogFile() (string, error)
- func DeprecatedPrepareExtensions() (extDirs []string, err error)
- func ExtensionBackgroundPageURL(extID string) string
- func Lock()
- func LoggedIn() testing.Precondition
- func LoggedInDisableSync() testing.Precondition
- func NewLoggedInFixture(fOpt OptionsCallback) testing.FixtureImpl
- func NewPrecondition(suffix string, opts ...Option) testing.Precondition
- func PrepareForRestart() error
- func SaveTraceToFile(ctx context.Context, trace *perfetto_proto.Trace, path string) error
- func Unlock()
- type Chrome
- func (c *Chrome) Browser() *browser.Browser
- func (c *Chrome) Chrome() *Chrome
- func (c *Chrome) Close(ctx context.Context) error
- func (c *Chrome) CloseTarget(ctx context.Context, id TargetID) error
- func (c *Chrome) ContinueLogin(ctx context.Context) error
- func (c *Chrome) Creds() Creds
- func (c *Chrome) DebugAddrPort() string
- func (c *Chrome) DeprecatedExtDirs() []string
- func (c *Chrome) FindTargets(ctx context.Context, tm TargetMatcher) ([]*Target, error)
- func (c *Chrome) IsTargetAvailable(ctx context.Context, tm TargetMatcher) (bool, error)
- func (c *Chrome) LacrosExtraArgs() []string
- func (c *Chrome) LogFilename() string
- func (c *Chrome) LoginMode() string
- func (c *Chrome) NewConn(ctx context.Context, url string, opts ...cdputil.CreateTargetOption) (*Conn, error)
- func (c *Chrome) NewConnForTarget(ctx context.Context, tm TargetMatcher) (*Conn, error)
- func (c *Chrome) NormalizedUser() string
- func (c *Chrome) Reconnect(ctx context.Context) error
- func (c *Chrome) ResetState(ctx context.Context) error
- func (c *Chrome) Responded(ctx context.Context) error
- func (c *Chrome) SigninProfileTestAPIConn(ctx context.Context) (*TestConn, error)
- func (c *Chrome) StartSystemTracing(ctx context.Context, perfettoConfig []byte) error
- func (c *Chrome) StartTracing(ctx context.Context, categories []string, opts ...cdputil.TraceOption) error
- func (c *Chrome) StopTracing(ctx context.Context) (*perfetto_proto.Trace, error)
- func (c *Chrome) TestAPIConn(ctx context.Context) (*TestConn, error)
- func (c *Chrome) User() string
- func (c *Chrome) VKEnabled() bool
- func (c *Chrome) WaitForOOBEConnection(ctx context.Context) (*Conn, error)
- func (c *Chrome) WaitForOOBEConnectionToBeDismissed(ctx context.Context) error
- func (c *Chrome) WaitForRMAConnection(ctx context.Context) (*Conn, error)
- type Conn
- type Creds
- type HasChrome
- type JSObject
- type Option
- func ARCDisabled() Option
- func ARCEnabled() Option
- func ARCSupported() Option
- func CrashNormalMode() Option
- func CustomLoginTimeout(timeout time.Duration) Option
- func DMSPolicy(url string) Option
- func DeferLogin() Option
- func DisableFeatures(features ...string) Option
- func DisablePolicyKeyVerification() Option
- func DontSkipOOBEAfterLogin() Option
- func DontWaitForCryptohome() Option
- func EnableFeatures(features ...string) Option
- func EnableFilesAppSWA() Option
- func EnableLoginVerboseLogs() Option
- func EnableRestoreTabs() Option
- func EnableWebAppInstall() Option
- func EncryptedReportingAddr(url string) Option
- func EphemeralUser() Option
- func ExtraArgs(args ...string) Option
- func FakeEnterpriseEnroll(creds Creds) Option
- func FakeLogin(creds Creds) Option
- func ForceLaunchBrowser() Option
- func GAIAEnterpriseEnroll(creds Creds) Option
- func GAIALogin(creds Creds) Option
- func GAIALoginPool(creds string) Option
- func GuestLogin() Option
- func HideCrashRestoreBubble() Option
- func HugePagesEnabled() Option
- func KeepEnrollment() Option
- func KeepState() Option
- func LacrosDisableFeatures(features ...string) Option
- func LacrosEnableFeatures(features ...string) Option
- func LacrosExtraArgs(args ...string) Option
- func LoadSigninProfileExtension(key string) Option
- func NoLogin() Option
- func ProdPolicy() Option
- func Region(region string) Option
- func RemoveNotification(remove bool) Option
- func RestrictARCCPU() Option
- func SkipForceOnlineSignInForTesting() Option
- func TryReuseSession() Option
- func UnpackedExtension(dir string) Option
- func UseSandboxGaia() Option
- func VKEnabled() Option
- type OptionsCallback
- type Target
- type TargetID
- type TargetMatcher
- type TestConn
Constants ¶
const ( // LoginTimeout is the maximum amount of time that Chrome is expected to take to perform login. // Tests that call New with the default fake login mode should declare a timeout that's at least this long. // Tast waits for login by checking when all partitions are mounted and ready. For normal login this takes up most of the time. LoginTimeout = cryptohome.WaitForUserTimeout // GAIALoginTimeout is the maximum amount of the time that Chrome is expected // to take to perform actual gaia login. As far as I checked a few samples of // actual test runs, most of successful login finishes within ~40secs. Use // 40*3=120 seconds for the safety. GAIALoginTimeout = LoginTimeout + 40*time.Second // GAIALoginChildTimeout is the maximum amount of time that Chrome is expected // to take to perform actual gaia login for a child account. Use double the // regular GAIALoginTimeout because we check credentials for two users (child and parent). GAIALoginChildTimeout = 2 * GAIALoginTimeout // ManagedUserLoginTimeout is the maximum amount of time that Chrome is expected to take to perform login for a managed user. // Tests that call New with the default fake login mode and a managed user should declare a timeout that's at least this long. // TODO(crbug.com/1199705): Find a better value or go back to LoginTimeout. ManagedUserLoginTimeout = LoginTimeout + 30*time.Second // EnrollmentAndLoginTimeout is the maximum amount of time that Chrome is expected to take to perform both enrollment and login. // Tests that call New with both enrollment and the default fake login mode should declare a timeout that's at least this long. // TODO(crbug.com/1199705): Find a better value. EnrollmentAndLoginTimeout = LoginTimeout + 1*time.Minute // TestExtensionID is an extension ID of the autotest extension. It // corresponds to testExtensionKey. TestExtensionID = extension.TestExtensionID // BlankURL is the URL corresponding to the about:blank page. BlankURL = "about:blank" // NewTabURL is the URL corresponding to the chrome://newtab/ page. NewTabURL = "chrome://newtab/" )
const ( // DefaultUser contains the email address used to log into Chrome when authentication credentials are not supplied. DefaultUser = config.DefaultUser // DefaultPass contains the password we use to log into the DefaultUser account. DefaultPass = config.DefaultPass )
const BinTestDir = "/usr/local/libexec/chrome-binary-tests"
BinTestDir is the directory containing Chrome's binary tests.
const ResetTimeout = 15 * time.Second
ResetTimeout is the timeout durection to trying reset of the current precondition.
Variables ¶
This section is empty.
Functions ¶
func AddTastLibrary ¶
AddTastLibrary introduces tast library into the page for the given conn. This introduces a variable named "tast" to its scope, and it is the caller's responsibility to avoid the conflict.
func ComputeExtensionID ¶
ComputeExtensionID computes the 32-character ID that Chrome will use for an unpacked extension in dir. The extension's manifest file must contain the "key" field. Use the following command to generate a new key:
openssl genrsa 2048 | openssl rsa -pubout -outform der | openssl base64 -A
func CurrentLogFile ¶
CurrentLogFile returns the real path name of the current run of Chrome at that time.
func DeprecatedPrepareExtensions ¶
DeprecatedPrepareExtensions prepares test extensions and returns extension directory paths.
DEPRECATED: Do not call this function. It's available only for compatibility with old code.
func ExtensionBackgroundPageURL ¶
ExtensionBackgroundPageURL returns the URL to the background page for the extension with the supplied ID.
func Lock ¶
func Lock()
Lock prevents from New or Chrome.Close from being called until Unlock is called. It can only be called by preconditions and is idempotent.
func LoggedIn ¶
func LoggedIn() testing.Precondition
LoggedIn returns a precondition that Chrome is already logged in when a test is run.
When adding a test, the testing.Test.Pre field may be set to the value returned by this function. Later, in the main test function, the value returned by testing.State.PreValue may be converted to an already-logged-in *chrome.Chrome:
func DoSomething(ctx context.Context, s *testing.State) { cr := s.PreValue().(*chrome.Chrome) conn, err := cr.NewConn(ctx, "http://www.example.org/") ... }
When using this precondition, tests cannot call New. The Chrome instance is also shared and cannot be closed by tests.
func LoggedInDisableSync ¶
func LoggedInDisableSync() testing.Precondition
LoggedInDisableSync is the same as LoggedIn with --disable-sync flag. When completing a fake user login apps aren't synced, see crbug.com/1154486
func NewLoggedInFixture ¶
func NewLoggedInFixture(fOpt OptionsCallback) testing.FixtureImpl
NewLoggedInFixture returns a FixtureImpl with a OptionsCallback function to provide Chrome options.
func NewPrecondition ¶
func NewPrecondition(suffix string, opts ...Option) testing.Precondition
NewPrecondition creates a new precondition that can be shared by tests that require an already-started Chrome object that was created with opts. suffix is appended to precondition's name.
func PrepareForRestart ¶
func PrepareForRestart() error
PrepareForRestart prepares for Chrome restart.
This function removes a debugging port file for a current Chrome process. By calling this function before purposefully restarting Chrome, you can reliably connect to a new Chrome process without accidentally connecting to an old Chrome process by a race condition.
func SaveTraceToFile ¶
SaveTraceToFile marshals the given trace into a binary protobuf and saves it to a gzip archive at the specified path.
Types ¶
type Chrome ¶
type Chrome struct {
// contains filtered or unexported fields
}
Chrome interacts with the currently-running Chrome instance via the Chrome DevTools protocol (https://chromedevtools.github.io/devtools-protocol/).
func New ¶
New restarts the ui job, tells Chrome to enable testing, and (by default) logs in. The NoLogin option can be passed to avoid logging in.
func (*Chrome) Close ¶
Close disconnects from Chrome and cleans up standard extensions. To avoid delays between tests, the ui job (and by extension, Chrome) is not restarted, so the current user (if any) remains logged in.
func (*Chrome) CloseTarget ¶
CloseTarget closes the target identified by the given id.
func (*Chrome) ContinueLogin ¶
ContinueLogin continues login deferred by DeferLogin option. It is an error to call this method when DeferLogin option was not passed to New.
func (*Chrome) DebugAddrPort ¶
DebugAddrPort returns the addr:port at which Chrome is listening for DevTools connections, e.g. "127.0.0.1:38725". This port should not be accessed from outside of this package, but it is exposed so that the port's owner can be easily identified.
func (*Chrome) DeprecatedExtDirs ¶
DeprecatedExtDirs returns the directories holding the test extensions. For reused Chrome session, deprecatedExtDirs is not set and this method will return nil.
DEPRECATED: This method does not handle sign-in profile extensions correctly.
func (*Chrome) FindTargets ¶
FindTargets returns the info about Targets, which satisfies the given cond condition.
func (*Chrome) IsTargetAvailable ¶
IsTargetAvailable checks if there is any matched target.
func (*Chrome) LacrosExtraArgs ¶
LacrosExtraArgs returns the extra arguments that should be added to the Lacros command line.
func (*Chrome) LogFilename ¶
LogFilename returns the real path of the log file for the Chrome.
func (*Chrome) NewConn ¶
func (c *Chrome) NewConn(ctx context.Context, url string, opts ...cdputil.CreateTargetOption) (*Conn, error)
NewConn creates a new Chrome renderer and returns a connection to it. If url is empty, an empty page (about:blank) is opened. Otherwise, the page from the specified URL is opened. You can assume that the page loading has been finished when this function returns.
func (*Chrome) NewConnForTarget ¶
NewConnForTarget iterates through all available targets and returns a connection to the first one that is matched by tm. It polls until the target is found or ctx's deadline expires. An error is returned if no target is found, tm matches multiple targets, or the connection cannot be established.
f := func(t *Target) bool { return t.URL == "http://example.net/" } conn, err := cr.NewConnForTarget(ctx, f)
func (*Chrome) NormalizedUser ¶
NormalizedUser returns the normalized (lowercase and striping '.' characters) username that was used to log in to Chrome.
func (*Chrome) Reconnect ¶
Reconnect reconnects to the current browser session.
WARNING: You cannot use this method to recover from Chrome crashes you don't have full control of. Read on to see why.
Call this method when you know you have to re-establish a connection to the browser session, e.g. after suspend/resume. After the session is reconnected, all existing connections associated with this chrome.Chrome instance also needs to be re-established. For example, you should call chrome.TestAPIConn(), chrome.NewConn(), or chrome.NewConnForTarget() to get the new connections for your test.
If Chrome browser process restarts (e.g. for crash), its devtools port can change, so you cannot simply use this method to reliably reconnect to the new Chrome process. If your test intentionally crashes Chrome, call PrepareForRestart in advance so that Reconnect doesn't attempt to connect to an old port.
func (*Chrome) ResetState ¶
ResetState attempts to reset Chrome's state (e.g. by closing all pages). Tests typically do not need to call this; it is exposed primarily for other packages.
func (*Chrome) SigninProfileTestAPIConn ¶
SigninProfileTestAPIConn is the same as TestAPIConn, but for the signin profile test extension.
func (*Chrome) StartSystemTracing ¶
StartSystemTracing starts trace events collection from the system tracing service using the marshaled binary protobuf trace config. Note: StopTracing should be called even if StartTracing returns an error. Sometimes, the request to start tracing reaches the browser process, but there is a timeout while waiting for the reply.
func (*Chrome) StartTracing ¶
func (c *Chrome) StartTracing(ctx context.Context, categories []string, opts ...cdputil.TraceOption) error
StartTracing starts trace events collection for the selected categories. Android categories must be prefixed with "disabled-by-default-android ", e.g. for the gfx category, use "disabled-by-default-android gfx", including the space. Note: StopTracing should be called even if StartTracing returns an error. Sometimes, the request to start tracing reaches the browser process, but there is a timeout while waiting for the reply.
func (*Chrome) StopTracing ¶
StopTracing stops trace collection and returns the collected trace events.
func (*Chrome) TestAPIConn ¶
TestAPIConn returns a shared connection to the test API extension's background page (which can be used to access various APIs). The connection is lazily created, and this function will block until the extension is loaded or ctx's deadline is reached. The caller should not close the returned connection; it will be closed automatically by Close.
func (*Chrome) User ¶
User returns the username that was used to log in to Chrome. Note that in almost all cases you actually want NormalizedUser below.
func (*Chrome) WaitForOOBEConnection ¶
WaitForOOBEConnection waits for that the OOBE page is shown, then returns a connection to the page. The caller must close the returned connection.
func (*Chrome) WaitForOOBEConnectionToBeDismissed ¶
WaitForOOBEConnectionToBeDismissed waits for that the OOBE page to be dismissed.
type Conn ¶
Conn represents a connection to a web content view, e.g. a tab.
func DeprecatedNewConn ¶
func DeprecatedNewConn(ctx context.Context, s *cdputil.Session, id target.ID, la *jslog.Aggregator, pageURL string, chromeErr func(error) error) (c *Conn, retErr error)
DeprecatedNewConn starts a new session using sm for communicating with the supplied target. pageURL is only used when logging JavaScript console messages via lm.
DEPRECATED: Do not call this function. It's available only for compatibility with old code.
type Creds ¶
Creds contains credentials to log into a Chrome user session.
func PickRandomCreds ¶
PickRandomCreds randomly picks one credentials from the passed string. For the format details refer to the GAIALoginPool option documentation.
type HasChrome ¶
type HasChrome interface {
Chrome() *Chrome
}
HasChrome is an interface for fixture values that contain a Chrome instance. It allows retrieval of the underlying Chrome object.
type JSObject ¶
JSObject is a reference to a JavaScript object. JSObjects must be released or they will stop the JavaScript GC from freeing the memory they reference.
type Option ¶
Option is a self-referential function can be used to configure Chrome. See https://commandcenter.blogspot.com.au/2014/01/self-referential-functions-and-design.html for details about this pattern.
func ARCDisabled ¶
func ARCDisabled() Option
ARCDisabled returns an Option that can be passed to New to disable ARC.
func ARCEnabled ¶
func ARCEnabled() Option
ARCEnabled returns an Option that can be passed to New to enable ARC (without Play Store) for the user session with mock GAIA account.
func ARCSupported ¶
func ARCSupported() Option
ARCSupported returns an Option that can be passed to New to allow to enable ARC with Play Store gaia opt-in for the user session with real GAIA account. In this case ARC is not launched by default and is required to be launched by user policy or from UI.
func CrashNormalMode ¶
func CrashNormalMode() Option
CrashNormalMode tells the crash handling system to act like it would on a real device. If this option is not used, the Chrome instances created by this package will skip calling crash_reporter and write any dumps into /home/chronos/crash directly from breakpad. This option restores the normal behavior of calling crash_reporter.
func CustomLoginTimeout ¶
CustomLoginTimeout allows setting a custom timeout for login.
func DMSPolicy ¶
DMSPolicy returns an option that can be passed to New to tell the device to fetch policies from the policy server at the given url. By default policies are not fetched.
func DeferLogin ¶
func DeferLogin() Option
DeferLogin returns an option that instructs chrome.New to return before logging into a session. After successful return of chrome.New, you can call ContinueLogin to continue login.
func DisableFeatures ¶
DisableFeatures returns an Option that can be passed to New to disable specific features in Chrome.
func DisablePolicyKeyVerification ¶
func DisablePolicyKeyVerification() Option
DisablePolicyKeyVerification returns an Option that disables the policy key verification in Chrome.
func DontSkipOOBEAfterLogin ¶
func DontSkipOOBEAfterLogin() Option
DontSkipOOBEAfterLogin returns an Option that can be passed to stay in OOBE after user login.
func DontWaitForCryptohome ¶
func DontWaitForCryptohome() Option
DontWaitForCryptohome returns an Option that can be passed to skip cryptohome mount wait after user login.
func EnableFeatures ¶
EnableFeatures returns an Option that can be passed to New to enable specific features in Chrome.
func EnableFilesAppSWA ¶
func EnableFilesAppSWA() Option
EnableFilesAppSWA returns an Option that enables the Files app SWA variant. Files Chrome app variant is the default enabled version. TODO(b/207576612): Remove this config item once Files app SWA is fully launched.
func EnableLoginVerboseLogs ¶
func EnableLoginVerboseLogs() Option
EnableLoginVerboseLogs returns an Option that enables verbose logging for some login-related files.
func EnableRestoreTabs ¶
func EnableRestoreTabs() Option
EnableRestoreTabs returns an Option that can be passed to New which controls whether to let Chrome use CGroups to limit the CPU time of ARC when in the background. Most ARC-related tests should not pass this option.
func EnableWebAppInstall ¶
func EnableWebAppInstall() Option
EnableWebAppInstall returns an Option that can be passed to enable web app auto-install after user login. By default web app auto-install is disabled to reduce network traffic in test environment. See https://crbug.com/1076660 for more details.
func EncryptedReportingAddr ¶
EncryptedReportingAddr returns an option that can be passed to New to tell the device to report Chrome real-time events to the Encrypted Reporting Server at the given url. By default encrypted real-time event reporting is not enabled, and when enabled, Chrome reports event to the Prod Reporting Server at chromereporting-pa.googleapis.com.
func EphemeralUser ¶
func EphemeralUser() Option
EphemeralUser returns an Option that can be passed to New to validate user mount as ephemeral, which is permanent by default.
func ExtraArgs ¶
ExtraArgs returns an Option that can be passed to New to append additional arguments to Chrome's command line.
func FakeEnterpriseEnroll ¶
FakeEnterpriseEnroll returns an Option that can be passed to New to enable Enterprise Enrollment with a fake local device management server before login.
func FakeLogin ¶
FakeLogin returns an Option that can be passed to New to perform a fake login, which skips credential verifications with GAIA servers.
When no login option is specified, the default is to perform a fake login with the default credentials (DefaultUser, DefaultPass). Thus you rarely need to specify this option. An example use case is to work with two or more fake accounts.
func ForceLaunchBrowser ¶
func ForceLaunchBrowser() Option
ForceLaunchBrowser returns an Option that forces FullRestoreService to launch browser. ForceLaunchBrowser option appends "--force-launch-browser" to chrome initialization.
func GAIAEnterpriseEnroll ¶
GAIAEnterpriseEnroll returns an Option that can be passed to New to enable Enterprise Enrollment before login.
func GAIALogin ¶
GAIALogin returns an Option that can be passed to New to perform a real GAIA-based login rather than the default fake login.
func GAIALoginPool ¶
GAIALoginPool returns an Option that can be passed to New to perform a real GAIA-based login with a pool of GAIA account credentials.
creds is a string containing multiple credentials separated by newlines:
user1:pass1 user2:pass2 user3:pass3 ...
This option randomly picks one credentials. A chosen one is written to logs in chrome.New, as well as available via Chrome.Creds.
func GuestLogin ¶
func GuestLogin() Option
GuestLogin returns an Option that can be passed to New to log in as guest user.
func HideCrashRestoreBubble ¶
func HideCrashRestoreBubble() Option
HideCrashRestoreBubble returns an Option that can be passed to New to make Chrome to to skip "Chrome did not shut down correctly" bubble
func HugePagesEnabled ¶
func HugePagesEnabled() Option
HugePagesEnabled returns an Option that can be passed to New to enable huge pages within a session's ARCVM instance. Has no effect on boards running Android P or if ARCEnabled is not also passed to New.
func KeepEnrollment ¶
func KeepEnrollment() Option
KeepEnrollment returns an Option that can be passed to New to ensure enrollment is not wiped and Chrome is ready for device policy testing.
func KeepState ¶
func KeepState() Option
KeepState returns an Option that can be passed to New to preserve the state such as files under /home/chronos and the user's existing cryptohome (if any) instead of wiping them before logging in.
func LacrosDisableFeatures ¶
LacrosDisableFeatures returns an Option that can be passed to New to disable specific features in Lacros Chrome.
func LacrosEnableFeatures ¶
LacrosEnableFeatures returns an Option that can be passed to New to enable specific features in Lacros Chrome.
func LacrosExtraArgs ¶
LacrosExtraArgs returns an Option that can be passed to New to append additional arguments to Lacros Chrome's command line.
func LoadSigninProfileExtension ¶
LoadSigninProfileExtension loads the test extension which is allowed to run in the signin profile context. Private manifest key should be passed (see ui.SigninProfileExtension for details).
func NoLogin ¶
func NoLogin() Option
NoLogin returns an Option that can be passed to New to avoid logging in. Chrome is still restarted with testing-friendly behavior.
func ProdPolicy ¶
func ProdPolicy() Option
ProdPolicy returns an option that can be passed to New to let the device do a policy fetch upon login. By default, policies are not fetched. The default Device Management service is used.
func Region ¶
Region returns an Option that can be passed to New to set the region deciding the locale used in the OOBE screen and the user sessions. region is a two-letter code such as "us", "fr", or "ja".
func RemoveNotification ¶
RemoveNotification returns an Option that can be passed to New to make Chrome to remove or keep the notifications after login.
func RestrictARCCPU ¶
func RestrictARCCPU() Option
RestrictARCCPU returns an Option that can be passed to New which controls whether to let Chrome use CGroups to limit the CPU time of ARC when in the background. Most ARC-related tests should not pass this option.
func SkipForceOnlineSignInForTesting ¶
func SkipForceOnlineSignInForTesting() Option
SkipForceOnlineSignInForTesting disables online sign-in enforcement in tast tests, which allows to run Chrome OS login in a loop in a stable way.
func TryReuseSession ¶
func TryReuseSession() Option
TryReuseSession returns an Option that can be passed to New to make Chrome to reuse the existing login session from same user. Session will be re-used when Chrome configurations are compatible between two sessions. For noLogin mode and deferLogin option, session will not be re-used. If the existing session cannot be reused, a new Chrome session will be restarted.
func UnpackedExtension ¶
UnpackedExtension returns an Option that can be passed to New to make Chrome load an unpacked extension in the supplied directory. The specified directory is copied to a different location before loading, so modifications to the directory do not take effect after starting Chrome.
func UseSandboxGaia ¶
func UseSandboxGaia() Option
UseSandboxGaia returns an Option that can be passed to New to instruct use the sandbox instance of Gaia. NOTE: Only works with the Gaia-based login options.
func VKEnabled ¶
func VKEnabled() Option
VKEnabled returns an Option that force enable virtual keyboard. VKEnabled option appends "--enable-virtual-keyboard" to chrome initialization and also checks VK connection after user login. Note: This option can not be used by ARC tests as some boards block VK background from presence.
type OptionsCallback ¶
OptionsCallback is the function used to set up the fixture by returning Chrome options.
type TargetMatcher ¶
type TargetMatcher = driver.TargetMatcher
TargetMatcher is a caller-provided function that matches targets with specific characteristics.
func MatchAllPages ¶
func MatchAllPages() TargetMatcher
MatchAllPages returns a TargetMatcher that matches every target that is a page.
func MatchTargetID ¶
func MatchTargetID(id TargetID) TargetMatcher
MatchTargetID returns a TargetMatcher that matches targets with the supplied ID.
func MatchTargetURL ¶
func MatchTargetURL(url string) TargetMatcher
MatchTargetURL returns a TargetMatcher that matches targets with the supplied URL.
func MatchTargetURLPrefix ¶
func MatchTargetURLPrefix(prefix string) TargetMatcher
MatchTargetURLPrefix returns a TargetMatcher that matches targets whose URL starts with the supplied prefix.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ash implements a library used for communication with Chrome Ash.
|
Package ash implements a library used for communication with Chrome Ash. |
ashproc
Package ashproc provides utilities to find ash Chrome (a.k.a.
|
Package ashproc provides utilities to find ash Chrome (a.k.a. |
Package browser implements a layer of abstraction over Ash and Lacros Chrome instances.
|
Package browser implements a layer of abstraction over Ash and Lacros Chrome instances. |
browserfixt
Package browserfixt provides a function for obtaining a Browser instance for a given tast fixture and browser type.
|
Package browserfixt provides a function for obtaining a Browser instance for a given tast fixture and browser type. |
Package chromeproc provides utilities to find Chrome processes.
|
Package chromeproc provides utilities to find Chrome processes. |
Package crossdevice is for controlling Cross Device features involving a paired Android phone and Chromebook.
|
Package crossdevice is for controlling Cross Device features involving a paired Android phone and Chromebook. |
phonehub
Package phonehub is for controlling Chrome OS Phone Hub functionality.
|
Package phonehub is for controlling Chrome OS Phone Hub functionality. |
smartlock
Package smartlock is for controlling ChromeOS Smart Lock functionality.
|
Package smartlock is for controlling ChromeOS Smart Lock functionality. |
Package display wraps the chrome.system.display API.
|
Package display wraps the chrome.system.display API. |
Package familylink is used for writing Family Link tests.
|
Package familylink is used for writing Family Link tests. |
Package ime provides Go bindings of Chrome APIs to control IMEs.
|
Package ime provides Go bindings of Chrome APIs to control IMEs. |
internal
|
|
browserwatcher
Package browserwatcher provides a utility to monitor browser process for crashes.
|
Package browserwatcher provides a utility to monitor browser process for crashes. |
cdputil
Package cdputil provides utilities to communicate with Chrome via Chrome DevTools Protocol.
|
Package cdputil provides utilities to communicate with Chrome via Chrome DevTools Protocol. |
chromeproc
Package chromeproc provides utilities to find Chrome processes.
|
Package chromeproc provides utilities to find Chrome processes. |
config
Package config defines a struct to hold configurations of chrome.Chrome.
|
Package config defines a struct to hold configurations of chrome.Chrome. |
driver
Package driver provides components to interact with a locally-running Chrome process in various ways, including DevTools protocol and /proc monitoring.
|
Package driver provides components to interact with a locally-running Chrome process in various ways, including DevTools protocol and /proc monitoring. |
extension
Package extension implements logic to prepare extensions to be installed to Chrome for testing.
|
Package extension implements logic to prepare extensions to be installed to Chrome for testing. |
login
Package login implements logging in to a Chrome user session.
|
Package login implements logging in to a Chrome user session. |
setup
Package setup implements setting up Chrome for testing.
|
Package setup implements setting up Chrome for testing. |
Package jslog provides JavaScript console logger for chrome package.
|
Package jslog provides JavaScript console logger for chrome package. |
Package lacros implements a library used to setup and launch lacros-chrome.
|
Package lacros implements a library used to setup and launch lacros-chrome. |
lacrosfaillog
Package lacrosfaillog provides a way to record logs on test failure.
|
Package lacrosfaillog provides a way to record logs on test failure. |
lacrosfixt
Package lacrosfixt contains tools for working with lacros fixtures.
|
Package lacrosfixt contains tools for working with lacros fixtures. |
lacrosperf
Package lacrosperf implements a library used for utilities for running perf tests with lacros.
|
Package lacrosperf implements a library used for utilities for running perf tests with lacros. |
lacrosproc
Package lacrosproc provides utilities to find lacros Chrome processes.
|
Package lacrosproc provides utilities to find lacros Chrome processes. |
Package localstate provides utilities for accessing the browser's Local State file.
|
Package localstate provides utilities for accessing the browser's Local State file. |
Package mediasession contains common utilities to help writing media session tests.
|
Package mediasession contains common utilities to help writing media session tests. |
Package metrics queries metrics collected by Chrome.
|
Package metrics queries metrics collected by Chrome. |
Package mtp implements the fixture for setting up the connected android device.
|
Package mtp implements the fixture for setting up the connected android device. |
Package nearbyshare is used to control Nearby Share functionality.
|
Package nearbyshare is used to control Nearby Share functionality. |
nearbyfixture
Package nearbyfixture contains fixtures for Nearby Share tests.
|
Package nearbyfixture contains fixtures for Nearby Share tests. |
nearbysnippet
Package nearbysnippet is for interacting with the Nearby Snippet which provides automated control of Android Nearby share.
|
Package nearbysnippet is for interacting with the Nearby Snippet which provides automated control of Android Nearby share. |
nearbytestutils
Package nearbytestutils provides utility functions for Nearby Share tests.
|
Package nearbytestutils provides utility functions for Nearby Share tests. |
Package settings implements a library used for communication with Chrome settings.
|
Package settings implements a library used for communication with Chrome settings. |
Package systemlogs calls autotestPrivate.writeSystemLogs and parses the results.
|
Package systemlogs calls autotestPrivate.writeSystemLogs and parses the results. |
Package uiauto enables automating with the ChromeOS UI through the chrome.automation API.
|
Package uiauto enables automating with the ChromeOS UI through the chrome.automation API. |
browser
Package browser allows interactions with browser window.
|
Package browser allows interactions with browser window. |
capturemode
Package capturemode contains helper methods to work with Capture Mode.
|
Package capturemode contains helper methods to work with Capture Mode. |
checked
Package checked describes tri-state values of a checkbox or radio button.
|
Package checked describes tri-state values of a checkbox or radio button. |
conndiag
Package conndiag provides tools and library calls to create and manage an instance of the Connectivity Diagnostics App.
|
Package conndiag provides tools and library calls to create and manage an instance of the Connectivity Diagnostics App. |
crd
Package crd provides utilities to set up Chrome Remote Desktop.
|
Package crd provides utilities to set up Chrome Remote Desktop. |
cws
Package cws provides a utility to install apps from the Chrome Web Store.
|
Package cws provides a utility to install apps from the Chrome Web Store. |
diagnosticsapp
Package diagnosticsapp contains drivers for controlling the ui of diagnostics SWA.
|
Package diagnosticsapp contains drivers for controlling the ui of diagnostics SWA. |
event
Package event describes the type of a chrome.automation AutomationEvent.
|
Package event describes the type of a chrome.automation AutomationEvent. |
faillog
Package faillog provides helper functions for dumping UI data on test failures.
|
Package faillog provides helper functions for dumping UI data on test failures. |
filesapp
Package filesapp supports controlling the Files App on Chrome OS.
|
Package filesapp supports controlling the Files App on Chrome OS. |
firmwareupdateapp
Package firmwareupdateapp contains drivers for controlling the ui of firmware update SWA.
|
Package firmwareupdateapp contains drivers for controlling the ui of firmware update SWA. |
holdingspace
Package holdingspace exports methods for interacting with holding space.
|
Package holdingspace exports methods for interacting with holding space. |
imesettings
Package imesettings supports managing input methods in OS settings.
|
Package imesettings supports managing input methods in OS settings. |
launcher
Package launcher is used for controlling the launcher directly through the UI.
|
Package launcher is used for controlling the launcher directly through the UI. |
lockscreen
Package lockscreen is used to get information about the lock screen directly through the UI.
|
Package lockscreen is used to get information about the lock screen directly through the UI. |
mouse
Package mouse injects mouse events via Chrome autotest private API.
|
Package mouse injects mouse events via Chrome autotest private API. |
nodewith
Package nodewith is used to generate queries to find chrome.automation nodes.
|
Package nodewith is used to generate queries to find chrome.automation nodes. |
ossettings
Package ossettings supports controlling the Settings App on Chrome OS.
|
Package ossettings supports controlling the Settings App on Chrome OS. |
pointer
Package pointer provides utility interfaces to handle pointing devices (i.e.
|
Package pointer provides utility interfaces to handle pointing devices (i.e. |
printmanagementapp
Package printmanagementapp contains common functions used in the app.
|
Package printmanagementapp contains common functions used in the app. |
printpreview
Package printpreview provides support for controlling Chrome print preview directly through the UI.
|
Package printpreview provides support for controlling Chrome print preview directly through the UI. |
quicksettings
Package quicksettings is for controlling the Quick Settings directly from the UI.
|
Package quicksettings is for controlling the Quick Settings directly from the UI. |
restriction
Package restriction describes the restriction state of a chrome.automation AutomationNode.
|
Package restriction describes the restriction state of a chrome.automation AutomationNode. |
role
Package role describes the purpose of a chrome.automation AutomationNode.
|
Package role describes the purpose of a chrome.automation AutomationNode. |
scanapp
Package scanapp supports controlling the Scan App on Chrome OS.
|
Package scanapp supports controlling the Scan App on Chrome OS. |
shimlessrmaapp
Package shimlessrmaapp contains drivers for controlling the ui of Shimless RMA SWA.
|
Package shimlessrmaapp contains drivers for controlling the ui of Shimless RMA SWA. |
state
Package state describes characteristics of a chrome.automation AutomationNode.
|
Package state describes characteristics of a chrome.automation AutomationNode. |
taskmanager
Package taskmanager contains functions related to the task manager.
|
Package taskmanager contains functions related to the task manager. |
touch
Package touch provides the uiauto actions to control the touchscreen.
|
Package touch provides the uiauto actions to control the touchscreen. |
trackpad
Package trackpad provides helper functions to simulate trackpad events.
|
Package trackpad provides helper functions to simulate trackpad events. |
vkb
Package vkb contains shared code to interact with the virtual keyboard.
|
Package vkb contains shared code to interact with the virtual keyboard. |
wmp
Package wmp contains utility functions for window management and performance.
|
Package wmp contains utility functions for window management and performance. |
Package useractions contains the definition of UserContext and UserAction.
|
Package useractions contains the definition of UserContext and UserAction. |
Package vmc provides utilities for the vmc command.
|
Package vmc provides utilities for the vmc command. |
Package webutil contains shared code for dealing with web content.
|
Package webutil contains shared code for dealing with web content. |