Randomly detach requests on guest to let them race with other local ops

This commit is contained in:
Antonio Scandurra 2022-02-17 09:05:06 +01:00
parent e3c4ce208a
commit 1fbcea6c0d
3 changed files with 58 additions and 26 deletions

View file

@ -492,6 +492,15 @@ impl TestAppContext {
self.cx.borrow().background().clone()
}
pub fn spawn<F, Fut, T>(&self, f: F) -> Task<T>
where
F: FnOnce(AsyncAppContext) -> Fut,
Fut: 'static + Future<Output = T>,
T: 'static,
{
self.cx.borrow_mut().spawn(f)
}
pub fn simulate_new_path_selection(&self, result: impl FnOnce(PathBuf) -> Option<PathBuf>) {
self.foreground_platform.simulate_new_path_selection(result);
}