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

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

stack::btm::get_btm_client_interface: Populate mock defaults

Bug: 343776940
Test: m .
Flag: EXEMPT, Test Infrastructure
Change-Id: I1d90ea9b6c5114bd2a1acecadee275f0e577451a
parent ea5ee524
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -546,6 +546,7 @@ cc_test {
        ":TestCommonMockFunctions",
        ":TestMockBtif",
        ":TestMockMainShimLeScanning",
        ":TestMockStackBtmInterface",
        "csis/csis_client.cc",
        "csis/csis_client_test.cc",
        "gatt/database.cc",
@@ -883,6 +884,7 @@ cc_test {
        ":TestMockBtaLeAudioHalVerifier",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackBtmInterface",
        ":TestMockStackBtmIso",
        ":TestMockStackL2cap",
        ":TestStubOsi",
@@ -981,6 +983,7 @@ cc_test {
        ":TestMockBtaLeAudioHalVerifier",
        ":TestMockMainShim",
        ":TestMockMainShimEntry",
        ":TestMockStackBtmInterface",
        ":TestMockStackBtmIso",
        ":TestMockStackL2cap",
        ":TestStubOsi",
+1 −1
Original line number Diff line number Diff line
@@ -19,9 +19,9 @@
#include <base/strings/stringprintf.h>
#include <bluetooth/log.h>

#include <queue>
#include <string>

#include "bta/include/bta_api.h"
#include "macros.h"
#include "stack/btm/neighbor_inquiry.h"
#include "types/raw_address.h"
+15 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@
#include "test/mock/mock_main_shim_entry.h"
#include "test/mock/mock_osi_alarm.h"
#include "test/mock/mock_stack_acl.h"
#include "test/mock/mock_stack_btm_interface.h"

#define TEST_BT com::android::bluetooth::flags

@@ -292,6 +293,13 @@ TEST_F_WITH_FLAGS(BtaAgCmdTest, at_hfp_cback__qcs_ev_codec_disabled,
TEST_F_WITH_FLAGS(BtaAgCmdTest, at_hfp_cback__qcs_ev_codec_q0_enabled,
                  REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(TEST_BT,
                                                      hfp_codec_aptx_voice))) {
  reset_mock_btm_client_interface();
  mock_btm_client_interface.sco.BTM_SetEScoMode =
      [](enh_esco_params_t* p_parms) -> tBTM_STATUS {
    inc_func_call_count("BTM_SetEScoMode");
    return BTM_SUCCESS;
  };

  tBTA_AG_SCB p_scb = {.peer_addr = addr,
                       .sco_idx = BTM_INVALID_SCO_INDEX,
                       .app_id = 0,
@@ -322,6 +330,13 @@ TEST_F_WITH_FLAGS(BtaAgCmdTest,
                  handle_swb_at_event__qcs_ev_codec_q1_fallback_to_q0,
                  REQUIRES_FLAGS_ENABLED(ACONFIG_FLAG(TEST_BT,
                                                      hfp_codec_aptx_voice))) {
  reset_mock_btm_client_interface();
  mock_btm_client_interface.sco.BTM_SetEScoMode =
      [](enh_esco_params_t* p_parms) -> tBTM_STATUS {
    inc_func_call_count("BTM_SetEScoMode");
    return BTM_SUCCESS;
  };

  tBTA_AG_SCB p_scb = {.peer_addr = addr,
                       .sco_idx = BTM_INVALID_SCO_INDEX,
                       .app_id = 0,
+6 −3
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@

#include <string>

#include "bta/dm/bta_dm_device_search.h"
#include "bta/dm/bta_dm_device_search_int.h"
#include "bta/dm/bta_dm_disc.h"
#include "bta/dm/bta_dm_int.h"
@@ -33,8 +32,6 @@
#include "bta/hf_client/bta_hf_client_int.h"
#include "bta/include/bta_api.h"
#include "bta/test/bta_test_fixtures.h"
#include "osi/include/compat.h"
#include "osi/include/osi.h"
#include "stack/include/btm_status.h"
#include "test/common/main_handler.h"
#include "test/common/mock_functions.h"
@@ -448,6 +445,12 @@ TEST_F(BtaDmTest, bta_dm_search_evt_text) {
}

TEST_F(BtaDmTest, bta_dm_remote_name_cmpl) {
  reset_mock_btm_client_interface();
  mock_btm_client_interface.db.BTM_InqDbRead =
      [](const RawAddress& bd_addr) -> tBTM_INQ_INFO* {
    inc_func_call_count("BTM_InqDbRead");
    return nullptr;
  };
  tBTA_DM_REMOTE_NAME remote_name_msg{
      // tBTA_DM_REMOTE_NAME
      .bd_addr = kRawAddress,
+3 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include "bta/dm/bta_dm_sec_int.h"
#include "bta/test/bta_test_fixtures.h"
#include "btm_status.h"
#include "test/mock/mock_stack_btm_inq.h"
#include "test/mock/mock_stack_btm_interface.h"
#include "types/raw_address.h"
@@ -106,7 +107,8 @@ TEST_F(BtaSecTest, bta_dm_sp_cback__BTM_SP_CFM_REQ_EVT_WithName) {
TEST_F(BtaSecTest, bta_dm_sp_cback__BTM_SP_CFM_REQ_EVT_WithoutName_RNRSuccess) {
  constexpr uint32_t kNumVal = 1234;
  static bool callback_sent = false;
  test::mock::stack_btm_inq::BTM_ReadRemoteDeviceName.body =
  reset_mock_btm_client_interface();
  mock_btm_client_interface.peer.BTM_ReadRemoteDeviceName =
      [](const RawAddress& remote_bda, tBTM_NAME_CMPL_CB* p_cb,
         tBT_TRANSPORT transport) -> tBTM_STATUS { return BTM_CMD_STARTED; };

Loading