cftbrowser

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package cftbrowser downloads and caches Chrome for Testing binaries from Google's official API (https://googlechromelabs.github.io/chrome-for-testing/).

Index

Constants

View Source
const (
	StateStarted     = "started"
	StateDownloading = "downloading"
	StateFinished    = "finished"
	StateFailed      = "failed"
)

Progress states, in the order a ProgressFunc sees them: one started, any number of downloading, then exactly one finished or failed.

Variables

This section is empty.

Functions

func EnsureBrowser

func EnsureBrowser(ctx context.Context, onProgress ProgressFunc) (string, error)

EnsureBrowser downloads and caches Chrome for Testing if not already present. Returns the path to the chrome binary.

onProgress may be nil. Without it, progress is printed as text to progressOut (stderr), never stdout — the `vigolium doctor --fix` rendering. With it, the text is suppressed and the caller gets one started event, then downloading events, then exactly one finished or failed event; the caller owns the rendering.

func FindCachedBrowser

func FindCachedBrowser() (string, error)

FindCachedBrowser looks for an already-downloaded Chrome for Testing binary without making any network requests. Returns the binary path or an error.

func IsSupported

func IsSupported() bool

IsSupported returns true if the current OS/arch has Chrome for Testing builds.

func PlatformKey

func PlatformKey() (string, error)

PlatformKey returns the CfT platform string for the current OS/arch.

Types

type ProgressEvent added in v0.5.3

type ProgressEvent struct {
	State   string // StateStarted, StateDownloading, StateFinished or StateFailed
	Version string // CfT version, once the version index answered
	Bytes   int64  // archive bytes downloaded so far (finished: the archive size; 0 on a cache hit)
	Total   int64  // archive size from Content-Length, 0 when unknown
	Err     error  // set on StateFailed
}

ProgressEvent is one step of an EnsureBrowser call, for callers that render provisioning themselves (the scan runner turns it into an ETA line and a scan.setup event).

type ProgressFunc added in v0.5.3

type ProgressFunc func(ProgressEvent)

ProgressFunc receives EnsureBrowser's progress. Called on the calling goroutine; downloading events arrive at most once per 5% of the archive.

Jump to

Keyboard shortcuts

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