Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e480b53b authored by Chris Manton's avatar Chris Manton
Browse files

mock: [41/63] Remove BTM_ReadRemoteFeatures

Use get_btm_client_interface() instead

Bug: 352129816
Test: m .
Flag: EXEMPT, Test infrastructure

Change-Id: I73d1623f5b4ef8faa77bb00587f65e1b90d7af97
parent 1fa4d9a3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -638,7 +638,7 @@ static void bta_ag_codec_negotiation_timer_cback(void* data) {
 ******************************************************************************/
void bta_ag_codec_negotiate(tBTA_AG_SCB* p_scb) {
  bta_ag_cb.sco.p_curr_scb = p_scb;
  uint8_t* p_rem_feat = BTM_ReadRemoteFeatures(p_scb->peer_addr);
  uint8_t* p_rem_feat = get_btm_client_interface().peer.BTM_ReadRemoteFeatures(p_scb->peer_addr);
  bool sdp_wbs_support = p_scb->peer_sdp_features & BTA_AG_FEAT_WBS_SUPPORT;

  if (p_rem_feat == nullptr) {
+12 −5
Original line number Diff line number Diff line
@@ -351,17 +351,24 @@ TEST_F_WITH_FLAGS(BtaAgCmdTest, handle_swb_at_event__qcs_ev_codec_q1_fallback_to
  ASSERT_TRUE(enable_aptx_voice_property(false));
}

namespace {
uint8_t data[3] = {1, 2, 3};
}  // namespace

class BtaAgScoTest : public BtaAgTest {
protected:
  void SetUp() override {
    BtaAgTest::SetUp();
    test::mock::stack_acl::BTM_ReadRemoteFeatures.body = [this](const RawAddress& addr) {
      return this->data;
    reset_mock_btm_client_interface();
    mock_btm_client_interface.peer.BTM_ReadRemoteFeatures = [](const RawAddress& addr) {
      inc_func_call_count("BTM_ReadRemoteFeatures");
      return data;
    };
  }
  void TearDown() override { BtaAgTest::TearDown(); }

  uint8_t data[3] = {1, 2, 3};
  void TearDown() override {
    reset_mock_btm_client_interface();
    BtaAgTest::TearDown();
  }
};

TEST_F_WITH_FLAGS(BtaAgScoTest, codec_negotiate__aptx_state_on,
+3 −3
Original line number Diff line number Diff line
@@ -1747,7 +1747,7 @@ tBTM_SCO_DEBUG_DUMP BTM_GetScoDebugDump() {
}

bool btm_peer_supports_esco_2m_phy(RawAddress remote_bda) {
  uint8_t* features = BTM_ReadRemoteFeatures(remote_bda);
  uint8_t* features = get_btm_client_interface().peer.BTM_ReadRemoteFeatures(remote_bda);
  if (features == nullptr) {
    log::warn("Checking remote features but remote feature read is incomplete");
    return false;
@@ -1756,7 +1756,7 @@ bool btm_peer_supports_esco_2m_phy(RawAddress remote_bda) {
}

bool btm_peer_supports_esco_3m_phy(RawAddress remote_bda) {
  uint8_t* features = BTM_ReadRemoteFeatures(remote_bda);
  uint8_t* features = get_btm_client_interface().peer.BTM_ReadRemoteFeatures(remote_bda);
  if (features == nullptr) {
    log::warn("Checking remote features but remote feature read is incomplete");
    return false;
@@ -1765,7 +1765,7 @@ bool btm_peer_supports_esco_3m_phy(RawAddress remote_bda) {
}

bool btm_peer_supports_esco_ev3(RawAddress remote_bda) {
  uint8_t* features = BTM_ReadRemoteFeatures(remote_bda);
  uint8_t* features = get_btm_client_interface().peer.BTM_ReadRemoteFeatures(remote_bda);
  if (features == nullptr) {
    log::warn("Checking remote features but remote feature read is incomplete");
    return false;
+0 −5
Original line number Diff line number Diff line
@@ -78,7 +78,6 @@ struct BTM_GetNumAclLinks BTM_GetNumAclLinks;
struct acl_get_supported_packet_types acl_get_supported_packet_types;
struct acl_link_role_from_handle acl_link_role_from_handle;
struct btm_handle_to_acl_index btm_handle_to_acl_index;
struct BTM_ReadRemoteFeatures BTM_ReadRemoteFeatures;
struct BTM_ReadConnectionAddr BTM_ReadConnectionAddr;
struct BTM_RequestPeerSCA BTM_RequestPeerSCA;
struct BTM_acl_after_controller_started BTM_acl_after_controller_started;
@@ -292,10 +291,6 @@ uint8_t btm_handle_to_acl_index(uint16_t hci_handle) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::btm_handle_to_acl_index(hci_handle);
}
uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr) {
  inc_func_call_count(__func__);
  return test::mock::stack_acl::BTM_ReadRemoteFeatures(addr);
}
void BTM_ReadConnectionAddr(const RawAddress& remote_bda, RawAddress& local_conn_addr,
                            tBLE_ADDR_TYPE* p_addr_type, bool ota_address) {
  inc_func_call_count(__func__);
+0 −9
Original line number Diff line number Diff line
@@ -405,15 +405,6 @@ struct btm_handle_to_acl_index {
  uint8_t operator()(uint16_t hci_handle) { return body(hci_handle); }
};
extern struct btm_handle_to_acl_index btm_handle_to_acl_index;
// Name: BTM_ReadRemoteFeatures
// Params: const RawAddress& addr
// Returns: uint8_t*
struct BTM_ReadRemoteFeatures {
  std::function<uint8_t*(const RawAddress& addr)> body{
          [](const RawAddress& /* addr */) { return nullptr; }};
  uint8_t* operator()(const RawAddress& addr) { return body(addr); }
};
extern struct BTM_ReadRemoteFeatures BTM_ReadRemoteFeatures;
// Name: BTM_ReadConnectionAddr
// Params: const RawAddress& remote_bda, RawAddress& local_conn_addr, bool
// ota_address tBLE_ADDR_TYPE* p_addr_type Returns: void