mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-18 05:00:48 +01:00
- Fix use-after-return in ReleaseAndWaitForDestructor if it times out
while running unit tests. - Increase PluginTest PDF load timeout.
This commit is contained in:
parent
70ed95bcca
commit
16f8a66040
@ -51,7 +51,11 @@ const char kPdfHtmlUrl[] = "http://tests/pdf.html";
|
|||||||
const char kPdfDirectUrl[] = "http://tests/pdf.pdf";
|
const char kPdfDirectUrl[] = "http://tests/pdf.pdf";
|
||||||
|
|
||||||
// Delay waiting for iframe tests to load the PDF file.
|
// Delay waiting for iframe tests to load the PDF file.
|
||||||
|
#if defined(OS_LINUX)
|
||||||
|
const int64 kPdfLoadDelayMs = 7000;
|
||||||
|
#else
|
||||||
const int64 kPdfLoadDelayMs = 5000;
|
const int64 kPdfLoadDelayMs = 5000;
|
||||||
|
#endif
|
||||||
|
|
||||||
// Browser-side test handler.
|
// Browser-side test handler.
|
||||||
class PluginTestHandler : public RoutingTestHandler,
|
class PluginTestHandler : public RoutingTestHandler,
|
||||||
|
@ -299,10 +299,15 @@ template<typename T>
|
|||||||
void ReleaseAndWaitForDestructor(CefRefPtr<T>& handler, int delay_ms = 2000) {
|
void ReleaseAndWaitForDestructor(CefRefPtr<T>& handler, int delay_ms = 2000) {
|
||||||
base::WaitableEvent event(true, false);
|
base::WaitableEvent event(true, false);
|
||||||
handler->SetDestroyEvent(&event);
|
handler->SetDestroyEvent(&event);
|
||||||
|
T* _handler_ptr = handler.get();
|
||||||
handler = NULL;
|
handler = NULL;
|
||||||
bool handler_destructed =
|
bool handler_destructed =
|
||||||
event.TimedWait(base::TimeDelta::FromMilliseconds(delay_ms));
|
event.TimedWait(base::TimeDelta::FromMilliseconds(delay_ms));
|
||||||
EXPECT_TRUE(handler_destructed);
|
EXPECT_TRUE(handler_destructed);
|
||||||
|
if (!handler_destructed) {
|
||||||
|
// |event| is a stack variable so clear the reference before returning.
|
||||||
|
_handler_ptr->SetDestroyEvent(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post a task to the specified thread and wait for the task to execute as
|
// Post a task to the specified thread and wait for the task to execute as
|
||||||
|
Loading…
x
Reference in New Issue
Block a user