Index: remoting/protocol/connection_unittest.cc |
diff --git a/remoting/protocol/connection_unittest.cc b/remoting/protocol/connection_unittest.cc |
index aba7ba3e1735ac60f0ac3aa887a738f8d9ef7875..4f7b3627e5f660c6abc1385ea6559569cd3931ba 100644 |
--- a/remoting/protocol/connection_unittest.cc |
+++ b/remoting/protocol/connection_unittest.cc |
@@ -348,5 +348,26 @@ TEST_P(ConnectionTest, VideoWithSlowSignaling) { |
WaitFirstVideoFrame(); |
} |
+TEST_P(ConnectionTest, DestroyOnIncomingMessage) { |
+ Connect(); |
+ |
+ KeyEvent event; |
+ event.set_usb_keycode(3); |
+ event.set_pressed(true); |
+ |
+ base::RunLoop run_loop; |
+ |
+ EXPECT_CALL(host_event_handler_, |
+ OnInputEventReceived(host_connection_.get(), _)); |
+ EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event))) |
+ .WillOnce(DoAll(InvokeWithoutArgs(this, &ConnectionTest::DestroyHost), |
+ QuitRunLoop(&run_loop))); |
+ |
+ // Send key event from the client. |
+ client_connection_->input_stub()->InjectKeyEvent(event); |
+ |
+ run_loop.Run(); |
+} |
+ |
} // namespace protocol |
} // namespace remoting |