class AdminTest
Defined at line 28 of file ../../src/media/audio/drivers/tests/admin_test.h
BasicTest cases must run in environments where an audio driver may already have an active client.
AdminTest cases, by contrast, need not worry about interfering with any other client. AdminTest
cases, by definition, can reconfigure devices without worrying about restoring previous state.
A driver can have only one RingBuffer client connection at any time, so BasicTest avoids any
usage of the RingBuffer interface. AdminTest includes (but is not limited to) RingBuffer tests.
AdminTest cases may also change signalprocessing topology/elements or other device state.
Protected Members
static const zx_rights_t kRightsVmoIncoming
static const zx_rights_t kRightsVmoOutgoing
Public Methods
void AdminTest (const DeviceEntry & dev_entry)
Defined at line 30 of file ../../src/media/audio/drivers/tests/admin_test.h
Protected Methods
void TearDown ()
Defined at line 65 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ExpectPositionNotifications ()
Clear flag so position notifications (even already-enqueued ones) do not cause failures.
Defined at line 78 of file ../../src/media/audio/drivers/tests/admin_test.h
void ResetAndExpectResponse ()
Request that the driver reset, expecting a response.
TODO(https://fxbug.dev/42075676): Test Reset for Composite and Dai (Reset closes any RingBuffer).
TODO(https://fxbug.dev/42077405): When SignalProcessing testing, Reset should change this state.
Defined at line 106 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestCodecStartAndExpectResponse ()
Defined at line 72 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ExpectNoPositionNotifications ()
Set flag so position notifications (even already-enqueued ones!) cause failures.
Defined at line 80 of file ../../src/media/audio/drivers/tests/admin_test.h
void RequestCodecStopAndExpectResponse ()
Defined at line 88 of file ../../src/media/audio/drivers/tests/admin_test.cc
bool ElementIsRingBuffer (fuchsia::hardware::audio::ElementId element_id)
Is this ID a RingBuffer element?
Defined at line 117 of file ../../src/media/audio/drivers/tests/admin_test.cc
bool RingBufferElementIsIncoming (fuchsia::hardware::audio::ElementId element_id)
std::optional<bool> ElementIsIncoming (std::optional<fuchsia::hardware::audio::ElementId> ring_buffer_element_id)
Is this RingBuffer element Incoming (its contents are READ-ONLY) or Outgoing (also WRITABLE)?
We walk the signalprocessing topologies. If (across all the topologies) this element ever has
any incoming edges, then it is not itself an outgoing RingBuffer. If this element ever has any
outgoing edges, then it is not itself an incoming RingBuffer.
Defined at line 128 of file ../../src/media/audio/drivers/tests/admin_test.cc
fidl::InterfacePtr<fuchsia::hardware::audio::RingBuffer> & ring_buffer ()
Defined at line 133 of file ../../src/media/audio/drivers/tests/admin_test.h
uint32_t ring_buffer_frames ()
Defined at line 134 of file ../../src/media/audio/drivers/tests/admin_test.h
fuchsia::hardware::audio::PcmFormat ring_buffer_pcm_format ()
Defined at line 135 of file ../../src/media/audio/drivers/tests/admin_test.h
void SetRingBufferIncoming (std::optional<bool> is_incoming)
Defined at line 138 of file ../../src/media/audio/drivers/tests/admin_test.h
uint32_t notifications_per_ring ()
Defined at line 146 of file ../../src/media/audio/drivers/tests/admin_test.h
const zx::time & start_time ()
Defined at line 147 of file ../../src/media/audio/drivers/tests/admin_test.h
uint16_t frame_size ()
Defined at line 148 of file ../../src/media/audio/drivers/tests/admin_test.h
std::optional<uint64_t> & ring_buffer_id ()
Defined at line 150 of file ../../src/media/audio/drivers/tests/admin_test.h
fidl::InterfacePtr<fuchsia::hardware::audio::signalprocessing::SignalProcessing> & signal_processing ()
Defined at line 152 of file ../../src/media/audio/drivers/tests/admin_test.h
const std::vector<fuchsia::hardware::audio::signalprocessing::Topology> & topologies ()
Defined at line 156 of file ../../src/media/audio/drivers/tests/admin_test.h
const std::vector<fuchsia::hardware::audio::signalprocessing::Element> & elements ()
Defined at line 159 of file ../../src/media/audio/drivers/tests/admin_test.h
void DropSignalProcessing ()
Defined at line 632 of file ../../src/media/audio/drivers/tests/admin_test.cc
void DropRingBuffer ()
Defined at line 607 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestRingBufferChannelWithMinFormat ()
Request that driver set format to the lowest bit-rate/channelization of the ranges reported.
This method assumes that the driver has already successfully responded to a GetFormats request.
Defined at line 245 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestRingBufferChannelWithMaxFormat ()
Request that driver set the highest bit-rate/channelization of the ranges reported.
This method assumes that the driver has already successfully responded to a GetFormats request.
Defined at line 263 of file ../../src/media/audio/drivers/tests/admin_test.cc
void CalculateRingBufferFrameSize ()
For the channelization and sample_format that we've set for the ring buffer, determine the size
of each frame. This method assumes that CreateRingBuffer has already been sent to the driver.
Defined at line 183 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestRingBufferProperties ()
Ring-buffer channel requests
Request the RingBufferProperties, at the current format (relies on the ring buffer channel).
Validate the four fields that might be returned (only one is currently required).
Defined at line 283 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestBuffer (uint32_t min_ring_buffer_frames, uint32_t notifications_per_ring)
Request the ring buffer's VMO handle, at the current format (relies on the ring buffer channel).
`RequestRingBufferProperties` must be called before `RequestBuffer`.
Defined at line 311 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ActivateChannelsAndExpectOutcome (uint64_t active_channels_bitmask, SetActiveChannelsOutcome expected_outcome)
Defined at line 363 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrieveRingBufferFormats ()
Defined at line 401 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrieveDaiFormats ()
Request that the driver return the format ranges that it supports.
Defined at line 440 of file ../../src/media/audio/drivers/tests/admin_test.cc
zx::time RequestRingBufferStart ()
Request that the driver start the ring buffer engine, responding with the start_time.
This method assumes that GetVmo has previously been called and we are not already started.
Defined at line 480 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestRingBufferStartAndExpectCallback ()
Request that the driver start the ring buffer engine, responding with the start_time.
This method assumes that GetVmo has previously been called and we are not already started.
Defined at line 499 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestRingBufferStartAndExpectDisconnect (zx_status_t expected_error)
Request that the driver start the ring buffer engine, but expect disconnect rather than response.
Defined at line 509 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WaitUntilAfterStartTime ()
Ensure that the RingBuffer is already running before returning.
Defined at line 518 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestRingBufferStopAndExpectCallback ()
Request that driver stop the ring buffer. This assumes that GetVmo has previously been called.
Defined at line 524 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestRingBufferStopAndExpectNoPositionNotifications ()
After RingBuffer::Stop is called, no position notification should be received.
To validate this without any race windows: from within the next position notification itself,
we call RingBuffer::Stop and flag that subsequent position notifications should FAIL.
Defined at line 543 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestRingBufferStopAndExpectDisconnect (zx_status_t expected_error)
Request that the driver start the ring buffer engine, but expect disconnect rather than response.
We would expect this if calling RingBuffer::Stop before GetVmo, for example.
Defined at line 533 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPositionNotification ()
Defined at line 550 of file ../../src/media/audio/drivers/tests/admin_test.cc
void PositionNotificationCallback (fuchsia::hardware::audio::RingBufferPositionInfo position_info)
Defined at line 557 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchDelayAndExpectUpdate ()
Defined at line 568 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchDelayAndExpectNoUpdate ()
Defined at line 579 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateInternalDelay ()
We've already validated that we received an overall response.
Internal delay must be present and non-negative.
Defined at line 588 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateExternalDelay ()
We've already validated that we received an overall response.
External delay (if present) simply must be non-negative.
Defined at line 598 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SignalProcessingConnect ()
General signalprocessing methods
All signalprocessing-related methods are in AdminTest, because only Composite drivers support the
signalprocessing protocols, and Composite drivers have only AdminTest cases.
Defined at line 620 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestElements ()
Element methods
Retrieve the element list. If signalprocessing is not supported, exit early;
otherwise save the ID of a RING_BUFFER element, and the ID of a DAI_INTERCONNECT element.
We will use these IDs later, when performing Dai-specific and RingBuffer-specific checks.
Defined at line 646 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateElements ()
For all elements, validate their non-type-specific fields.
Defined at line 706 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateDaiElements ()
For DAI_INTERCONNECT elements, validate their type-specific field.
Defined at line 719 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateDynamicsElements ()
For DYNAMICS elements, validate their type-specific field.
Defined at line 734 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateEqualizerElements ()
For EQUALIZER elements, validate their type-specific field.
Defined at line 749 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateGainElements ()
For GAIN elements, validate their type-specific field.
Defined at line 764 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateVendorSpecificElements ()
For VENDOR_SPECIFIC elements, validate their type-specific field.
Defined at line 779 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestTopologies ()
Topology methods
First retrieve the element list. If signalprocessing is not supported, exit early;
otherwise save the ID of a RING_BUFFER element, and the ID of a DAI_INTERCONNECT element.
We will use these IDs later, when performing Dai-specific and RingBuffer-specific checks.
Defined at line 936 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrieveInitialTopology ()
Having obtained the supported topologies, retrieve the current topology (the default).
Defined at line 981 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateElementTopologyClosure ()
Validate that the collection of element IDs found in the topology list are complete and correct.
Defined at line 1142 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchForTopology (fuchsia::hardware::audio::signalprocessing::TopologyId id)
Defined at line 1013 of file ../../src/media/audio/drivers/tests/admin_test.cc
void FailOnWatchTopologyCompletion ()
Request a notification if the topology changes -- and fail if we receive one.
Defined at line 1039 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchTopologyAndExpectDisconnect (zx_status_t expected_error)
Issue a topology-change-notification request, but expect our binding to disconnect in response.
This is used to validate correct behavior in the "Watch while already watching" case.
Defined at line 1090 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetAllTopologies ()
Validate that all of the supported topologies can be set (and restore the default, when done).
Defined at line 1044 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetTopologyAndExpectCallback (fuchsia::hardware::audio::signalprocessing::TopologyId id)
Validate that we can change the current topology and receive notification of the change.
Defined at line 1070 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetTopologyUnknownIdAndExpectError ()
Set the topology to an unsupported TopologyId, but expect our binding to disconnect in response.
Defined at line 1097 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetTopologyNoChangeAndExpectNoWatch ()
Defined at line 1124 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrieveInitialElementStates ()
ElementState methods
Defined at line 1241 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateElementStates ()
Validate each ElementState, considering the Element that produced it.
Defined at line 1296 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateDaiElementStates ()
For DAI_INTERCONNECT elements, validate the type-specific portions of their ElementStates.
Defined at line 1308 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateDynamicsElementStates ()
For DYNAMICS elements, validate the type-specific portions of their ElementStates.
Defined at line 1326 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateEqualizerElementStates ()
For EQUALIZER elements, validate the type-specific portions of their ElementStates.
Defined at line 1344 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateGainElementStates ()
For GAIN elements, validate the type-specific portions of their ElementStates.
Defined at line 1362 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateVendorSpecificElementStates ()
For VENDOR_SPECIFIC elements, validate the type-specific portions of their ElementStates.
Defined at line 1380 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetAllElementStates ()
Validate the ability to change non-type-specific state, for all elements.
Defined at line 1588 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetAllDynamicsElementStates ()
Validate the ability to change type-specific state, for DYNAMICS elements.
Defined at line 1614 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetAllEqualizerElementStates ()
Validate the ability to change type-specific state, for EQUALIZER elements.
Defined at line 1641 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetAllGainElementStates ()
Validate the ability to change type-specific state, for GAIN elements.
Defined at line 1668 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetAllGainElementStatesNoChange ()
Validate the ability to change type-specific state, for GAIN elements.
Defined at line 1695 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetAllGainElementStatesInvalidGainShouldError ()
Validate the ability to change type-specific state, for GAIN elements.
Defined at line 1723 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetAllElementStatesNoChange ()
Validate that a SetElementState with no-change does not trigger a WatchElementState completion.
Defined at line 1750 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetElementStateUnknownIdAndExpectError ()
SetElementState for an unsupported ElementId, and expect our completion to contain an error.
However, our signalprocessing binding should not disconnect as a result.
Defined at line 1773 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetElementStateNoChange (fuchsia::hardware::audio::signalprocessing::ElementId id)
Defined at line 1760 of file ../../src/media/audio/drivers/tests/admin_test.cc
void FailOnWatchElementStateCompletion (fuchsia::hardware::audio::signalprocessing::ElementId id)
Request a notification if this element's state changes -- and fail if we receive one.
Defined at line 1265 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchElementStateAndExpectDisconnect (fuchsia::hardware::audio::signalprocessing::ElementId id, zx_status_t expected_error)
Request an element-state-change-notification, but expect our binding to disconnect in response.
This is used to validate correct behavior in the "Watch while already watching" case.
Defined at line 1272 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchElementStateUnknownIdAndExpectDisconnect (zx_status_t expected_error)
Request state-change notification for an unknown ElementId, expecting a disconnect in response.
Defined at line 1280 of file ../../src/media/audio/drivers/tests/admin_test.cc
Enumerations
enum SetActiveChannelsOutcome
| Name | Value |
|---|---|
| SUCCESS | 1 |
| CHANGE | 2 |
| NO_CHANGE | 3 |
| FAILURE | 4 |
Defined at line 52 of file ../../src/media/audio/drivers/tests/admin_test.h