mirror of
https://github.com/lexmount/moli.git
synced 2026-11-21 00:03:15 +00:00
test(core): prove fetch deadlines interrupt an entered navigation grace
Warm the renderer before starting the short deadline and assert the lifecycle decider actually enters its successor-navigation grace path. Preserve the original 100 ms request timeout, 10-second grace and owner-recovery bounds.
Extracted from development commit 739748a5d14a9cfd0c5aff913146a238d97030c9.
Base: main (b30f39c580).
Validation (32 build jobs and test threads): cargo fmt --all; cargo clippy --workspace --all-targets --all-features -- -D warnings; cargo nextest run --no-fail-fast.
Summary [ 147.288s] 22169 tests run: 22169 passed (9 slow), 20 skipped
This commit is contained in:
@@ -207,6 +207,16 @@ async fn lifecycle_decider_does_not_extend_initial_stage_timeout() -> Result<()>
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
async fn follow_navigation_grace_cannot_extend_fetch_timeout() -> Result<()> {
|
||||
let browser = Browser::new(AppConfig::default())?;
|
||||
// Exercise an entered navigation-grace wait, independently of first-use
|
||||
// renderer initialization consuming the short fetch deadline.
|
||||
let warm_page = executable_page(
|
||||
browser
|
||||
.fetch_request_document_allow_http_error(Request::get("about:blank")?)
|
||||
.await?,
|
||||
)?;
|
||||
assert_eq!(warm_page.status(), 200);
|
||||
let decider_was_called = Arc::new(Mutex::new(false));
|
||||
let observed_decider = Arc::clone(&decider_was_called);
|
||||
|
||||
let result = tokio::time::timeout(
|
||||
Duration::from_secs(1),
|
||||
@@ -214,7 +224,8 @@ async fn follow_navigation_grace_cannot_extend_fetch_timeout() -> Result<()> {
|
||||
Request::get("about:blank")?,
|
||||
RenderedDomWaitUntil::Done,
|
||||
Duration::from_millis(100),
|
||||
|_| {
|
||||
move |_| {
|
||||
*observed_decider.lock() = true;
|
||||
Ok(RendererLifecycleDecision::FollowNextDocument {
|
||||
navigation_grace_ms: 10_000,
|
||||
})
|
||||
@@ -229,6 +240,10 @@ async fn follow_navigation_grace_cannot_extend_fetch_timeout() -> Result<()> {
|
||||
format!("{error:#}").contains("timed out after 100 ms"),
|
||||
"error={error:#}"
|
||||
);
|
||||
assert!(
|
||||
*decider_was_called.lock(),
|
||||
"the fetch deadline must interrupt the entered navigation grace"
|
||||
);
|
||||
|
||||
let page = tokio::time::timeout(
|
||||
Duration::from_secs(1),
|
||||
|
||||
Reference in New Issue
Block a user