pub struct TestHarness<D> { /* private fields */ }Expand description
The main test harness for running a driver unit test.
Implementations§
Source§impl<D: Driver> TestHarness<D>
impl<D: Driver> TestHarness<D>
Sourcepub fn set_driver_incoming(
self,
driver_incoming: ServiceFs<ServiceObj<'static, ()>>,
) -> Self
pub fn set_driver_incoming( self, driver_incoming: ServiceFs<ServiceObj<'static, ()>>, ) -> Self
Sets the driver incoming ServiceFs. Consumes and returns self to allow chaining.
Sourcepub fn set_config(self, config: Vmo) -> Self
pub fn set_config(self, config: Vmo) -> Self
Sets the configuration vmo for the driver. Consumes and returns self to allow chaining.
Sourcepub fn set_url(self, url: &str) -> Self
pub fn set_url(self, url: &str) -> Self
Sets the url for the driver. Consumes and returns self to allow chaining.
Sourcepub fn set_node_name(self, name: impl Into<String>) -> Self
pub fn set_node_name(self, name: impl Into<String>) -> Self
Sets the node name for the driver. Consumes and returns self to allow chaining.
Sourcepub fn add_offer(self, offer: Offer) -> Self
pub fn add_offer(self, offer: Offer) -> Self
Adds an offer to the driver’s start args. Consumes and returns self to allow chaining.
Sourcepub fn set_power_element_args(self, args: impl IntoPowerElementArgs) -> Self
pub fn set_power_element_args(self, args: impl IntoPowerElementArgs) -> Self
Sets the power element args for the driver. Accepts both
fidl_next_fuchsia_driver_framework::PowerElementArgs and, for drivers that haven’t
migrated yet, the legacy fidl_fuchsia_driver_framework::PowerElementArgs. Consumes and
returns self to allow chaining.
Sourcepub fn set_node_token(self, token: Event) -> Self
pub fn set_node_token(self, token: Event) -> Self
Sets the node token for the driver. Consumes and returns self to allow chaining.
Sourcepub fn set_power_element_token(self, token: Event) -> Self
pub fn set_power_element_token(self, token: Event) -> Self
Sets the power element dependency token for the driver, as returned by
crate::DriverContext::take_power_element_token. This only populates the token of the
power element args; use Self::set_power_element_args to also provide the power broker
endpoints. Consumes and returns self to allow chaining.
Sourcepub fn add_node_property(
self,
parent: &str,
key: impl Into<String>,
value: impl Into<PropertyValue>,
) -> Self
pub fn add_node_property( self, parent: &str, key: impl Into<String>, value: impl Into<PropertyValue>, ) -> Self
Adds a property of the parent node named parent to the driver’s start args, as reported
by crate::DriverContext::node_properties. Drivers bound to a single node see their
properties under the parent name default. Consumes and returns self to allow chaining.
Sourcepub fn dispatcher(&self) -> AsyncDispatcher
pub fn dispatcher(&self) -> AsyncDispatcher
Gets a driver dispatcher that can be used to run test side driver transport client/servers.
Sourcepub async fn start_driver(&mut self) -> Result<DriverUnderTest<'_, D>, Status>
pub async fn start_driver(&mut self) -> Result<DriverUnderTest<'_, D>, Status>
Starts the driver under test.
Trait Implementations§
Source§impl<D: Driver> Default for TestHarness<D>
impl<D: Driver> Default for TestHarness<D>
Source§impl<D> Drop for TestHarness<D>
impl<D> Drop for TestHarness<D>
Auto Trait Implementations§
impl<D> !RefUnwindSafe for TestHarness<D>
impl<D> !Sync for TestHarness<D>
impl<D> !UnwindSafe for TestHarness<D>
impl<D> Freeze for TestHarness<D>where
PhantomData<D>: Freeze,
impl<D> Send for TestHarness<D>where
PhantomData<D>: Send,
impl<D> Unpin for TestHarness<D>where
PhantomData<D>: Unpin,
impl<D> UnsafeUnpin for TestHarness<D>where
PhantomData<D>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous1, D> for Twhere
D: ResourceDialect,
Source§impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
impl<T, D> Encode<Ambiguous2, D> for Twhere
D: ResourceDialect,
§impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
impl<F, N> FidlIntoNative<Box<N>> for Fwhere
F: FidlIntoNative<N>,
fn fidl_into_native(self) -> Box<N>
Source§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
Source§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to SelfSource§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more