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

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbandonAudioFocusInAndroid

func AbandonAudioFocusInAndroid(ctx context.Context, dev *ui.Device) error

AbandonAudioFocusInAndroid tells the test app to abandon audio focus.

func RunTest

func RunTest(ctx context.Context, s *testing.State, f TestFunc)

RunTest starts Chrome with the media session features enabled. It installs the ARC test app, launches it and waits for it to be ready.

func SwitchToTestApp

func SwitchToTestApp(ctx context.Context, a *arc.ARC) error

SwitchToTestApp switches the focus to the test app.

func WaitForAndroidAudioFocusChange

func WaitForAndroidAudioFocusChange(ctx context.Context, d *ui.Device, focusType AudioFocusType) error

WaitForAndroidAudioFocusChange waits for the test app to display that its audio focus type changed.

func WaitForAndroidAudioFocusGain

func WaitForAndroidAudioFocusGain(ctx context.Context, d *ui.Device, focusType AudioFocusType) error

WaitForAndroidAudioFocusGain waits for the test app to gain a certain audio focus type and display that it is successful.

Types

type AudioFocusType

type AudioFocusType string

AudioFocusType contains the various audio focus types an Android app can have.

const (

	// AudioFocusLoss is the audio focus state when focus has been lost.
	AudioFocusLoss AudioFocusType = "-1"

	// AudioFocusGain is the audio focus state when the "Gain" audio focus type has been granted.
	AudioFocusGain AudioFocusType = "1"

	// AudioFocusGainTransient is the audio focus state when the "Gain Transient" audio focus type has been granted.
	AudioFocusGainTransient AudioFocusType = "2"

	// AudioFocusGainTransientMayDuck is the audio focus state when the "Gain Transient May Duck" audio focus type has been granted.
	AudioFocusGainTransientMayDuck AudioFocusType = "3"
)

type TestFunc

type TestFunc func(*arc.ARC, *ui.Device, *httptest.Server, *chrome.Chrome)

TestFunc contains the contents of the test itself and is called when the browser and test app are setup and ready for use.

Jump to

Keyboard shortcuts

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