webapk

package
v0.0.0-...-683b059 Latest Latest
Warning

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

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

Documentation

Overview

Package webapk contains tools that help interact with webAPK PWAs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPathResolver

type DataPathResolver interface {
	DataPath(p string) string
}

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) CloseApp

func (wm *Manager) CloseApp(ctx context.Context) error

CloseApp closes the corresponding WebAPK.

func (*Manager) GetChromeConnection

func (wm *Manager) GetChromeConnection(ctx context.Context) (*chrome.Conn, error)

GetChromeConnection creates a new chrome connection for the PWA and returns it.

func (*Manager) InstallApk

func (wm *Manager) InstallApk(ctx context.Context) error

InstallApk installs the corresponding WebAPK.

func (*Manager) InstallPwa

func (wm *Manager) InstallPwa(ctx context.Context) error

InstallPwa installs the corresponding PWA. If fails, attempts to uninstall a pre-exist PWA and install it again.

func (*Manager) LaunchApp

func (wm *Manager) LaunchApp(ctx context.Context) error

LaunchApp launches the corresponding WebAPK.

func (*Manager) ShutdownServer

func (wm *Manager) ShutdownServer(ctx context.Context) error

ShutdownServer shuts down an active http server.

func (*Manager) StartServer

func (wm *Manager) StartServer(ctx context.Context, handler http.Handler, onError func(error))

StartServer starts an http server with a custom request handler (e.g. http.NewServeMux). Accepts a custom error handler.

func (*Manager) StartServerFromDir

func (wm *Manager) StartServerFromDir(ctx context.Context, dir string, onError func(error))

StartServerFromDir starts an http server and serves files from the provided directory.

func (*Manager) UninstallPwa

func (wm *Manager) UninstallPwa(ctx context.Context) error

UninstallPwa uninstalls the corresponding PWA.

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.

Jump to

Keyboard shortcuts

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