pub struct TestRealm { /* private fields */ }Expand description
Runtime harness wrapper providing helper operations for test realms.
Implementations§
Source§impl TestRealm
impl TestRealm
Sourcepub async fn create(overrides: Vec<ConfigOverride>) -> Result<Self, Error>
pub async fn create(overrides: Vec<ConfigOverride>) -> Result<Self, Error>
Constructs a new TestRealm using a newly created realm factory instance.
Sourcepub async fn connect_to_protocol<P: DiscoverableProtocolMarker>(
&self,
) -> Result<P::Proxy, Error>
pub async fn connect_to_protocol<P: DiscoverableProtocolMarker>( &self, ) -> Result<P::Proxy, Error>
Connects to a FIDL protocol exposed by the component under test in the test realm.
Sourcepub fn get_control<M: MockControlMarker>(
&self,
) -> Result<M::ControlProxy, Error>
pub fn get_control<M: MockControlMarker>( &self, ) -> Result<M::ControlProxy, Error>
Connects to a mock control proxy.
Sourcepub async fn get_directory(&self, path: &str) -> Result<DirectoryProxy, Error>
pub async fn get_directory(&self, path: &str) -> Result<DirectoryProxy, Error>
Opens an isolated directory at the given path within the exposed directory of the realm.
Sourcepub fn subscribe_to_lifecycle(&self) -> Result<LifecycleStream, Error>
pub fn subscribe_to_lifecycle(&self) -> Result<LifecycleStream, Error>
Subscribes to lifecycle events emitted by the test environment.
Sourcepub fn emit_lifecycle_event(&self, event: LifecycleEvent)
pub fn emit_lifecycle_event(&self, event: LifecycleEvent)
Emits a lifecycle event to all subscribed lifecycle streams.
pub async fn stop_component(&self, name: &str) -> Result<(), Error>
pub async fn is_running(&self, name: &str) -> Result<bool, Error>
pub async fn start_component(&self, name: &str) -> Result<(), Error>
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TestRealm
impl !RefUnwindSafe for TestRealm
impl !UnwindSafe for TestRealm
impl Send for TestRealm
impl Sync for TestRealm
impl Unpin for TestRealm
impl UnsafeUnpin for TestRealm
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
Mutably borrows from an owned value. Read more
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<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
Converts the given service transport handle of type
T to [Self]§impl<T> IntoAny for T
impl<T> IntoAny for T
Source§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> ⓘ
Converts
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> ⓘ
Converts
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