Add hover test and tweak dismiss logic

This commit is contained in:
Keith Simmons 2022-06-09 10:53:58 -07:00
parent 1da1853a76
commit dddfc7beae
5 changed files with 410 additions and 28 deletions

View file

@ -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::*;