Documentation ¶
Overview ¶
Package taskmanager contains functions related to the task manager.
Index ¶
- Variables
- func FindNthProcess(ctx context.Context, ui *uiauto.Context, nth int) (*nodewith.Finder, error)
- func FindProcess() *nodewith.Finder
- type ChromeTab
- func (tab *ChromeTab) Close(ctx context.Context) error
- func (tab *ChromeTab) NameInTaskManager() string
- func (tab *ChromeTab) Open(ctx context.Context, cr *chrome.Chrome, tconn *chrome.TestConn, ...) (retErr error)
- func (tab *ChromeTab) QueryLoadingStatus(ctx context.Context, tconn *chrome.TestConn) (TabStatus, error)
- func (tab *ChromeTab) SetOpenInNewWindow()
- func (tab *ChromeTab) Status(ctx context.Context, tconn *chrome.TestConn) (ProcessStatus, error)
- type Process
- type ProcessStatus
- type TabStatus
- type TaskManager
- func (tm *TaskManager) Close(ctx context.Context, tconn *chrome.TestConn) error
- func (tm *TaskManager) Open(ctx context.Context) error
- func (tm *TaskManager) SelectProcess(p *nodewith.Finder) uiauto.Action
- func (tm *TaskManager) TerminateProcess(p *nodewith.Finder) uiauto.Action
- func (tm *TaskManager) WaitUntilStable(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ( // EndProcessFinder is the finder for End Process button. EndProcessFinder = nodewith.Name("End process").Role(role.Button).FinalAncestor(rootFinder) )
Functions ¶
func FindNthProcess ¶
FindNthProcess returns the finder of the nth row and the first column of the process node in the task manager.
func FindProcess ¶
FindProcess returns the finder of a process node in the task manager.
Types ¶
type ChromeTab ¶
type ChromeTab struct { // URL is the url of the tab. URL string // ID is the id of the tab. ID int `json:"id"` // Title is the title of the tab. Title string `json:"title"` // LoadingStatus is the loading status of the tab. LoadingStatus TabStatus `json:"status"` // contains filtered or unexported fields }
ChromeTab defines the struct for chrome tab.
func NewChromeTabProcess ¶
NewChromeTabProcess returns an instance of ChromeTab.
func (*ChromeTab) NameInTaskManager ¶
NameInTaskManager returns the process name displayed in the task manager.
func (*ChromeTab) Open ¶
func (tab *ChromeTab) Open(ctx context.Context, cr *chrome.Chrome, tconn *chrome.TestConn, kb *input.KeyboardEventWriter) (retErr error)
Open opens a new chrome tab in a single browser window.
func (*ChromeTab) QueryLoadingStatus ¶
func (tab *ChromeTab) QueryLoadingStatus(ctx context.Context, tconn *chrome.TestConn) (TabStatus, error)
QueryLoadingStatus returns the TabStatus of the chrome tab.
func (*ChromeTab) SetOpenInNewWindow ¶
func (tab *ChromeTab) SetOpenInNewWindow()
SetOpenInNewWindow sets openInNewWindow to be true.
type Process ¶
type Process interface { // Open opens the process. Open(ctx context.Context, cr *chrome.Chrome, tconn *chrome.TestConn, kb *input.KeyboardEventWriter) error // Close closes the process. Close(ctx context.Context) error // Status returns the status of the process, e.g., alive, dead, and etc. Status(ctx context.Context, tconn *chrome.TestConn) (ProcessStatus, error) // NameInTaskManager returns the process name displayed in the task manager. NameInTaskManager() string }
Process defines the interface for the process.
type ProcessStatus ¶
type ProcessStatus string
ProcessStatus defines the status of the process.
const ( // ProcessAlive represents the status of the alive process. ProcessAlive ProcessStatus = "alive" // ProcessDead represents the status of the dead process. ProcessDead ProcessStatus = "dead" // ProcessUnknownStatus represents the unknown status of the process. ProcessUnknownStatus ProcessStatus = "unknown" )
type TabStatus ¶
type TabStatus string
TabStatus defines the 3 types of TabStatus in Chrome API.
const ( TabUnloaded TabStatus = "unloaded" TabLoading TabStatus = "loading" TabComplete TabStatus = "complete" )
Define 3 types of TabStatus. See: https://developer.chrome.com/docs/extensions/reference/tabs/#type-TabStatus
type TaskManager ¶
type TaskManager struct {
// contains filtered or unexported fields
}
TaskManager holds the resources required to operate on the Task Manager.
func New ¶
func New(tconn *chrome.TestConn, kb *input.KeyboardEventWriter) *TaskManager
New returns an instance of TaskManager.
func (*TaskManager) Open ¶
func (tm *TaskManager) Open(ctx context.Context) error
Open opens the task manager.
func (*TaskManager) SelectProcess ¶
func (tm *TaskManager) SelectProcess(p *nodewith.Finder) uiauto.Action
SelectProcess selects the specific process in the task manager.
func (*TaskManager) TerminateProcess ¶
func (tm *TaskManager) TerminateProcess(p *nodewith.Finder) uiauto.Action
TerminateProcess terminates the process.
func (*TaskManager) WaitUntilStable ¶
func (tm *TaskManager) WaitUntilStable(ctx context.Context) error
WaitUntilStable waits task manager UI to become stable.