Documentation
¶
Overview ¶
Package webapk contains tools that help interact with webAPK PWAs.
Index ¶
- type DataPathResolver
- type Manager
- func (wm *Manager) CloseApp(ctx context.Context) error
- func (wm *Manager) GetChromeConnection(ctx context.Context) (*chrome.Conn, error)
- func (wm *Manager) InstallApk(ctx context.Context) error
- func (wm *Manager) InstallPwa(ctx context.Context) error
- func (wm *Manager) LaunchApp(ctx context.Context) error
- func (wm *Manager) ShutdownServer(ctx context.Context) error
- func (wm *Manager) StartServer(ctx context.Context, handler http.Handler, onError func(error))
- func (wm *Manager) StartServerFromDir(ctx context.Context, dir string, onError func(error))
- func (wm *Manager) UninstallPwa(ctx context.Context) error
- type WebAPK
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataPathResolver ¶
DataPathResolver helps resolve DataPath. Both testing.State and testing.FixtState match it.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager helps manage a WebAPK.
func NewManager ¶
func NewManager(ctx context.Context, cr *chrome.Chrome, arc *arc.ARC, dpr DataPathResolver, webapk WebAPK) (*Manager, error)
NewManager returns a reference to a new Manager.
func (*Manager) GetChromeConnection ¶
GetChromeConnection creates a new chrome connection for the PWA and returns it.
func (*Manager) InstallApk ¶
InstallApk installs the corresponding WebAPK.
func (*Manager) InstallPwa ¶
InstallPwa installs the corresponding PWA. If fails, attempts to uninstall a pre-exist PWA and install it again.
func (*Manager) ShutdownServer ¶
ShutdownServer shuts down an active http server.
func (*Manager) StartServer ¶
StartServer starts an http server with a custom request handler (e.g. http.NewServeMux). Accepts a custom error handler.
func (*Manager) StartServerFromDir ¶
StartServerFromDir starts an http server and serves files from the provided directory.
type WebAPK ¶
type WebAPK struct { // Name is the corresponding app name. Name string // Name is the corresponding app name. ID string // Port is the port the web server will expose. // It is hardcoded in the corresponding WebAPK. Port int // ApkDataPath is the pre-generated WebAPK data path which points to the app. ApkDataPath string // IndexPageDataPath is the index page of the app. IndexPageDataPath string }
WebAPK is used to represent a ChromeOS WebApk app.