Loading system/bta/csis/csis_client.cc +1 −0 Original line number Diff line number Diff line Loading @@ -1956,6 +1956,7 @@ class CsisClientImpl : public CsisClient { callbacks_->OnConnectionState(evt.remote_bda, ConnectionState::DISCONNECTED); DoDisconnectCleanUp(device); StartOpportunisticConnect(evt.remote_bda); return; } Loading system/bta/csis/csis_client_test.cc +32 −7 Original line number Diff line number Diff line Loading @@ -580,9 +580,10 @@ class CsisClientTest : public ::testing::Test { gatt_callback(BTA_GATTC_ENC_CMPL_CB_EVT, (tBTA_GATTC*)&event_data); } void InjectConnectedEvent(const RawAddress& address, uint16_t conn_id) { void InjectConnectedEvent(const RawAddress& address, uint16_t conn_id, tGATT_STATUS status = GATT_SUCCESS) { tBTA_GATTC_OPEN event_data = { .status = GATT_SUCCESS, .status = status, .conn_id = conn_id, .client_if = gatt_if, .remote_bda = address, Loading Loading @@ -760,6 +761,30 @@ TEST_F(CsisClientTest, test_connect) { TestAppUnregister(); } TEST_F(CsisClientTest, test_verify_opportunistic_connect_active_after_connect_timeout) { TestAppRegister(); std::vector<uint8_t> no_set_info; DeviceGroups::AddFromStorage(test_address, no_set_info); CsisClient::AddFromStorage(test_address, no_set_info); Mock::VerifyAndClearExpectations(&gatt_interface); Mock::VerifyAndClearExpectations(callbacks.get()); EXPECT_CALL(*callbacks, OnConnectionState(test_address, ConnectionState::DISCONNECTED)).Times(1); TestConnect(test_address); EXPECT_CALL(gatt_interface, CancelOpen(gatt_if, test_address, _)).Times(0); EXPECT_CALL(gatt_interface, Open(gatt_if, test_address, BTM_BLE_DIRECT_CONNECTION, true)) .Times(1); InjectConnectedEvent(test_address, 0, GATT_ERROR); Mock::VerifyAndClearExpectations(&gatt_interface); Mock::VerifyAndClearExpectations(callbacks.get()); TestAppUnregister(); } TEST_F(CsisClientTest, test_disconnect_non_connected) { TestAppRegister(); TestConnect(test_address); Loading system/bta/vc/vc.cc +1 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,7 @@ class VolumeControlImpl : public VolumeControl { if (status != GATT_SUCCESS) { log::info("Failed to connect to Volume Control device"); device_cleanup_helper(device, device->connecting_actively); StartOpportunisticConnect(address); return; } Loading system/bta/vc/vc_test.cc +27 −7 Original line number Diff line number Diff line Loading @@ -422,9 +422,10 @@ class VolumeControlTest : public ::testing::Test { TestAppUnregister(); } void GetConnectedEvent(const RawAddress& address, uint16_t conn_id) { void GetConnectedEvent(const RawAddress& address, uint16_t conn_id, tGATT_STATUS status = GATT_SUCCESS) { tBTA_GATTC_OPEN event_data = { .status = GATT_SUCCESS, .status = status, .conn_id = conn_id, .client_if = gatt_if, .remote_bda = address, Loading Loading @@ -650,6 +651,25 @@ TEST_F(VolumeControlTest, test_reconnect_after_interrupted_discovery) { TestAppUnregister(); } TEST_F(VolumeControlTest, test_verify_opportunistic_connect_active_after_connect_timeout) { const RawAddress address = GetTestAddress(0); TestAppRegister(); TestAddFromStorage(address); Mock::VerifyAndClearExpectations(&gatt_interface); EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::DISCONNECTED, address)).Times(1); TestConnect(address); EXPECT_CALL(gatt_interface, CancelOpen(gatt_if, address, _)).Times(0); EXPECT_CALL(gatt_interface, Open(gatt_if, address, BTM_BLE_DIRECT_CONNECTION, true)).Times(1); GetConnectedEvent(address, 1, GATT_ERROR); Mock::VerifyAndClearExpectations(callbacks.get()); Mock::VerifyAndClearExpectations(&gatt_interface); TestAppUnregister(); } TEST_F(VolumeControlTest, test_reconnect_after_timeout) { const RawAddress address = GetTestAddress(0); Loading Loading
system/bta/csis/csis_client.cc +1 −0 Original line number Diff line number Diff line Loading @@ -1956,6 +1956,7 @@ class CsisClientImpl : public CsisClient { callbacks_->OnConnectionState(evt.remote_bda, ConnectionState::DISCONNECTED); DoDisconnectCleanUp(device); StartOpportunisticConnect(evt.remote_bda); return; } Loading
system/bta/csis/csis_client_test.cc +32 −7 Original line number Diff line number Diff line Loading @@ -580,9 +580,10 @@ class CsisClientTest : public ::testing::Test { gatt_callback(BTA_GATTC_ENC_CMPL_CB_EVT, (tBTA_GATTC*)&event_data); } void InjectConnectedEvent(const RawAddress& address, uint16_t conn_id) { void InjectConnectedEvent(const RawAddress& address, uint16_t conn_id, tGATT_STATUS status = GATT_SUCCESS) { tBTA_GATTC_OPEN event_data = { .status = GATT_SUCCESS, .status = status, .conn_id = conn_id, .client_if = gatt_if, .remote_bda = address, Loading Loading @@ -760,6 +761,30 @@ TEST_F(CsisClientTest, test_connect) { TestAppUnregister(); } TEST_F(CsisClientTest, test_verify_opportunistic_connect_active_after_connect_timeout) { TestAppRegister(); std::vector<uint8_t> no_set_info; DeviceGroups::AddFromStorage(test_address, no_set_info); CsisClient::AddFromStorage(test_address, no_set_info); Mock::VerifyAndClearExpectations(&gatt_interface); Mock::VerifyAndClearExpectations(callbacks.get()); EXPECT_CALL(*callbacks, OnConnectionState(test_address, ConnectionState::DISCONNECTED)).Times(1); TestConnect(test_address); EXPECT_CALL(gatt_interface, CancelOpen(gatt_if, test_address, _)).Times(0); EXPECT_CALL(gatt_interface, Open(gatt_if, test_address, BTM_BLE_DIRECT_CONNECTION, true)) .Times(1); InjectConnectedEvent(test_address, 0, GATT_ERROR); Mock::VerifyAndClearExpectations(&gatt_interface); Mock::VerifyAndClearExpectations(callbacks.get()); TestAppUnregister(); } TEST_F(CsisClientTest, test_disconnect_non_connected) { TestAppRegister(); TestConnect(test_address); Loading
system/bta/vc/vc.cc +1 −0 Original line number Diff line number Diff line Loading @@ -172,6 +172,7 @@ class VolumeControlImpl : public VolumeControl { if (status != GATT_SUCCESS) { log::info("Failed to connect to Volume Control device"); device_cleanup_helper(device, device->connecting_actively); StartOpportunisticConnect(address); return; } Loading
system/bta/vc/vc_test.cc +27 −7 Original line number Diff line number Diff line Loading @@ -422,9 +422,10 @@ class VolumeControlTest : public ::testing::Test { TestAppUnregister(); } void GetConnectedEvent(const RawAddress& address, uint16_t conn_id) { void GetConnectedEvent(const RawAddress& address, uint16_t conn_id, tGATT_STATUS status = GATT_SUCCESS) { tBTA_GATTC_OPEN event_data = { .status = GATT_SUCCESS, .status = status, .conn_id = conn_id, .client_if = gatt_if, .remote_bda = address, Loading Loading @@ -650,6 +651,25 @@ TEST_F(VolumeControlTest, test_reconnect_after_interrupted_discovery) { TestAppUnregister(); } TEST_F(VolumeControlTest, test_verify_opportunistic_connect_active_after_connect_timeout) { const RawAddress address = GetTestAddress(0); TestAppRegister(); TestAddFromStorage(address); Mock::VerifyAndClearExpectations(&gatt_interface); EXPECT_CALL(*callbacks, OnConnectionState(ConnectionState::DISCONNECTED, address)).Times(1); TestConnect(address); EXPECT_CALL(gatt_interface, CancelOpen(gatt_if, address, _)).Times(0); EXPECT_CALL(gatt_interface, Open(gatt_if, address, BTM_BLE_DIRECT_CONNECTION, true)).Times(1); GetConnectedEvent(address, 1, GATT_ERROR); Mock::VerifyAndClearExpectations(callbacks.get()); Mock::VerifyAndClearExpectations(&gatt_interface); TestAppUnregister(); } TEST_F(VolumeControlTest, test_reconnect_after_timeout) { const RawAddress address = GetTestAddress(0); Loading