diff options
Diffstat (limited to 'src/components/connection_handler/test/connection_handler_impl_test.cc')
-rw-r--r-- | src/components/connection_handler/test/connection_handler_impl_test.cc | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/components/connection_handler/test/connection_handler_impl_test.cc b/src/components/connection_handler/test/connection_handler_impl_test.cc index 3fbdf62474..9305eee2ee 100644 --- a/src/components/connection_handler/test/connection_handler_impl_test.cc +++ b/src/components/connection_handler/test/connection_handler_impl_test.cc @@ -855,6 +855,24 @@ TEST_F(ConnectionHandlerTest, OnConnectionClosed) { connection_handler_->OnConnectionClosed(uid_); } +TEST_F(ConnectionHandlerTest, OnFinalMessageCallback_OnConnectionClosed) { + AddTestDeviceConnection(); + AddTestSession(); + + connection_handler_test::MockConnectionHandlerObserver + mock_connection_handler_observer; + connection_handler_->set_connection_handler_observer( + &mock_connection_handler_observer); + + EXPECT_CALL(mock_connection_handler_observer, + OnServiceEndedCallback(connection_key_, kBulk, kFinalMessage)); + EXPECT_CALL(mock_connection_handler_observer, + OnServiceEndedCallback(connection_key_, kRpc, kFinalMessage)); + + connection_handler_->OnFinalMessageCallback(connection_key_); + connection_handler_->OnConnectionClosed(uid_); +} + TEST_F(ConnectionHandlerTest, OnUnexpectedDisconnect) { AddTestDeviceConnection(); AddTestSession(); @@ -874,6 +892,27 @@ TEST_F(ConnectionHandlerTest, OnUnexpectedDisconnect) { connection_handler_->OnUnexpectedDisconnect(uid_, err); } +TEST_F(ConnectionHandlerTest, OnFinalMessageCallback_OnUnexpectedDisconnect) { + AddTestDeviceConnection(); + AddTestSession(); + + connection_handler_test::MockConnectionHandlerObserver + mock_connection_handler_observer; + connection_handler_->set_connection_handler_observer( + &mock_connection_handler_observer); + + EXPECT_CALL(mock_connection_handler_observer, + OnServiceEndedCallback( + connection_key_, kBulk, CloseSessionReason::kFinalMessage)); + EXPECT_CALL(mock_connection_handler_observer, + OnServiceEndedCallback( + connection_key_, kRpc, CloseSessionReason::kFinalMessage)); + + connection_handler_->OnFinalMessageCallback(connection_key_); + transport_manager::CommunicationError err; + connection_handler_->OnUnexpectedDisconnect(uid_, err); +} + TEST_F(ConnectionHandlerTest, ConnectToDevice) { // Precondition const uint32_t dev_handle1 = 1; |