Documentation ¶
Overview ¶
Package getusermedia provides code for webrtc.* tests related to getUserMedia(), see: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia.
Index ¶
- func DataFiles() []string
- func RunDecodeAccelUsedJPEG(ctx context.Context, s *testing.State, ...)
- func RunGetUserMedia(ctx context.Context, s *testing.State, cr ChromeInterface, ...) cameraResults
- func RunTest(ctx context.Context, s *testing.State, cr ChromeInterface, ...)
- type ChromeInterface
- type FrameStats
- type VerboseLoggingMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataFiles ¶
func DataFiles() []string
DataFiles returns a list of required files that tests that use this package should include in their Data fields.
func RunDecodeAccelUsedJPEG ¶
func RunDecodeAccelUsedJPEG(ctx context.Context, s *testing.State, getUserMediaFilename, streamName, histogramName string, bucketValue int64)
RunDecodeAccelUsedJPEG tests that the HW JPEG decoder is used in a GetUserMedia(). The test fails if bucketValue on histogramName does not count up.
func RunGetUserMedia ¶
func RunGetUserMedia(ctx context.Context, s *testing.State, cr ChromeInterface, duration time.Duration, verbose VerboseLoggingMode) cameraResults
RunGetUserMedia run a test in /data/getusermedia.html. duration specifies how long video capturing will run for each resolution. If verbose is true, video drivers' verbose messages will be enabled. verbose must be false for performance tests.
func RunTest ¶
func RunTest(ctx context.Context, s *testing.State, cr ChromeInterface, htmlName, entryPoint string, results, logs interface{})
RunTest checks if the given WebRTC tests work correctly. htmlName is a filename of an HTML file in data directory. entryPoint is a JavaScript expression that starts the test there.
Types ¶
type ChromeInterface ¶
type ChromeInterface interface { NewConn(context.Context, string, ...browser.CreateTargetOption) (*chrome.Conn, error) Close(ctx context.Context) error }
ChromeInterface defines interface which includes methods which should be implemented by all Chrome instances. (e.g. Lacros)
type FrameStats ¶
type FrameStats struct { TotalFrames int `json:"totalFrames"` BlackFrames int `json:"blackFrames"` FrozenFrames int `json:"frozenFrames"` }
FrameStats is a struct for statistics of frames.
func (*FrameStats) CheckBrokenFrames ¶
func (s *FrameStats) CheckBrokenFrames() error
CheckBrokenFrames checks that there were less than threshold frozen or black frames. This test might be too strict for real cameras, but should work fine with the Fake video/audio capture device that should be used for WebRTC tests.
func (*FrameStats) CheckTotalFrames ¶
func (s *FrameStats) CheckTotalFrames() error
CheckTotalFrames checks whether video frames were displayed.
type VerboseLoggingMode ¶
type VerboseLoggingMode int
VerboseLoggingMode describes whether video driver's verbose debug log is enabled.
const ( // VerboseLogging enables verbose logging. VerboseLogging VerboseLoggingMode = iota // NoVerboseLogging disables verbose logging. NoVerboseLogging )