ceftests: Fix flaky URLRequestTest due to server response timing

In some cases the browser may be closed before the server response is sent.
This commit is contained in:
Marshall Greenblatt 2023-10-18 12:30:19 -04:00
parent 15caa9858d
commit f594ca3785
1 changed files with 4 additions and 2 deletions

View File

@ -124,8 +124,10 @@ class ServerHandler : public CefServerHandler {
return;
}
// No response should be sent yet.
EXPECT_TRUE(server->IsValidConnection(connection_id));
if (!server->IsValidConnection(connection_id)) {
// This can occur if the connected browser has already closed.
return;
}
const int response_code = response->GetStatus();
if (response_code <= 0) {