mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
ceftests: Avoid shutdown hang due to leaked TestHandlers
This commit is contained in:
@@ -77,7 +77,17 @@ void RunTestsOnTestThread() {
|
|||||||
CefTestSuite::GetInstance()->Run();
|
CefTestSuite::GetInstance()->Run();
|
||||||
|
|
||||||
// Wait for all TestHandlers to be destroyed.
|
// Wait for all TestHandlers to be destroyed.
|
||||||
while (TestHandler::HasTestHandler()) {
|
size_t loop_count = 0;
|
||||||
|
while (true) {
|
||||||
|
const size_t handler_count = TestHandler::GetTestHandlerCount();
|
||||||
|
if (handler_count == 0) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (++loop_count == 20) {
|
||||||
|
LOG(ERROR) << "Terminating with " << handler_count
|
||||||
|
<< " leaked TestHandler objects";
|
||||||
|
break;
|
||||||
|
}
|
||||||
sleep(100);
|
sleep(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -211,9 +211,9 @@ class TestHandler : public CefClient,
|
|||||||
void OnWindowCreated(int browser_id);
|
void OnWindowCreated(int browser_id);
|
||||||
void OnWindowDestroyed(int browser_id);
|
void OnWindowDestroyed(int browser_id);
|
||||||
|
|
||||||
// Returns true if a TestHandler currently exists.
|
// Returns the count of TestHandlers the currently exist.
|
||||||
static bool HasTestHandler() {
|
static size_t GetTestHandlerCount() {
|
||||||
return test_handler_count_.load(std::memory_order_relaxed) > 0U;
|
return test_handler_count_.load(std::memory_order_relaxed);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string debug_string_prefix() const { return debug_string_prefix_; }
|
std::string debug_string_prefix() const { return debug_string_prefix_; }
|
||||||
|
Reference in New Issue
Block a user