taskmanager

package
v0.0.0-...-9474aff Latest Latest
Warning

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

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

Documentation

Overview

Package taskmanager contains functions related to the task manager.

Index

Constants

This section is empty.

Variables

View Source
var (

	// EndProcessFinder is the finder for End Process button.
	EndProcessFinder = nodewith.Name("End process").Role(role.Button).FinalAncestor(rootFinder)
)

Functions

func FindNthProcess

func FindNthProcess(ctx context.Context, ui *uiauto.Context, nth int) (*nodewith.Finder, error)

FindNthProcess returns the finder of the nth row and the first column of the process node in the task manager.

func FindProcess

func FindProcess() *nodewith.Finder

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

func NewChromeTabProcess(url string) *ChromeTab

NewChromeTabProcess returns an instance of ChromeTab.

func (*ChromeTab) Close

func (tab *ChromeTab) Close(ctx context.Context) error

Close closes the chrome tab.

func (*ChromeTab) NameInTaskManager

func (tab *ChromeTab) NameInTaskManager() string

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.

func (*ChromeTab) Status

func (tab *ChromeTab) Status(ctx context.Context, tconn *chrome.TestConn) (ProcessStatus, error)

Status returns the ProcessStatus of the chrome tab process.

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

New returns an instance of TaskManager.

func (*TaskManager) Close

func (tm *TaskManager) Close(ctx context.Context, tconn *chrome.TestConn) error

Close closes the task manager.

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.

Jump to

Keyboard shortcuts

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