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 66 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestCodecStopAndExpectResponse ()
Defined at line 89 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 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 107 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestCodecStartAndExpectResponse ()
Defined at line 73 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 108 of file ../../src/media/audio/drivers/tests/admin_test.h
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
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 194 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 118 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 125 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 139 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
fidl::InterfacePtr<fuchsia::hardware::audio::signalprocessing::SignalProcessing> & signal_processing ()
Defined at line 195 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 1081 of file ../../src/media/audio/drivers/tests/admin_test.cc
void DropRingBuffer ()
Defined at line 1056 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 256 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 279 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 374 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 402 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ActivateChannelsAndExpectOutcome (uint64_t active_channels_bitmask, SetActiveChannelsOutcome expected_outcome)
Defined at line 454 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrieveRingBufferFormats ()
Defined at line 492 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 576 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrievePacketStreamFormats ()
Defined at line 527 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 929 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 948 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 958 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WaitUntilAfterStartTime ()
Ensure that the RingBuffer is already running before returning.
Defined at line 967 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 973 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 992 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 982 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamChannel ()
Defined at line 664 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamChannelWithMinPcmFormat ()
Defined at line 331 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamChannelWithMaxPcmFormat ()
Defined at line 345 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 359 of file ../../src/media/audio/drivers/tests/admin_test.cc
zx::time RequestPacketStreamStart ()
Defined at line 842 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamStartAndExpectCallback ()
Defined at line 851 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamStopAndExpectCallback ()
Defined at line 866 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamProperties ()
Defined at line 708 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RegisterPacketStreamVmos (uint32_t vmo_count, uint64_t vmo_size)
Defined at line 721 of file ../../src/media/audio/drivers/tests/admin_test.cc
void UnregisterPacketStreamVmos ()
Defined at line 761 of file ../../src/media/audio/drivers/tests/admin_test.cc
void AllocatePacketStreamVmos (uint32_t vmo_count, uint64_t vmo_size)
Defined at line 771 of file ../../src/media/audio/drivers/tests/admin_test.cc
void DeallocatePacketStreamVmos ()
Defined at line 810 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamSink ()
Defined at line 820 of file ../../src/media/audio/drivers/tests/admin_test.cc
void PacketStreamPutPacket ()
Defined at line 884 of file ../../src/media/audio/drivers/tests/admin_test.cc
void PacketStreamFlushPackets ()
Defined at line 919 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamStartAndExpectError (zx_status_t expected_error)
Defined at line 857 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamStopAndExpectError (zx_status_t expected_error)
Defined at line 875 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPacketStreamSinkAndExpectError (zx_status_t expected_error)
Defined at line 831 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 905 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RequestPositionNotification ()
Defined at line 999 of file ../../src/media/audio/drivers/tests/admin_test.cc
void PositionNotificationCallback (fuchsia::hardware::audio::RingBufferPositionInfo position_info)
Defined at line 1006 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchDelayAndExpectUpdate ()
Defined at line 1017 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchDelayAndExpectNoUpdate ()
Defined at line 1028 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 1037 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 1047 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 1069 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 1095 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateElements ()
For all elements, validate their non-type-specific fields.
Defined at line 1157 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateDaiElements ()
For DAI_INTERCONNECT elements, validate their type-specific field.
Defined at line 1170 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateDynamicsElements ()
For DYNAMICS elements, validate their type-specific field.
Defined at line 1185 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateEqualizerElements ()
For EQUALIZER elements, validate their type-specific field.
Defined at line 1200 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateGainElements ()
For GAIN elements, validate their type-specific field.
Defined at line 1215 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateVendorSpecificElements ()
For VENDOR_SPECIFIC elements, validate their type-specific field.
Defined at line 1230 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 1387 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 1432 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 1593 of file ../../src/media/audio/drivers/tests/admin_test.cc
void WatchForTopology (fuchsia::hardware::audio::signalprocessing::TopologyId id)
Defined at line 1464 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 1490 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 1541 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 1495 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 1521 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 1548 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetTopologyNoChangeAndExpectNoWatch ()
Defined at line 1575 of file ../../src/media/audio/drivers/tests/admin_test.cc
void RetrieveInitialElementStates ()
ElementState methods
Defined at line 1695 of file ../../src/media/audio/drivers/tests/admin_test.cc
void ValidateElementStates ()
Validate each ElementState, considering the Element that produced it.
Defined at line 1750 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 1762 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 1780 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 1798 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 1816 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 1834 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 2042 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 2068 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 2095 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 2122 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 2149 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 2177 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 2204 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 2227 of file ../../src/media/audio/drivers/tests/admin_test.cc
void SetElementStateNoChange (fuchsia::hardware::audio::signalprocessing::ElementId id)
Defined at line 2214 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 1719 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 1726 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 1734 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