Documentation ¶
Overview ¶
Package ash implements a library used for communication with Chrome Ash.
Index ¶
- Constants
- Variables
- func ActivateAdjacentDesksToTargetIndex(ctx context.Context, tconn *chrome.TestConn, index int) error
- func ActivateDeskAtIndex(ctx context.Context, tconn *chrome.TestConn, index int) error
- func AppRunning(ctx context.Context, tconn *chrome.TestConn, appID string) (bool, error)
- func AppShown(ctx context.Context, tconn *chrome.TestConn, appID string) (bool, error)
- func AutoHide(ctx context.Context, tconn *chrome.TestConn, displayID string) error
- func BrowserTitleMatch(bt browser.Type, titlePrefix string) func(w *Window) bool
- func BrowserTypeMatch(bt browser.Type) func(w *Window) bool
- func ChromeAppInstalled(ctx context.Context, tconn *chrome.TestConn, appID string) (bool, error)
- func CleanUpDesks(ctx context.Context, tconn *chrome.TestConn) error
- func ClipboardTextData(ctx context.Context, tconn *chrome.TestConn) (string, error)
- func CloseAllWindows(ctx context.Context, tconn *chrome.TestConn) error
- func CloseNotifications(ctx context.Context, tconn *chrome.TestConn) error
- func CountVisibleWindows(ctx context.Context, tconn *chrome.TestConn) (int, error)
- func CreateNewDesk(ctx context.Context, tconn *chrome.TestConn) error
- func CreateWindows(ctx context.Context, tconn *chrome.TestConn, cs ConnSource, url string, n int) error
- func DragToShowHomescreen(ctx context.Context, width, height input.TouchCoord, ...) error
- func DragToShowOverview(ctx context.Context, tsw *input.TouchscreenEventWriter, ...) error
- func EnsureTabletModeEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) (func(ctx context.Context) error, error)
- func EnterShelfOverflow(ctx context.Context, tconn *chrome.TestConn) error
- func FindDeskMiniViews(ctx context.Context, ac *uiauto.Context) ([]uiauto.NodeInfo, error)
- func FindDeskTemplates(ctx context.Context, ac *uiauto.Context) ([]uiauto.NodeInfo, error)
- func ForEachWindow(ctx context.Context, tconn *chrome.TestConn, f func(window *Window) error) error
- func GeneratePrepareFakeAppsOptions(baseDir string, numFakeApps int) ([]chrome.Option, error)
- func GeneratePrepareFakeAppsWithIconDataOptions(baseDir string, names []string, iconData [][]byte) ([]chrome.Option, error)
- func GeneratePrepareFakeAppsWithNamesOptions(baseDir string, names []string) ([]chrome.Option, error)
- func GetDefaultPinnedAppIDs(ctx context.Context, tconn *chrome.TestConn) ([]string, error)
- func GetPinnedAppIds(ctx context.Context, tconn *chrome.TestConn) ([]string, error)
- func LaunchAppFromShelf(ctx context.Context, tconn *chrome.TestConn, appName, appID string) error
- func PinAndUnpinApps(ctx context.Context, tconn *chrome.TestConn, ...) error
- func PinApp(ctx context.Context, tconn *chrome.TestConn, appID string) error
- func PinApps(ctx context.Context, tconn *chrome.TestConn, appIDs []string) error
- func PrepareDefaultFakeApps(baseDir string, appNames []string, hasIcon bool) ([]string, error)
- func PrimaryDisplayMode(ctx context.Context, tconn *chrome.TestConn) (*display.DisplayMode, error)
- func RemoveActiveDesk(ctx context.Context, tconn *chrome.TestConn) error
- func ResetShelfPinState(ctx context.Context, tconn *chrome.TestConn) (func(ctx context.Context) error, error)
- func RightClickApp(tconn *chrome.TestConn, appName string) uiauto.Action
- func ScrollShelfAndWaitUntilFinish(ctx context.Context, tconn *chrome.TestConn, buttonBounds coords.Rect, ...) error
- func SetClipboard(ctx context.Context, tconn *chrome.TestConn, data string) error
- func SetOverviewModeAndWait(ctx context.Context, tconn *chrome.TestConn, inOverview bool) error
- func SetShelfAlignment(ctx context.Context, tconn *chrome.TestConn, displayID string, ...) error
- func SetShelfBehavior(ctx context.Context, tconn *chrome.TestConn, displayID string, b ShelfBehavior) error
- func SetTabletModeEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) error
- func SetWindowBounds(ctx context.Context, tconn *chrome.TestConn, id int, b coords.Rect, ...) (coords.Rect, string, error)
- func SetWindowStateAndWait(ctx context.Context, tconn *chrome.TestConn, id int, ...) error
- func ShowHotseat(ctx context.Context, tconn *chrome.TestConn) error
- func ShowHotseatAction(tconn *chrome.TestConn) uiauto.Action
- func SwapWindowsInSplitView(ctx context.Context, tconn *chrome.TestConn) error
- func SwipeDownHotseatAndWaitForCompletion(ctx context.Context, tconn *chrome.TestConn, stw *input.SingleTouchEventWriter, ...) error
- func SwipeUpHotseatAndWaitForCompletion(ctx context.Context, tconn *chrome.TestConn, stw *input.SingleTouchEventWriter, ...) error
- func TabletModeEnabled(ctx context.Context, tconn *chrome.TestConn) (bool, error)
- func TriggerLauncherStateChange(ctx context.Context, tconn *chrome.TestConn, accel Accelerator) error
- func UnpinApps(ctx context.Context, tconn *chrome.TestConn, appIDs []string) error
- func UpdateAppPinFromHotseat(ctx context.Context, tconn *chrome.TestConn, appName string, pin bool) error
- func UpdateAppPinFromShelf(ctx context.Context, tconn *chrome.TestConn, appName string, pin bool) error
- func VerifyShelfIconIndices(ctx context.Context, tconn *chrome.TestConn, expectedApps []string) error
- func WaitForARCAppWindowState(ctx context.Context, tconn *chrome.TestConn, pkgName string, ...) error
- func WaitForARCAppWindowStateWithPollOptions(ctx context.Context, tconn *chrome.TestConn, pkgName string, ...) error
- func WaitForApp(ctx context.Context, tconn *chrome.TestConn, appID string, ...) error
- func WaitForAppClosed(ctx context.Context, tconn *chrome.TestConn, appID string) error
- func WaitForAppCondition(ctx context.Context, tconn *chrome.TestConn, appID string, ...) error
- func WaitForChromeAppInstalled(ctx context.Context, tconn *chrome.TestConn, appID string, ...) error
- func WaitForCondition(ctx context.Context, tconn *chrome.TestConn, ...) error
- func WaitForFullScreen(ctx context.Context, tconn *chrome.TestConn) error
- func WaitForHidden(ctx context.Context, tconn *chrome.TestConn, pkgName string) error
- func WaitForHotseatAnimatingToIdealState(ctx context.Context, tconn *chrome.TestConn, state HotseatStateType) error
- func WaitForHotseatAnimationToFinish(ctx context.Context, tconn *chrome.TestConn) error
- func WaitForHotseatToUpdateAutoHideState(ctx context.Context, tconn *chrome.TestConn, autoHideState bool) error
- func WaitForLauncherState(ctx context.Context, tconn *chrome.TestConn, state LauncherState) error
- func WaitForOverviewState(ctx context.Context, tconn *chrome.TestConn, state OverviewState, ...) error
- func WaitForShelf(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration) error
- func WaitForStableShelfBounds(ctx context.Context, tconn *chrome.TestConn) error
- func WaitForVisible(ctx context.Context, tconn *chrome.TestConn, pkgName string) error
- func WaitIDContains(idContains string) waitPredicate
- func WaitMessageContains(messageContains string) waitPredicate
- func WaitTitle(title string) waitPredicate
- func WaitTitleContains(titleContains string) waitPredicate
- func WaitUntilNotificationGone(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration, ...) error
- func WaitUntilShelfIconAnimationFinish(ctx context.Context, tconn *chrome.TestConn) error
- func WaitWindowFinishAnimating(ctx context.Context, tconn *chrome.TestConn, windowID int) error
- type Accelerator
- type AppInstallSource
- type AppReadiness
- type AppType
- type CaptionButtonStatus
- type ChromeApp
- type ConnSource
- type DevtoolsConn
- type FrameMode
- type HotseatInfoClass
- type HotseatStateType
- type HotseatSwipeDescriptor
- type LauncherState
- type Notification
- type OverviewInfo
- type OverviewState
- type PortWaitOption
- type ScrollableShelfInfoClass
- type Session
- type ShelfAlignment
- type ShelfBehavior
- type ShelfIconPinUpdateParam
- type ShelfInfo
- type ShelfItem
- type ShelfItemStatus
- type ShelfItemType
- type ShelfState
- type SnapPosition
- type WMEventType
- type Window
- func BringWindowToForeground(ctx context.Context, tconn *chrome.TestConn, windowTitle string) (*Window, error)
- func DraggedWindowInOverview(ctx context.Context, tconn *chrome.TestConn) (*Window, error)
- func FindAllWindows(ctx context.Context, tconn *chrome.TestConn, predicate func(*Window) bool) (matchingWindows []*Window, err error)
- func FindFirstWindowInOverview(ctx context.Context, tconn *chrome.TestConn) (*Window, error)
- func FindOnlyWindow(ctx context.Context, tconn *chrome.TestConn, predicate func(*Window) bool) (*Window, error)
- func FindWindow(ctx context.Context, tconn *chrome.TestConn, predicate func(*Window) bool) (*Window, error)
- func GetARCAppWindowInfo(ctx context.Context, tconn *chrome.TestConn, pkgName string) (*Window, error)
- func GetARCGhostWindowInfo(ctx context.Context, tconn *chrome.TestConn, appID string) (*Window, error)
- func GetActiveWindow(ctx context.Context, tconn *chrome.TestConn) (*Window, error)
- func GetAllARCAppWindowsInfo(ctx context.Context, tconn *chrome.TestConn, pkgName string) ([]*Window, error)
- func GetAllWindows(ctx context.Context, tconn *chrome.TestConn) ([]*Window, error)
- func GetWindow(ctx context.Context, tconn *chrome.TestConn, windowID int) (*Window, error)
- func SnappedWindows(ctx context.Context, tconn *chrome.TestConn) ([]*Window, error)
- func WaitForAnyWindow(ctx context.Context, tconn *chrome.TestConn, p func(*Window) bool) (*Window, error)
- func WaitForAnyWindowWithTitle(ctx context.Context, tconn *chrome.TestConn, title string) (*Window, error)
- func WaitForAnyWindowWithoutTitle(ctx context.Context, tconn *chrome.TestConn, title string) (*Window, error)
- type WindowStateType
- func GetARCAppWindowState(ctx context.Context, tconn *chrome.TestConn, pkgName string) (WindowStateType, error)
- func GetAllARCAppWindowStates(ctx context.Context, tconn *chrome.TestConn, pkgName string) (windowStates []WindowStateType, err error)
- func SetARCAppWindowState(ctx context.Context, tconn *chrome.TestConn, pkgName string, et WMEventType) (WindowStateType, error)
- func SetARCAppWindowStateAndWait(ctx context.Context, tconn *chrome.TestConn, pkgName string, ...) (WindowStateType, error)
- func SetWindowState(ctx context.Context, tconn *chrome.TestConn, id int, et WMEventType, ...) (WindowStateType, error)
- type WindowType
Constants ¶
const ( // ShelfBehaviorAlwaysAutoHide represents always auto-hide. ShelfBehaviorAlwaysAutoHide ShelfBehavior = "always" //ShelfBehaviorNeverAutoHide represents never auto-hide, meaning that it is always visible. ShelfBehaviorNeverAutoHide = "never" // ShelfBehaviorHidden represents always hidden, used for debugging, since this state is not exposed to the user. ShelfBehaviorHidden = "hidden" // ShelfBehaviorInvalid represents an invalid state. ShelfBehaviorInvalid = "invalid" // ShelfIconClassName is the class name of the node of the apps on shelf. ShelfIconClassName = "ash/ShelfAppButton" )
As defined in ShelfAutoHideBehavior here: https://cs.chromium.org/chromium/src/ash/public/cpp/shelf_types.h
const ( ShelfAlignmentBottom ShelfAlignment = "Bottom" ShelfAlignmentLeft = "Left" ShelfAlignmentRight = "Right" ShelfAlignmentBottomLocked = "BottomLocked" ShelfAlignmentInvalid = "Invalid" )
As defined in ShelfAlignment here: https://cs.chromium.org/chromium/src/ash/public/cpp/shelf_types.h
const AppListBubbleClassName = "AppListBubbleView"
AppListBubbleClassName is the automation API class name of the bubble launcher.
const DebuggingPortPath = cdputil.DebuggingPortPath
DebuggingPortPath is a file where Chrome writes debugging port.
Variables ¶
var ( AccelSearch = Accelerator{KeyCode: "search", Shift: false, Control: false, Alt: false, Search: false} AccelShiftSearch = Accelerator{KeyCode: "search", Shift: true, Control: false, Alt: false, Search: false} )
Accelerator key used to trigger launcher state change.
var ErrMultipleWindowsFound = errors.New("found multiple matching windows")
ErrMultipleWindowsFound is returned when multiple windows were returned when only one was requested.
var ErrWindowNotFound = errors.New("failed to find window")
ErrWindowNotFound is returned when window is failed to be found.
Functions ¶
func ActivateAdjacentDesksToTargetIndex ¶
func ActivateAdjacentDesksToTargetIndex(ctx context.Context, tconn *chrome.TestConn, index int) error
ActivateAdjacentDesksToTargetIndex requests Ash to keep activating the adjacent Virtual Desk until the one at the given index is reached. It waits for the chain of desk-switch animations to complete. This call will fail if index is invalid, or it is the index of the already active desk.
func ActivateDeskAtIndex ¶
ActivateDeskAtIndex requests Ash to activate the Virtual Desk at the given index. It waits for the desk-switch animation to complete. This call will fail if index is invalid, or its the index of the already active desk.
func AppRunning ¶
AppRunning checks if an app specified by appID is already running.
func BrowserTitleMatch ¶
BrowserTitleMatch returns a func to check whether a window is a browser window of matching type and title.
func BrowserTypeMatch ¶
BrowserTypeMatch returns a func to check whether a window is a browser window of the given type.
func ChromeAppInstalled ¶
ChromeAppInstalled checks if an app specified by appID is installed.
func CleanUpDesks ¶
CleanUpDesks removes all but one desk.
func ClipboardTextData ¶
ClipboardTextData returns clipboard text data.
func CloseAllWindows ¶
CloseAllWindows closes all open windows and waits until gone.
func CloseNotifications ¶
CloseNotifications uses autotestPrivate api to close all notifications.
func CountVisibleWindows ¶
CountVisibleWindows returns number of visible windows
func CreateNewDesk ¶
CreateNewDesk requests Ash to create a new Virtual Desk which would fail if the maximum number of desks have been reached.
func CreateWindows ¶
func CreateWindows(ctx context.Context, tconn *chrome.TestConn, cs ConnSource, url string, n int) error
CreateWindows create n browser windows with specified URL and wait for them to become visible. It will fail and return an error if at least one request fails to fulfill. Note that this will parallelize the requests to create windows, which may be bad if the caller wants to measure the performance of Chrome. This should be used for a preparation, before the measurement happens.
func DragToShowHomescreen ¶
func DragToShowHomescreen(ctx context.Context, width, height input.TouchCoord, stw *input.SingleTouchEventWriter, tconn *chrome.TestConn) error
DragToShowHomescreen shows the homescreen (app-list) by dragging up from the bottom of the screen quickly. Note that this action only works in tablet mode.
func DragToShowOverview ¶
func DragToShowOverview(ctx context.Context, tsw *input.TouchscreenEventWriter, stw *input.SingleTouchEventWriter, tconn *chrome.TestConn) error
DragToShowOverview shows overview by dragging up, pausing for the gesture to be recognized, then ending the gesture. Note that this action only works in tablet mode.
func EnsureTabletModeEnabled ¶
func EnsureTabletModeEnabled(ctx context.Context, tconn *chrome.TestConn, enabled bool) (func(ctx context.Context) error, error)
EnsureTabletModeEnabled makes sure that the tablet mode state is enabled, and returns a function which reverts back to the original state.
Typically, this will be used like:
cleanup, err := ash.EnsureTabletModeEnabled(ctx, c, true) if err != nil { s.Fatal("Failed to ensure in tablet mode: ", err) } defer cleanup(ctx)
func EnterShelfOverflow ¶
EnterShelfOverflow pins enough shelf icons to enter overflow mode.
func FindDeskMiniViews ¶
FindDeskMiniViews returns a list of DeskMiniView nodes. TODO(crbug/1251558): use autotest api to get the number of desks instead.
func FindDeskTemplates ¶
FindDeskTemplates returns a list of desk template nodes.
func ForEachWindow ¶
ForEachWindow runs a specified function on each window. If the given function returns an error, it is returned and f won't be called for following windows.
func GeneratePrepareFakeAppsOptions ¶
GeneratePrepareFakeAppsOptions is similar with GeneratePrepareFakeAppsWithNamesOptions, with a difference that GeneratePrepareFakeAppsOptions accepts the fake app count as the parameter.
func GeneratePrepareFakeAppsWithIconDataOptions ¶
func GeneratePrepareFakeAppsWithIconDataOptions(baseDir string, names []string, iconData [][]byte) ([]chrome.Option, error)
GeneratePrepareFakeAppsWithIconDataOptions is similar with GeneratePrepareFakeAppsWithNamesOptions, with a difference that GeneratePrepareFakeAppsWithIconDataOptions allows the caller to specify both app names and icon data. The caller has the duty to clean baseDir.
func GeneratePrepareFakeAppsWithNamesOptions ¶
func GeneratePrepareFakeAppsWithNamesOptions(baseDir string, names []string) ([]chrome.Option, error)
GeneratePrepareFakeAppsWithNamesOptions calls PrepareDefaultFakeApps() and returns options to be used by chrome.New() for logging in with the newly created fake apps. baseDir is the path to the directory for keeping app data. The function caller should always clean baseDir regardless of function execution results. names specify app names.
func GetDefaultPinnedAppIDs ¶
GetDefaultPinnedAppIDs returns the expected default app IDs that are pinned to the shelf.
func GetPinnedAppIds ¶
GetPinnedAppIds returns the ids of the pinned apps. Note that the browser shortcut is not among the return value because it is always pinned to shelf.
func LaunchAppFromShelf ¶
LaunchAppFromShelf opens an app by name which is currently pinned to the shelf. The parameter appName should be the name of the app which is same as the value stored in apps.App.Name.
func PinAndUnpinApps ¶
func PinAndUnpinApps(ctx context.Context, tconn *chrome.TestConn, appIDsToPin, appIDsToUnpin []string) error
PinAndUnpinApps pins and unpins the apps specified by appIDs to shelf.
func PinApp ¶
PinApp pins the shelf icon for the app specified by appID. Deprecated. Use PinApps() instead.
func PrepareDefaultFakeApps ¶
PrepareDefaultFakeApps creates directories for fake apps (hosted apps) under the directory of baseDir and returns their path names. Fake app names are specified by the parameter. hasIcon specifies whether a default icon should be used. The intermediate data may remain even when an error is returned. It is the caller's responsibility to clean up the contents under the baseDir. This also may update the ownership of baseDir.
func PrimaryDisplayMode ¶
PrimaryDisplayMode returns the display mode that is currently selected in the primary display.
func RemoveActiveDesk ¶
RemoveActiveDesk requests Ash to remove the currently active desk and waits for the desk-removal animation to complete. This call will fail if the currently active desk is the last available desk which cannot be removed.
func ResetShelfPinState ¶
func ResetShelfPinState(ctx context.Context, tconn *chrome.TestConn) (func(ctx context.Context) error, error)
ResetShelfPinState returns a callback to reset shelf app pin states to default. The callback should be run before the test ends. This function should be called before any change in shelf pin states.
func RightClickApp ¶
RightClickApp returns a function that right clicks the given app's icon on the shelf.
func ScrollShelfAndWaitUntilFinish ¶
func ScrollShelfAndWaitUntilFinish(ctx context.Context, tconn *chrome.TestConn, buttonBounds coords.Rect, targetOffset float32) error
ScrollShelfAndWaitUntilFinish triggers the scroll animation by mouse click then waits the animation to finish.
func SetClipboard ¶
SetClipboard forcibly sets the clipboard to the given data.
func SetOverviewModeAndWait ¶
SetOverviewModeAndWait requests Ash to set the overview mode state and waits for its animation to complete.
func SetShelfAlignment ¶
func SetShelfAlignment(ctx context.Context, tconn *chrome.TestConn, displayID string, a ShelfAlignment) error
SetShelfAlignment sets the shelf alignment. displayID is the display that contains the shelf.
func SetShelfBehavior ¶
func SetShelfBehavior(ctx context.Context, tconn *chrome.TestConn, displayID string, b ShelfBehavior) error
SetShelfBehavior sets the shelf visibility behavior. displayID is the display that contains the shelf.
func SetTabletModeEnabled ¶
SetTabletModeEnabled enables / disables tablet mode. After calling this function, it won't be possible to physically switch to/from tablet mode since that functionality will be disabled.
func SetWindowBounds ¶
func SetWindowBounds(ctx context.Context, tconn *chrome.TestConn, id int, b coords.Rect, displayID string) (coords.Rect, string, error)
SetWindowBounds requests changing the bounds of the window and which display it is on to the given values. It returns the actual bounds and display set, which may be different to the requested bounds and display. (e.g. setting bounds on an Android app may not have Android framework honour the request).
func SetWindowStateAndWait ¶
func SetWindowStateAndWait(ctx context.Context, tconn *chrome.TestConn, id int, targetState WindowStateType) error
SetWindowStateAndWait requests a WMEvent to make the window for the id to be in the targetState, and wait for the window animations when it happens. It returns an error when it can't be in the target state. It will return nil when the window is already in the target state.
func ShowHotseat ¶
ShowHotseat make sure hotseat is shown in tablet mode.
func ShowHotseatAction ¶
ShowHotseatAction returns a function that makes sure hotseat is shown in tablet mode.
func SwapWindowsInSplitView ¶
SwapWindowsInSplitView swaps the positions of snapped windows in split view.
func SwipeDownHotseatAndWaitForCompletion ¶
func SwipeDownHotseatAndWaitForCompletion(ctx context.Context, tconn *chrome.TestConn, stw *input.SingleTouchEventWriter, tcc *input.TouchCoordConverter) error
SwipeDownHotseatAndWaitForCompletion swipes the hotseat down, changing the hotseat state from extended to hidden. The function does not end until the hotseat animation completes.
func SwipeUpHotseatAndWaitForCompletion ¶
func SwipeUpHotseatAndWaitForCompletion(ctx context.Context, tconn *chrome.TestConn, stw *input.SingleTouchEventWriter, tcc *input.TouchCoordConverter) error
SwipeUpHotseatAndWaitForCompletion swipes the hotseat up, changing the hotseat state from hidden to extended. The function does not end until the hotseat animation completes.
func TabletModeEnabled ¶
TabletModeEnabled gets the tablet mode enabled status.
func TriggerLauncherStateChange ¶
func TriggerLauncherStateChange(ctx context.Context, tconn *chrome.TestConn, accel Accelerator) error
TriggerLauncherStateChange will cause the launcher state change via accelerator.
func UpdateAppPinFromHotseat ¶
func UpdateAppPinFromHotseat(ctx context.Context, tconn *chrome.TestConn, appName string, pin bool) error
UpdateAppPinFromHotseat pins or unpins an app shown in the hotseat using the context menu. The parameter appName should be the name of the app which is same as the value stored in apps.App.Name.
func UpdateAppPinFromShelf ¶
func UpdateAppPinFromShelf(ctx context.Context, tconn *chrome.TestConn, appName string, pin bool) error
UpdateAppPinFromShelf pins or unpins an app shown in the shelf using the context menu. The parameter appName should be the name of the app which is same as the value stored in apps.App.Name.
func VerifyShelfIconIndices ¶
func VerifyShelfIconIndices(ctx context.Context, tconn *chrome.TestConn, expectedApps []string) error
VerifyShelfIconIndices checks whether the apps are ordered as expected.
func WaitForARCAppWindowState ¶
func WaitForARCAppWindowState(ctx context.Context, tconn *chrome.TestConn, pkgName string, state WindowStateType) error
WaitForARCAppWindowState waits for a window state to appear on the Chrome side. If you expect an Activity's window state to change, this method will guarantee that the state change has fully occurred and propagated to the Chrome side.
func WaitForARCAppWindowStateWithPollOptions ¶
func WaitForARCAppWindowStateWithPollOptions(ctx context.Context, tconn *chrome.TestConn, pkgName string, state WindowStateType, pollOptions *testing.PollOptions) error
WaitForARCAppWindowStateWithPollOptions waits for a window state to appear on the Chrome side. If you expect an Activity's window state to change, this method will guarantee that the state change has fully occurred and propagated to the Chrome side.
func WaitForApp ¶
func WaitForApp(ctx context.Context, tconn *chrome.TestConn, appID string, timeout time.Duration) error
WaitForApp waits for the app specified by appID to appear in the shelf.
func WaitForAppClosed ¶
WaitForAppClosed waits for the app specified by appID to be closed.
func WaitForAppCondition ¶
func WaitForAppCondition(ctx context.Context, tconn *chrome.TestConn, appID string, timeout, interval time.Duration, cond func() (bool, error), msg string) error
WaitForAppCondition waits for the app specified by appID to meet the given condition within the given timeout.
func WaitForChromeAppInstalled ¶
func WaitForChromeAppInstalled(ctx context.Context, tconn *chrome.TestConn, appID string, timeout time.Duration) error
WaitForChromeAppInstalled waits for the app specified by appID to appear in installed apps.
func WaitForCondition ¶
func WaitForCondition(ctx context.Context, tconn *chrome.TestConn, predicate func(window *Window) bool, pollOptions *testing.PollOptions) error
WaitForCondition waits for a window to satisfy the given predicate.
func WaitForFullScreen ¶
WaitForFullScreen waits until any window that exists is in the full screen state.
func WaitForHidden ¶
WaitForHidden waits for a window to be dismissed on the Chrome side. Visibility is defined to be the corresponding Aura window's visibility.
func WaitForHotseatAnimatingToIdealState ¶
func WaitForHotseatAnimatingToIdealState(ctx context.Context, tconn *chrome.TestConn, state HotseatStateType) error
WaitForHotseatAnimatingToIdealState waits for the hotseat to reach the expected state after animation.
func WaitForHotseatAnimationToFinish ¶
WaitForHotseatAnimationToFinish waits for the hotseat animation is done.
func WaitForHotseatToUpdateAutoHideState ¶
func WaitForHotseatToUpdateAutoHideState(ctx context.Context, tconn *chrome.TestConn, autoHideState bool) error
WaitForHotseatToUpdateAutoHideState waits for the hotseat to reach the expected autohide state.
func WaitForLauncherState ¶
WaitForLauncherState waits until the launcher state becomes state. It waits up to 10 seconds and fail if the launcher doesn't have the desired state. Expected to fail with "Not supported for bubble launcher" error when waiting for state different from "Closed" if called for clamshell productivity (bubble) launcher. Note that the autotest API is expected to return immediately, but still asynchronously, in this case. NOTE: Waiting for "Closed" state will always wait for the fullscreen launcher to hide, even if one would otherwise expect bubble launcher to be used for the current session state - this supports waiting for launcher UI hide animation to complete after transitioning from tablet mode to clamshell.
func WaitForOverviewState ¶
func WaitForOverviewState(ctx context.Context, tconn *chrome.TestConn, state OverviewState, timeout time.Duration) error
WaitForOverviewState waits until overview is shown or hidden completely. Returns immediately if overview mode state matches |overview_state|.
func WaitForShelf ¶
WaitForShelf waits for the shelf to exist in the UI tree.
func WaitForStableShelfBounds ¶
WaitForStableShelfBounds waits for the shelf location to be the same for a single iteration of polling.
func WaitForVisible ¶
WaitForVisible waits for a window to be visible on the Chrome side. Visibility is defined to be the corresponding Aura window's visibility.
func WaitIDContains ¶
func WaitIDContains(idContains string) waitPredicate
WaitIDContains creates a predicate that checks whether notification ID contains idContains.
func WaitMessageContains ¶
func WaitMessageContains(messageContains string) waitPredicate
WaitMessageContains creates a predicate that checks whether the notification's message contains the given text.
func WaitTitle ¶
func WaitTitle(title string) waitPredicate
WaitTitle creates a predicate that checks whether notification has specific title.
func WaitTitleContains ¶
func WaitTitleContains(titleContains string) waitPredicate
WaitTitleContains creates a predicate that checks whether the notification's title contains the given text.
func WaitUntilNotificationGone ¶
func WaitUntilNotificationGone(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration, predicates ...waitPredicate) error
WaitUntilNotificationGone waits for the notifications that satisfies all predicates to disappear.
func WaitUntilShelfIconAnimationFinish ¶
WaitUntilShelfIconAnimationFinish waits for the shelf icon animation to finish.
Types ¶
type Accelerator ¶
type Accelerator struct { KeyCode string `json:"keyCode"` Shift bool `json:"shift"` Control bool `json:"control"` Alt bool `json:"alt"` Search bool `json:"search"` }
Accelerator represents the accelerator key to trigger certain actions.
type AppInstallSource ¶
type AppInstallSource string
AppInstallSource maps apps::mojom::InstallSource.
const ( Unknown AppInstallSource = "Unknown" System AppInstallSource = "System" Policy AppInstallSource = "Policy" Oem AppInstallSource = "Oem" Default AppInstallSource = "Default" Sync AppInstallSource = "Sync" User AppInstallSource = "User" )
Corresponds to the definition in autotest_private.idl
type AppReadiness ¶
type AppReadiness string
AppReadiness maps apps::mojom::Readiness.
const ( Ready AppReadiness = "Ready" DisabledByBlacklist AppReadiness = "DisabledByBlacklist" DisabledByPolicy AppReadiness = "DisabledByPolicy" DisabledByUser AppReadiness = "DisabledByUser" Terminated AppReadiness = "Terminated" UninstalledByUser AppReadiness = "UninstalledByUser" )
Corresponds to the definition in autotest_private.idl
type CaptionButtonStatus ¶
type CaptionButtonStatus uint
CaptionButtonStatus represents the bit mask flag in ArcAppWindowInfo
const ( CaptionButtonMinimize CaptionButtonStatus = 1 << iota CaptionButtonMaximizeAndRestore CaptionButtonClose CaptionButtonLeftSnapped CaptionButtonRightSnapped CaptionButtonBack CaptionButtonLocation CaptionButtonMenu CaptionButtonZoom CaptionButtonCount )
As defined in views::CaptionButtonIcon here: https://cs.chromium.org/chromium/src/ui/views/window/caption_button_types.h
func (*CaptionButtonStatus) String ¶
func (c *CaptionButtonStatus) String() string
String returns the CaptionButtonStatus string representation.
type ChromeApp ¶
type ChromeApp struct { AppID string `json:"appId"` Name string `json:"name"` ShortName string `json:"shortName"` PublisherID string `json:"publisherId"` Type AppType `json:"type"` InstallSource AppInstallSource `json:"installSource"` Readiness AppReadiness `json:"readiness"` AdditionalSearchTerms []string `json:"additionalSearchTerms"` ShowInLauncher bool `json:"showInLauncher"` ShowInSearch bool `json:"showInSearch"` }
ChromeApp corresponds to the "App" defined in autotest_private.idl.
type ConnSource ¶
type ConnSource interface {
NewConn(ctx context.Context, url string, opts ...cdputil.CreateTargetOption) (*chrome.Conn, error)
}
ConnSource is an interface which allows new chrome.Conn connections to be created.
type DevtoolsConn ¶
DevtoolsConn is the connection to a web content view, e.g. a tab.
type FrameMode ¶
type FrameMode string
FrameMode represents the frame mode of the window.
As defined in autotest_private.idl: https://cs.chromium.org/chromium/src/chrome/common/extensions/api/autotest_private.idl?q=FrameMode
type HotseatInfoClass ¶
type HotseatInfoClass struct { SwipeUp HotseatSwipeDescriptor `json:"swipeUp"` HotseatState HotseatStateType `json:"state"` IsAnimating bool `json:"isAnimating"` IsAutoHidden bool `json:"IsAutoHidden"` }
HotseatInfoClass corresponds to the "HotseatInfo" defined in autotest_private.idl.
func FetchHotseatInfo ¶
FetchHotseatInfo returns the hotseat's ui related information.
type HotseatStateType ¶
type HotseatStateType string
HotseatStateType corresponds to the "HotseatState" defined in autotest_private.idl.
const ( // ShelfHidden means that hotseat is shown off screen. ShelfHidden HotseatStateType = "Hidden" // ShelfShownClamShell means that hotseat is shown within the shelf in clamshell mode. ShelfShownClamShell HotseatStateType = "ShownClamShell" // ShelfShownHomeLauncher means that hotseat is shown in the tablet mode home launcher's shelf. ShelfShownHomeLauncher HotseatStateType = "ShownHomeLauncher" // ShelfExtended means that hotseat is shown above the shelf. ShelfExtended HotseatStateType = "Extended" )
type HotseatSwipeDescriptor ¶
type HotseatSwipeDescriptor struct { SwipeStartLocation coords.Point `json:"swipeStartLocation"` SwipeEndLocation coords.Point `json:"swipeEndLocation"` }
HotseatSwipeDescriptor corresponds to the "HotseatSwipeDescriptor" defined in autotest_private.idl.
type LauncherState ¶
type LauncherState string
LauncherState represents the launcher (a.k.a AppList) state.
const ( Peeking LauncherState = "Peeking" FullscreenAllApps LauncherState = "FullscreenAllApps" FullscreenSearch LauncherState = "FullscreenSearch" Half LauncherState = "Half" Closed LauncherState = "Closed" )
LauncherState as defined in https://cs.chromium.org/chromium/src/ash/public/cpp/app_list/app_list_types.h
type Notification ¶
type Notification struct { ID string `json:"id"` Type string `json:"type"` Title string `json:"title"` Message string `json:"message"` Priority int `json:"priority"` Progress int `json:"progress"` }
Notification corresponds to the "Notification" defined in autotest_private.idl.
func Notifications ¶
Notifications returns an array of notifications in Chrome. tconn must be the connection returned by chrome.TestAPIConn().
Note: it uses an autotestPrivate API with the misleading name getVisibleNotifications under the hood.
func WaitForNotification ¶
func WaitForNotification(ctx context.Context, tconn *chrome.TestConn, timeout time.Duration, predicates ...waitPredicate) (*Notification, error)
WaitForNotification waits for the first notification that satisfies all wait predicates.
type OverviewInfo ¶
OverviewInfo holds overview info of a window. https://cs.chromium.org/chromium/src/chrome/common/extensions/api/autotest_private.idl
type OverviewState ¶
type OverviewState string
OverviewState represents the animation state of overview mode.
const ( Shown OverviewState = "Shown" Hidden OverviewState = "Hidden" )
OverviewState represents two final states for overview mode, when animations complete.
type PortWaitOption ¶
type PortWaitOption = cdputil.PortWaitOption
PortWaitOption controls whether the NewSession should wait for the port file to be created.
const ( NoWaitPort PortWaitOption = cdputil.NoWaitPort WaitPort PortWaitOption = cdputil.WaitPort )
PortWaitOption values.
type ScrollableShelfInfoClass ¶
type ScrollableShelfInfoClass struct { MainAxisOffset float32 `json:"mainAxisOffset"` PageOffset float32 `json:"pageOffset"` TargetMainAxisOffset float32 `json:"targetMainAxisOffset"` LeftArrowBounds coords.Rect `json:"leftArrowBounds"` RightArrowBounds coords.Rect `json:"rightArrowBounds"` IsAnimating bool `json:"isAnimating"` IconsUnderAnimation bool `json:"iconsUnderAnimation"` IsOverflow bool `json:"isOverflow"` IsShelfWidgetAnimating bool `json:"isShelfWidgetAnimating"` IconsBoundsInScreen []*coords.Rect `json:"iconsBoundsInScreen"` }
ScrollableShelfInfoClass corresponds to the "ScrollableShelfInfo" defined in autotest_private.idl
func FetchScrollableShelfInfoForState ¶
func FetchScrollableShelfInfoForState(ctx context.Context, c *chrome.TestConn, state *ShelfState) (*ScrollableShelfInfoClass, error)
FetchScrollableShelfInfoForState returns the scrollable shelf's ui related information for the given state.
type Session ¶
Session maintains the connection to talk to the browser in Chrome DevTools Protocol over WebSocket.
func NewDevtoolsSession ¶
func NewDevtoolsSession(ctx context.Context, debuggingPortPath string, portWait PortWaitOption) (sess *Session, retErr error)
NewDevtoolsSession establishes a Chrome DevTools Protocol WebSocket connection to the browser.
type ShelfAlignment ¶
type ShelfAlignment string
ShelfAlignment represents the different Chrome OS shelf alignments.
func GetShelfAlignment ¶
func GetShelfAlignment(ctx context.Context, tconn *chrome.TestConn, displayID string) (ShelfAlignment, error)
GetShelfAlignment returns the shelf alignment. displayID is the display that contains the shelf.
type ShelfBehavior ¶
type ShelfBehavior string
ShelfBehavior represents the different Chrome OS shelf behaviors.
func GetShelfBehavior ¶
func GetShelfBehavior(ctx context.Context, tconn *chrome.TestConn, displayID string) (ShelfBehavior, error)
GetShelfBehavior returns the shelf visibility behavior. displayID is the display that contains the shelf.
type ShelfIconPinUpdateParam ¶
ShelfIconPinUpdateParam is defined in autotest_private.idl.
type ShelfInfo ¶
type ShelfInfo struct { HotseatInfo HotseatInfoClass `json:"hotseatInfo"` ScrollableShelfInfo ScrollableShelfInfoClass `json:"scrollableShelfInfo"` }
ShelfInfo corresponds to the "ShelfInfo" defined in autotest_private.idl.
type ShelfItem ¶
type ShelfItem struct { AppID string `json:"appId"` LaunchID string `json:"launchId"` Title string `json:"title"` Type ShelfItemType `json:"type"` Status ShelfItemStatus `json:"status"` ShowsToolTip bool `json:"showsTooltip"` PinnedByPolicy bool `json:"pinnedByPolicy"` HasNotification bool `json:"hasNotification"` }
ShelfItem corresponds to the "ShelfItem" defined in autotest_private.idl.
type ShelfItemStatus ¶
type ShelfItemStatus string
ShelfItemStatus repsents the type of the current status of a shelf item.
const ( ShelfItemClosed ShelfItemStatus = "Closed" ShelfItemRunning ShelfItemStatus = "Running" ShelfItemAttention ShelfItemStatus = "Attention" )
As defined in ShelfItemStatus in autotest_private.idl.
type ShelfItemType ¶
type ShelfItemType string
ShelfItemType represents the type of a shelf item.
const ( ShelfItemTypeApp ShelfItemType = "App" ShelfItemTypePinnedApp ShelfItemType = "PinnedApp" ShelfItemTypeShortcut ShelfItemType = "BrowserShortcut" ShelfItemTypeDialog ShelfItemType = "Dialog" )
As defined in ShelfItemType in autotest_private.idl.
type ShelfState ¶
type ShelfState struct {
ScrollDistance float32 `json:"scrollDistance"`
}
ShelfState corresponds to the "ShelfState" defined in autotest_private.idl
type SnapPosition ¶
type SnapPosition string
SnapPosition represents the different snap position in split view.
const ( SnapPositionLeft SnapPosition = "Left" SnapPositionRight SnapPosition = "Right" )
As defined in ash::SplitViewController here: https://cs.chromium.org/chromium/src/ash/wm/splitview/split_view_controller.h
type WMEventType ¶
type WMEventType string
WMEventType represents the different WM Event type in Ash.
const ( WMEventNormal WMEventType = "WMEventNormal" WMEventMaximize WMEventType = "WMEventMaximize" WMEventMinimize WMEventType = "WMEventMinimize" WMEventFullscreen WMEventType = "WMEventFullscreen" WMEventSnapLeft WMEventType = "WMEventSnapLeft" WMEventSnapRight WMEventType = "WMEventSnapRight" )
As defined in ash::wm::WMEventType here: https://cs.chromium.org/chromium/src/ash/wm/wm_event.h
func WMEventTypeForState ¶
func WMEventTypeForState(state WindowStateType) WMEventType
WMEventTypeForState returns the WMEventType to turn a window into the given state.
type Window ¶
type Window struct { ID int `json:"id"` Name string `json:"name"` WindowType WindowType `json:"windowType"` State WindowStateType `json:"stateType"` BoundsInRoot coords.Rect `json:"boundsInRoot"` TargetBounds coords.Rect `json:"targetBounds"` DisplayID string `json:"displayId"` Title string `json:"title"` IsAnimating bool `json:"isAnimating"` IsVisible bool `json:"isVisible"` TargetVisibility bool `json:"target_visibility"` CanFocus bool `json:"canFocus"` CanResize bool `json:"canResize"` IsActive bool `json:"isActive"` HasFocus bool `json:"hasFocus"` OnActiveDesk bool `json:"onActiveDesk"` HasCapture bool `json:"hasCapture"` CaptionHeight int `json:"captionHeight"` CaptionButtonEnabledStatus CaptionButtonStatus `json:"captionButtonEnabledStatus"` CaptionButtonVisibleStatus CaptionButtonStatus `json:"captionButtonVisibleStatus"` ARCPackageName string `json:"arcPackageName"` OverviewInfo *OverviewInfo `json:"overviewInfo,omitempty"` IsFrameVisible bool `json:"isFrameVisible"` FrameMode FrameMode `json:"FrameMode"` FullRestoreWindowAppID string `json:"fullRestoreWindowAppId"` }
Window represents a normal window (i.e. browser windows or ARC app windows). As defined in AppWindowInfo in https://cs.chromium.org/chromium/src/chrome/common/extensions/api/autotest_private.idl
func BringWindowToForeground ¶
func BringWindowToForeground(ctx context.Context, tconn *chrome.TestConn, windowTitle string) (*Window, error)
BringWindowToForeground takes windowTitle, finds the window and activates it.
func DraggedWindowInOverview ¶
DraggedWindowInOverview returns the window that is currently being dragged under overview mode. It is an error if no window is being dragged.
func FindAllWindows ¶
func FindAllWindows(ctx context.Context, tconn *chrome.TestConn, predicate func(*Window) bool) (matchingWindows []*Window, err error)
FindAllWindows returns the Chrome windows with which the given predicate returns true.
func FindFirstWindowInOverview ¶
FindFirstWindowInOverview returns the window which positioned the first item of the overview (i.e. appears at the top-left in the overview mode).
func FindOnlyWindow ¶
func FindOnlyWindow(ctx context.Context, tconn *chrome.TestConn, predicate func(*Window) bool) (*Window, error)
FindOnlyWindow returns the Chrome window with which the given predicate returns true. If there are multiple, this returns an error.
func FindWindow ¶
func FindWindow(ctx context.Context, tconn *chrome.TestConn, predicate func(*Window) bool) (*Window, error)
FindWindow returns the Chrome window with which the given predicate returns true. If there are multiple, this returns the first found window.
func GetARCAppWindowInfo ¶
func GetARCAppWindowInfo(ctx context.Context, tconn *chrome.TestConn, pkgName string) (*Window, error)
GetARCAppWindowInfo queries into Ash and returns the ARC window info. Currently, this returns information on the top window of a specified app.
func GetARCGhostWindowInfo ¶
func GetARCGhostWindowInfo(ctx context.Context, tconn *chrome.TestConn, appID string) (*Window, error)
GetARCGhostWindowInfo queries into Ash and returns the ARC ghost window info by session id.
func GetActiveWindow ¶
GetActiveWindow returns the active window.
func GetAllARCAppWindowsInfo ¶
func GetAllARCAppWindowsInfo(ctx context.Context, tconn *chrome.TestConn, pkgName string) ([]*Window, error)
GetAllARCAppWindowsInfo queries into Ash and returns all of the ARC windows info.
func GetAllWindows ¶
GetAllWindows queries Chrome to list all of the app windows currently in the system.
func SnappedWindows ¶
SnappedWindows returns the snapped windows if any.
func WaitForAnyWindow ¶
func WaitForAnyWindow(ctx context.Context, tconn *chrome.TestConn, p func(*Window) bool) (*Window, error)
WaitForAnyWindow waits for a window to satisfy the given predicate and returns it.
func WaitForAnyWindowWithTitle ¶
func WaitForAnyWindowWithTitle(ctx context.Context, tconn *chrome.TestConn, title string) (*Window, error)
WaitForAnyWindowWithTitle finds the first window whose title is title.
func WaitForAnyWindowWithoutTitle ¶
func WaitForAnyWindowWithoutTitle(ctx context.Context, tconn *chrome.TestConn, title string) (*Window, error)
WaitForAnyWindowWithoutTitle finds the first window whose title is not title.
func (*Window) ActivateWindow ¶
ActivateWindow requests to activate this window.
type WindowStateType ¶
type WindowStateType string
WindowStateType represents the different window state type in Ash.
const ( // Normal is actually used to represent both "Normal" and "Default". WindowStateNormal WindowStateType = "Normal" WindowStateMinimized WindowStateType = "Minimized" WindowStateMaximized WindowStateType = "Maximized" WindowStateFullscreen WindowStateType = "Fullscreen" WindowStateLeftSnapped WindowStateType = "LeftSnapped" WindowStateRightSnapped WindowStateType = "RightSnapped" WindowStatePIP WindowStateType = "PIP" )
As defined in ash::WindowStateType here: https://cs.chromium.org/chromium/src/ash/public/cpp/window_state_type.h
func GetARCAppWindowState ¶
func GetARCAppWindowState(ctx context.Context, tconn *chrome.TestConn, pkgName string) (WindowStateType, error)
GetARCAppWindowState gets the Chrome side window state of the ARC app window with pkgName.
func GetAllARCAppWindowStates ¶
func GetAllARCAppWindowStates(ctx context.Context, tconn *chrome.TestConn, pkgName string) (windowStates []WindowStateType, err error)
GetAllARCAppWindowStates gets all the Chrome side window states of the ARC app windows with pkgName.
func SetARCAppWindowState ¶
func SetARCAppWindowState(ctx context.Context, tconn *chrome.TestConn, pkgName string, et WMEventType) (WindowStateType, error)
SetARCAppWindowState sends WM event to ARC app window to change its window state, and returns the expected new state type.
func SetARCAppWindowStateAndWait ¶
func SetARCAppWindowStateAndWait(ctx context.Context, tconn *chrome.TestConn, pkgName string, expectedState WindowStateType) (WindowStateType, error)
SetARCAppWindowStateAndWait sends WM event to ARC app window to change its window state, waits for it to stop animating, and returns the expected new state type.
func SetWindowState ¶
func SetWindowState(ctx context.Context, tconn *chrome.TestConn, id int, et WMEventType, waitForStateChange bool) (WindowStateType, error)
SetWindowState requests changing the state of the window to the requested event type and returns the updated state if waitForStateChange is true. Otherwise, SetWindowState just sends a WMEvent and returns the expected state.
type WindowType ¶
type WindowType string
WindowType represents the type of a window.
const ( WindowTypeBrowser WindowType = "Browser" WindowTypeChromeApp WindowType = "ChromeApp" WindowTypeArc WindowType = "ArcApp" WindowTypeCrostini WindowType = "CrostiniApp" WindowTypeSystem WindowType = "SystemApp" WindowTypeExtension WindowType = "ExtensionApp" WindowTypeLacros WindowType = "Lacros" )
As defined in ash::AppType here: https://cs.chromium.org/chromium/src/ash/constants/app_types.h