Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(118)

Unified Diff: content/browser/renderer_host/render_widget_host_unittest.cc

Issue 9129024: Fix for crbug.com/111185. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Forgot to commit all changes before uploading. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 54e619035cef74ffc58411125b45ee523b6c5903..bc4eedc4d78c2dec2b18449a3b0a586d6f7436b8 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -181,6 +181,10 @@ class MockRenderWidgetHost : public RenderWidgetHost {
return unresponsive_timer_fired_;
}
+ void set_hung_renderer_delay_ms(int delay_ms) {
+ hung_renderer_delay_ms_ = delay_ms;
+ }
+
protected:
virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
bool* is_keyboard_shortcut) {
@@ -742,3 +746,24 @@ TEST_F(RenderWidgetHostTest, StopAndStartHangMonitorTimeout) {
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 and will only
+// pass when the compositor thread is being used.
+TEST_F(RenderWidgetHostTest, FAILS_MultipleInputEvents) {
+ // Configure the host to wait 10ms before considering
+ // the renderer hung.
+ host_->set_hung_renderer_delay_ms(10);
+
+ // Send two events but only one ack.
+ SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
+ SimulateKeyboardEvent(WebInputEvent::RawKeyDown);
+ SendInputEventACK(WebInputEvent::RawKeyDown, true);
+
+ // Wait long enough for first timeout and see if it fired.
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ MessageLoop::QuitClosure(), 40);
+ MessageLoop::current()->Run();
+ EXPECT_TRUE(host_->unresponsive_timer_fired());
+}

Powered by Google App Engine
This is Rietveld 408576698