Struct TestEngine
pub struct TestEngine { /* private fields */ }Implementations§
§impl TestEngine
impl TestEngine
pub fn new() -> Arc<TestEngine> ⓘ
pub fn commands(&self) -> Vec<WebViewCommand>
pub fn commands(&self) -> Vec<WebViewCommand>
Every command received so far, in order.
pub fn current_uri(&self) -> Option<String>
pub fn set_media_element(&self, media: Option<MediaElementInfo>)
pub fn set_media_element(&self, media: Option<MediaElementInfo>)
Configure the deterministic response to a media-element probe.
pub fn visibility_changes(&self) -> Vec<bool>
pub fn visibility_changes(&self) -> Vec<bool>
Every visibility change the engine was told, oldest first.
pub fn set_paint_snapshot(&self, snapshot: impl Into<String>)
pub fn set_paint_snapshot(&self, snapshot: impl Into<String>)
Answer every later paint capture with this layout snapshot (raw
DOMSnapshot JSON), as a real engine would for its current page.
pub fn push_page_reply(&self, reply: Result<PageReply, PageFailure>)
pub fn push_page_reply(&self, reply: Result<PageReply, PageFailure>)
Queue the answer to the next page request. Without one, an outline is a single document line and every other request succeeds.
pub fn page_color(uri: &str) -> [u8; 3]
pub fn page_color(uri: &str) -> [u8; 3]
Stable page colour for a URL — exposed so tests can compute the expected pixels.
Trait Implementations§
§impl WebViewEngine for TestEngine
impl WebViewEngine for TestEngine
Admit a navigation and reserve its terminal outcome. IDs must increase
strictly within this engine’s lifetime and fit a positive CEF signed integer. Read more
§fn set_visible(&self, visible: bool)
fn set_visible(&self, visible: bool)
Suspend painting without discarding the document or its session history.
§fn send(&self, cmd: WebViewCommand)
fn send(&self, cmd: WebViewCommand)
Enqueue a command. Must never block on engine work.
fn frames(&self) -> Arc<Mutex<Option<Frame>>> ⓘ
§fn drain_events(&self) -> Vec<WebViewEvent>
fn drain_events(&self) -> Vec<WebViewEvent>
Take all pending events, oldest first.
fn supports_text_input(&self) -> bool
§fn supports_guarded_edit_history(&self) -> bool
fn supports_guarded_edit_history(&self) -> bool
Whether original-field acknowledged Undo/Redo is supported.
§fn handle_undo_request(&self, request: UndoRequest) -> bool
fn handle_undo_request(&self, request: UndoRequest) -> bool
Offer system Undo/Redo to this page’s native editing history.
True means the backend consumed the request, not that a history entry
existed or that an asynchronous edit has already completed.
§fn text_input(&self, request: Request) -> Option<Receipt>
fn text_input(&self, request: Request) -> Option<Receipt>
Private text transactions never enter the app event or page-agent stream.
§fn create_tab(&self) -> Result<Arc<dyn WebViewEngine>, String>
fn create_tab(&self) -> Result<Arc<dyn WebViewEngine>, String>
Create an independent document in the same runtime/profile. Read more
§fn set_modifiers(&self, modifiers: KeyModifiers)
fn set_modifiers(&self, modifiers: KeyModifiers)
Keep pointer modifiers current even when no key event reaches the page.
§fn take_new_tab_requests(&self) -> Vec<(String, bool)>
fn take_new_tab_requests(&self) -> Vec<(String, bool)>
Native new-window intents, delivered to browser chrome as tab requests.
§fn supports_native_filtering(&self) -> bool
fn supports_native_filtering(&self) -> bool
Whether this backend accepts source rules instead of
WebKit JSON.§fn request_close(&self) -> bool
fn request_close(&self) -> bool
Request native close admission. True allows immediate local close; false
completes asynchronously through
TabClosed, TabDetached or TabCloseBlocked.§fn drain_download_events(&self) -> Vec<WebViewEvent>
fn drain_download_events(&self) -> Vec<WebViewEvent>
Runtime-owned download events, independent of a tab lifetime.
§fn set_waker(&self, _waker: Box<dyn Fn() + Send + Sync>)
fn set_waker(&self, _waker: Box<dyn Fn() + Send + Sync>)
Invoked (from any thread) whenever a new frame or event is ready —
typically wired to the winit event loop proxy so idle apps repaint
on engine activity. Synchronous engines don’t need one.
§fn presented(&self)
fn presented(&self)
A view drew this engine’s page just now. Engines that stop painting
pages nobody draws (see
paint::PaintEngine) resume here.§fn wrapped(&self) -> Option<&Arc<dyn WebViewEngine>>
fn wrapped(&self) -> Option<&Arc<dyn WebViewEngine>>
The engine this one wraps, for what only a backend can answer.
§fn paint_frame(&self) -> Option<Arc<Frame>>
fn paint_frame(&self) -> Option<Arc<Frame>>
§fn paint_blob(&self, _hash: &[u8; 32]) -> Option<Arc<Vec<u8>>>
fn paint_blob(&self, _hash: &[u8; 32]) -> Option<Arc<Vec<u8>>>
Encoded bytes of an image a
paint_frame references.§fn take_paint_stream(&self, _keyframe: bool) -> Vec<Payload>
fn take_paint_stream(&self, _keyframe: bool) -> Vec<Payload>
The page as a stream for a session to share: a whole frame when
keyframe (or when the consumer must start over), else the patches
since the last call, followed by images not sent yet. Empty for an
engine without a display list.Auto Trait Implementations§
impl !Freeze for TestEngine
impl RefUnwindSafe for TestEngine
impl Send for TestEngine
impl Sync for TestEngine
impl Unpin for TestEngine
impl UnsafeUnpin for TestEngine
impl UnwindSafe for TestEngine
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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