ceftests: Simplify completion for tests that don't just create browsers

Some test cases don't create browsers at all, or require additional signals
such as request context destruction.

To test: Run `ceftests --gtest_filter=URLRequestTest.*`
This commit is contained in:
Marshall Greenblatt
2023-10-17 18:16:06 -04:00
parent f594ca3785
commit 6651523d86
6 changed files with 181 additions and 103 deletions

View File

@@ -957,7 +957,7 @@ class MultiQuerySingleFrameTestHandler : public SingleLoadTestHandler,
AssertQueryCount(nullptr, nullptr, 0);
} else if (cancel_type_ == CANCEL_BY_CLOSING_BROWSER) {
// Change the expected behavior in the handler.
SetSignalCompletionWhenAllBrowsersClose(false);
SetSignalTestCompletionCount(1U);
CloseBrowser(GetBrowser(), false);
}
}
@@ -971,11 +971,12 @@ class MultiQuerySingleFrameTestHandler : public SingleLoadTestHandler,
DestroyTest();
if (!SignalCompletionWhenAllBrowsersClose()) {
if (!AllowTestCompletionWhenAllBrowsersClose()) {
// Complete asynchronously so the call stack has a chance to unwind.
CefPostTask(TID_UI,
base::BindOnce(
&MultiQuerySingleFrameTestHandler::TestComplete, this));
CefPostTask(
TID_UI,
base::BindOnce(
&MultiQuerySingleFrameTestHandler::SignalTestCompletion, this));
}
}