| Index: content/browser/renderer_host/render_widget_host_unittest.cc
|
| diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
|
| index ea9d84e52cccbaf196b8c3849cd4229fe65f0c15..7d23c00c4d814f4e409747b8133158a095604f1e 100644
|
| --- a/content/browser/renderer_host/render_widget_host_unittest.cc
|
| +++ b/content/browser/renderer_host/render_widget_host_unittest.cc
|
| @@ -992,6 +992,43 @@ TEST_F(RenderWidgetHostTest, ShorterDelayHangMonitorTimeout) {
|
| EXPECT_TRUE(host_->unresponsive_timer_fired());
|
| }
|
|
|
| +// Test that the hang monitor timer is effectively disabled when the widget is
|
| +// hidden.
|
| +TEST_F(RenderWidgetHostTest, HangMonitorTimeoutDisabledWhenHidden) {
|
| + host_->StartHangMonitorTimeout(TimeDelta::FromMicroseconds(1));
|
| +
|
| + // Hiding the widget should deactivate the timeout.
|
| + host_->WasHidden();
|
| +
|
| + // The timeout should not fire.
|
| + EXPECT_FALSE(host_->unresponsive_timer_fired());
|
| + base::MessageLoop::current()->PostDelayedTask(
|
| + FROM_HERE,
|
| + base::MessageLoop::QuitClosure(),
|
| + TimeDelta::FromMicroseconds(2));
|
| + base::MessageLoop::current()->Run();
|
| + EXPECT_FALSE(host_->unresponsive_timer_fired());
|
| +
|
| + // The timeout should never reactivate while hidden.
|
| + host_->StartHangMonitorTimeout(TimeDelta::FromMicroseconds(1));
|
| + base::MessageLoop::current()->PostDelayedTask(
|
| + FROM_HERE,
|
| + base::MessageLoop::QuitClosure(),
|
| + TimeDelta::FromMicroseconds(2));
|
| + base::MessageLoop::current()->Run();
|
| + EXPECT_FALSE(host_->unresponsive_timer_fired());
|
| +
|
| + // Showing the widget should restore normal timeout behavior.
|
| + host_->WasShown(ui::LatencyInfo());
|
| + host_->StartHangMonitorTimeout(TimeDelta::FromMicroseconds(1));
|
| + base::MessageLoop::current()->PostDelayedTask(
|
| + FROM_HERE,
|
| + base::MessageLoop::QuitClosure(),
|
| + TimeDelta::FromMicroseconds(2));
|
| + base::MessageLoop::current()->Run();
|
| + EXPECT_TRUE(host_->unresponsive_timer_fired());
|
| +}
|
| +
|
| // Test that the hang monitor catches two input events but only one ack.
|
| // This can happen if the second input event causes the renderer to hang.
|
| // This test will catch a regression of crbug.com/111185.
|
|
|