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 kRightsVmoReadOnly
static const zx_rights_t kRightsVmoReadWrite
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 67 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestCodecStartAndExpectResponse ()
Defined at line 74 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestCodecStopAndExpectResponse ()
Defined at line 90 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 106 of file ../../src/media/audio/drivers/tests/admin_test.h
void ExpectNoPositionNotifications ()
Set flag so position notifications (even already-enqueued ones!) cause failures.
Defined at line 108 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 108 of file ../../src/media/audio/drivers/tests/admin_test.cc
uint32_t notifications_per_ring ()
Defined at line 174 of file ../../src/media/audio/drivers/tests/admin_test.h
const zx::time & start_time ()
Defined at line 175 of file ../../src/media/audio/drivers/tests/admin_test.h
uint16_t frame_size ()
Defined at line 176 of file ../../src/media/audio/drivers/tests/admin_test.h
std::optional<uint64_t> & ring_buffer_id ()
Defined at line 178 of file ../../src/media/audio/drivers/tests/admin_test.h
std::optional<uint64_t> & dai_id ()
Defined at line 180 of file ../../src/media/audio/drivers/tests/admin_test.h
std::optional<fuchsia::hardware::audio::PacketStreamProperties> & packet_stream_props ()
Defined at line 182 of file ../../src/media/audio/drivers/tests/admin_test.h
std::vector<fuchsia::hardware::audio::PcmSupportedFormats> & packet_stream_pcm_formats ()
Defined at line 185 of file ../../src/media/audio/drivers/tests/admin_test.h
std::vector<fuchsia::hardware::audio::SupportedEncodings> & packet_stream_supported_encodings ()
Defined at line 188 of file ../../src/media/audio/drivers/tests/admin_test.h
fidl::InterfacePtr<fuchsia::hardware::audio::PacketStreamControl> & packet_stream ()
Defined at line 191 of file ../../src/media/audio/drivers/tests/admin_test.h
fidl::InterfacePtr<fuchsia::hardware::audio::signalprocessing::SignalProcessing> & signal_processing ()
Defined at line 195 of file ../../src/media/audio/drivers/tests/admin_test.h
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 195 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 119 of file ../../src/media/audio/drivers/tests/admin_test.cc
bool ElementIsPacketStream (fuchsia::hardware::audio::ElementId element_id)
Is this ID a PacketStream element?
Defined at line 126 of file ../../src/media/audio/drivers/tests/admin_test.cc
std::optional<bool> ElementIsIncoming (std::optional<fuchsia::hardware::audio::ElementId> element_id)
Is this 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 element. If this element ever has any
outgoing edges, then it is not itself an incoming element.
Note: This method is intended only for RingBuffer and PacketStream
elements, not DAIs (which can also be terminal elements and thus
could potentially be considered "outgoing" or "incoming").
Defined at line 140 of file ../../src/media/audio/drivers/tests/admin_test.cc
fidl::InterfacePtr<fuchsia::hardware::audio::RingBuffer> & ring_buffer ()
Defined at line 161 of file ../../src/media/audio/drivers/tests/admin_test.h
uint32_t ring_buffer_frames ()
Defined at line 162 of file ../../src/media/audio/drivers/tests/admin_test.h
fuchsia::hardware::audio::PcmFormat ring_buffer_pcm_format ()
Defined at line 163 of file ../../src/media/audio/drivers/tests/admin_test.h
void SetRingBufferIncoming (std::optional<bool> is_incoming)
Defined at line 166 of file ../../src/media/audio/drivers/tests/admin_test.h
std::optional<uint64_t> & packet_stream_id ()
Defined at line 179 of file ../../src/media/audio/drivers/tests/admin_test.h
const std::vector<fuchsia::hardware::audio::signalprocessing::Topology> & topologies ()
Defined at line 199 of file ../../src/media/audio/drivers/tests/admin_test.h
const std::vector<fuchsia::hardware::audio::signalprocessing::Element> & elements ()
Defined at line 202 of file ../../src/media/audio/drivers/tests/admin_test.h
void DropSignalProcessing ()
Defined at line 1082 of file ../../src/media/audio/drivers/tests/admin_test.cc
void DropRingBuffer ()
Defined at line 1057 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 257 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 280 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 375 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 403 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ActivateChannelsAndExpectOutcome (uint64_t active_channels_bitmask, SetActiveChannelsOutcome expected_outcome)
Defined at line 455 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrieveRingBufferFormats ()
Defined at line 493 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 577 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrievePacketStreamFormats ()
Defined at line 528 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 930 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 949 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 959 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WaitUntilAfterStartTime ()
Ensure that the RingBuffer is already running before returning.
Defined at line 968 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 974 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 993 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 983 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamChannel ()
Defined at line 665 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamChannelWithMinPcmFormat ()
Defined at line 332 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamChannelWithMaxPcmFormat ()
Defined at line 346 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamChannelWithEncoding (fuchsia::hardware::audio::SupportedEncodings encoding_set)
This allows us to specify a single entry from `packet_stream_supported_encodings_`.
Defined at line 360 of file ../../src/media/audio/drivers/tests/admin_test.cc
zx::time RequestPacketStreamStart ()
Defined at line 843 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamStartAndExpectCallback ()
Defined at line 852 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamStopAndExpectCallback ()
Defined at line 867 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamProperties ()
Defined at line 709 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RegisterPacketStreamVmos (uint32_t vmo_count, uint64_t vmo_size)
Defined at line 722 of file ../../src/media/audio/drivers/tests/admin_test.cc
void UnregisterPacketStreamVmos ()
Defined at line 762 of file ../../src/media/audio/drivers/tests/admin_test.cc
void AllocatePacketStreamVmos (uint32_t vmo_count, uint64_t vmo_size)
Defined at line 772 of file ../../src/media/audio/drivers/tests/admin_test.cc
void DeallocatePacketStreamVmos ()
Defined at line 811 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamSink ()
Defined at line 821 of file ../../src/media/audio/drivers/tests/admin_test.cc
void PacketStreamPutPacket ()
Defined at line 885 of file ../../src/media/audio/drivers/tests/admin_test.cc
void PacketStreamFlushPackets ()
Defined at line 920 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamStartAndExpectError (zx_status_t expected_error)
Defined at line 858 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamStopAndExpectError (zx_status_t expected_error)
Defined at line 876 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamSinkAndExpectError (zx_status_t expected_error)
Defined at line 832 of file ../../src/media/audio/drivers/tests/admin_test.cc
void PacketStreamPutPacketAndExpectError (fuchsia::hardware::audio::PacketStreamSinkPutPacketRequest request, zx_status_t expected_error)
Defined at line 906 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPositionNotification ()
Defined at line 1000 of file ../../src/media/audio/drivers/tests/admin_test.cc
void PositionNotificationCallback (fuchsia::hardware::audio::RingBufferPositionInfo position_info)
Defined at line 1007 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchDelayAndExpectUpdate ()
Defined at line 1018 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchDelayAndExpectNoUpdate ()
Defined at line 1029 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 1038 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 1048 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 1070 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 1096 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateElements ()
For all elements, validate their non-type-specific fields.
Defined at line 1158 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateDaiElements ()
For DAI_INTERCONNECT elements, validate their type-specific field.
Defined at line 1171 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateDynamicsElements ()
For DYNAMICS elements, validate their type-specific field.
Defined at line 1186 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateEqualizerElements ()
For EQUALIZER elements, validate their type-specific field.
Defined at line 1201 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateGainElements ()
For GAIN elements, validate their type-specific field.
Defined at line 1216 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateVendorSpecificElements ()
For VENDOR_SPECIFIC elements, validate their type-specific field.
Defined at line 1231 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 1388 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 1433 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 1594 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchForTopology (fuchsia::hardware::audio::signalprocessing::TopologyId id)
Defined at line 1465 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 1491 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 1542 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 1496 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 1522 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 1549 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetTopologyNoChangeAndExpectNoWatch ()
Defined at line 1576 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrieveInitialElementStates ()
ElementState methods
Defined at line 1696 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateElementStates ()
Validate each ElementState, considering the Element that produced it.
Defined at line 1751 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 1763 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 1781 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 1799 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 1817 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 1835 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 2043 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 2069 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 2096 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 2123 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 2150 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 2178 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 2205 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 2228 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetElementStateNoChange (fuchsia::hardware::audio::signalprocessing::ElementId id)
Defined at line 2215 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 1720 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 1727 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 1735 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