mediasession

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: 2 Imported by: 0

Documentation

Overview

Package mediasession contains common utilities to help writing media session tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	*chrome.Conn
}

Conn is the connection to the test page.

func LoadTestPage

func LoadTestPage(ctx context.Context, cr *chrome.Chrome, url string) (*Conn, error)

LoadTestPage opens the media session test page in Chrome. The caller is responsible for closing the returned Conn. Tests should symlink data/media_session_test.html into their own data directory and pass the URL at which is available via the url argument.

func (*Conn) Play

func (c *Conn) Play(ctx context.Context) error

Play starts to play the audio and checks that it has successfully started playing.

func (*Conn) State

func (c *Conn) State(ctx context.Context) (State, error)

State returns the current audio state which is whether it is playing or paused.

func (*Conn) WaitForState

func (c *Conn) WaitForState(ctx context.Context, state State) error

WaitForState waits for the audio state becoming the given one.

type State

type State string

State represents the current state of the audio playing.

const (
	// StatePaused represents that the audio is paused.
	StatePaused State = "paused"

	// StatePlaying represents that the audio is playing.
	StatePlaying State = "playing"
)

Jump to

Keyboard shortcuts

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