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

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

Issue 405253003: Make RendererExited reset the InputRouter after destroying the window. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Android test failure. Created 6 years, 5 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
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9790c4661e14ca6789775f5a568a592d88aace52..afbd298cc52cd4ce94e3884dd3d836a02407d40c 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -107,6 +107,7 @@ class MockInputRouter : public InputRouter {
}
virtual bool ShouldForwardTouchEvent() const OVERRIDE { return true; }
virtual void OnViewUpdated(int view_flags) OVERRIDE {}
+ virtual bool HasPendingEvents() const OVERRIDE { return false; }
// IPC::Listener
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
@@ -302,6 +303,17 @@ class TestView : public TestRenderWidgetHostView {
return mock_physical_backing_size_;
return TestRenderWidgetHostView::GetPhysicalBackingSize();
}
+#if defined(USE_AURA)
+ virtual ~TestView() {
+ // Simulate the mouse exit event dispatched when an aura window is
+ // destroyed. (MakeWebMouseEventFromAuraEvent translates ET_MOUSE_EXITED
+ // into WebInputEvent::MouseMove.)
+ rwh_->input_router()->SendMouseEvent(
+ MouseEventWithLatencyInfo(
+ SyntheticWebMouseEventBuilder::Build(WebInputEvent::MouseMove),
+ ui::LatencyInfo()));
+ }
+#endif
protected:
WebMouseWheelEvent unhandled_wheel_event_;
@@ -1399,4 +1411,13 @@ TEST_F(RenderWidgetHostTest, InputEventRWHLatencyComponent) {
SendInputEventACK(WebInputEvent::TouchStart, INPUT_EVENT_ACK_STATE_CONSUMED);
}
+TEST_F(RenderWidgetHostTest, RendererExitedResetsInputRouter) {
+ // RendererExited will delete the view.
+ host_->SetView(new TestView(host_.get()));
+ host_->RendererExited(base::TERMINATION_STATUS_PROCESS_CRASHED, -1);
+
+ // Make sure the input router is in a fresh state.
+ ASSERT_FALSE(host_->input_router()->HasPendingEvents());
+}
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698