Documentation
¶
Overview ¶
Package cdptest starts a local headless Chrome with its DevTools endpoint open, for tests that exercise the remote-browser sign-in against a real browser. It is test support only.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChromePath ¶
func ChromePath() string
ChromePath returns a Chrome/Chromium binary found on PATH, or "".
func StartChrome ¶
StartChrome starts a headless Chrome listening for DevTools connections on a free local port and returns its browser WebSocket URL and a function that kills it. The test is skipped when no browser is installed, in -short mode, or when the browser does not come up. The browser is killed when the test ends.
Types ¶
type LossyProxy ¶
type LossyProxy struct {
// URL is the proxy's ws:// endpoint.
URL string
// contains filtered or unexported fields
}
LossyProxy is a DevTools WebSocket proxy in front of a real browser that forwards everything except the replies to the commands chosen by drop: the browser executes those commands, and the client never hears back. It is how a test loses the answer to one specific command.
func NewLossyProxy ¶
func NewLossyProxy(t testing.TB, upstream string, drop func(method string, params json.RawMessage) bool) *LossyProxy
NewLossyProxy starts a proxy to the browser at upstream (its ws:// URL). drop is called for every command the client sends; when it returns true, the reply to that command is not passed back.
func (*LossyProxy) Dropped ¶
func (p *LossyProxy) Dropped() int
Dropped returns how many replies have been withheld so far.