Add hover test and tweak dismiss logic
This commit is contained in:
@@ -330,6 +330,11 @@ impl Deterministic {
|
||||
Timer::Deterministic(DeterministicTimer { rx, id, state })
|
||||
}
|
||||
|
||||
pub fn now(&self) -> std::time::Instant {
|
||||
let state = self.state.lock();
|
||||
state.now.clone()
|
||||
}
|
||||
|
||||
pub fn advance_clock(&self, duration: Duration) {
|
||||
let new_now = self.state.lock().now + duration;
|
||||
loop {
|
||||
@@ -647,6 +652,14 @@ impl Background {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn now(&self) -> std::time::Instant {
|
||||
match self {
|
||||
Background::Production { .. } => std::time::Instant::now(),
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
Background::Deterministic { executor } => executor.now(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub async fn simulate_random_delay(&self) {
|
||||
use rand::prelude::*;
|
||||
|
||||
Reference in New Issue
Block a user