New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Resource Timing] Fix buffer-full-add-after-full-event test flakiness #16228
Conversation
} else { | ||
reject("After buffer full (and " + tries + | ||
" task ticks), entry never added to primary"); | ||
} | ||
} | ||
} | ||
step_timeout(waitForIt, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the only place in those tests where we wait for the next task, which may not be a good enough guaranty.
It might be better to rename waitForNextTask
to something like waitTillConditionIsMet
, pass it a function that returns a boolean, and move the step_timeout calls and retries there. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think that this makes sense -- thank you for the suggestion! Just to make sure that I understood your suggestion completely, here is how I imagine the use of that function:
await waitUntilConditionIsMet(() => {
if (performance.getEntriesByType("resource").length) {
return true;
} else {
if (tries < maxTries) {
tries++;
return false;
} else {
return true;
}
}
}).then( (resolve, reject) => {
if (performance.getEntriesByType("resource").length) {
resolve();
} else {
reject();
}
});
Semantically, UntilConditionIsMet will not resolve until function in the parameter returns true.
I actually like the way that looks.
NB: That was written in a web comment field so it may not be syntactically correct :-)
Resolve #15849 by offering up to five opportunities to recognize that a new resource has been added to the page after the buffer full event. This does not change the semantics of the test but does make it more robust in the face of timing variability.
@yoavweiss Let me know what you think about this attempt. Once you think that it's a good approach, we can move through the other tests and do similar replacements! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Apologies for the delay in reviewing...
Resolve #15849 by offering up to five opportunities to
recognize that a new resource has been added to the page
after the buffer full event. This does not change
the semantics of the test but does make it more robust
in the face of timing variability.