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

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

mock: [55/63] Remove BTM_SetPowerMode

Use get_btm_client_interface() instead

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

Change-Id: Id96c96494cad9ab05a3931ea52195b7493122e72
parent 01f0bfc2
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -91,19 +91,19 @@ protected:


TEST_F(StackBtmPowerMode, BTM_SetPowerMode__Undefined) {
TEST_F(StackBtmPowerMode, BTM_SetPowerMode__Undefined) {
  tBTM_PM_PWR_MD mode = {};
  tBTM_PM_PWR_MD mode = {};
  ASSERT_EQ(BTM_UNKNOWN_ADDR, BTM_SetPowerMode(pm_id_, kRawAddress, &mode));
  ASSERT_EQ(BTM_UNKNOWN_ADDR, ::BTM_SetPowerMode(pm_id_, kRawAddress, &mode));
}
}


TEST_F(StackBtmPowerModeConnected, BTM_SetPowerMode__AlreadyActive) {
TEST_F(StackBtmPowerModeConnected, BTM_SetPowerMode__AlreadyActive) {
  tBTM_PM_PWR_MD mode = {};
  tBTM_PM_PWR_MD mode = {};
  ASSERT_EQ(BTM_SUCCESS, BTM_SetPowerMode(pm_id_, kRawAddress, &mode));
  ASSERT_EQ(BTM_SUCCESS, ::BTM_SetPowerMode(pm_id_, kRawAddress, &mode));
}
}


TEST_F(StackBtmPowerModeConnected, BTM_SetPowerMode__ActiveToSniff) {
TEST_F(StackBtmPowerModeConnected, BTM_SetPowerMode__ActiveToSniff) {
  tBTM_PM_PWR_MD mode = {
  tBTM_PM_PWR_MD mode = {
          .mode = BTM_PM_MD_SNIFF,
          .mode = BTM_PM_MD_SNIFF,
  };
  };
  ASSERT_EQ("BTM_CMD_STARTED", btm_status_text(BTM_SetPowerMode(pm_id_, kRawAddress, &mode)));
  ASSERT_EQ("BTM_CMD_STARTED", btm_status_text(::BTM_SetPowerMode(pm_id_, kRawAddress, &mode)));
  ASSERT_EQ(1, get_func_call_count("btsnd_hcic_sniff_mode"));
  ASSERT_EQ(1, get_func_call_count("btsnd_hcic_sniff_mode"));


  // Respond with successful command status for mode command
  // Respond with successful command status for mode command
@@ -154,7 +154,7 @@ TEST_F(StackBtmPowerModeConnected, BTM_SetPowerMode__ActiveToSniffTwice) {
  tBTM_PM_PWR_MD mode = {
  tBTM_PM_PWR_MD mode = {
          .mode = BTM_PM_MD_SNIFF,
          .mode = BTM_PM_MD_SNIFF,
  };
  };
  ASSERT_EQ("BTM_CMD_STARTED", btm_status_text(BTM_SetPowerMode(pm_id_, kRawAddress, &mode)));
  ASSERT_EQ("BTM_CMD_STARTED", btm_status_text(::BTM_SetPowerMode(pm_id_, kRawAddress, &mode)));
  ASSERT_EQ(1, get_func_call_count("btsnd_hcic_sniff_mode"));
  ASSERT_EQ(1, get_func_call_count("btsnd_hcic_sniff_mode"));


  // Respond with successful command status for mode command
  // Respond with successful command status for mode command
@@ -180,7 +180,7 @@ TEST_F(StackBtmPowerModeConnected, BTM_SetPowerMode__ActiveToSniffTwice) {
  }
  }


  // Send a second active to sniff command
  // Send a second active to sniff command
  ASSERT_EQ("BTM_CMD_STORED", btm_status_text(BTM_SetPowerMode(pm_id_, kRawAddress, &mode)));
  ASSERT_EQ("BTM_CMD_STORED", btm_status_text(::BTM_SetPowerMode(pm_id_, kRawAddress, &mode)));
  // No command should be issued
  // No command should be issued
  ASSERT_EQ(1, get_func_call_count("btsnd_hcic_sniff_mode"));
  ASSERT_EQ(1, get_func_call_count("btsnd_hcic_sniff_mode"));


+0 −5
Original line number Original line Diff line number Diff line
@@ -54,11 +54,6 @@ uint32_t BTM_PM_ReadBleScanDutyCycle(void) {
  inc_func_call_count(__func__);
  inc_func_call_count(__func__);
  return 0;
  return 0;
}
}
tBTM_STATUS BTM_SetPowerMode(uint8_t /* pm_id */, const RawAddress& /* remote_bda */,
                             const tBTM_PM_PWR_MD* /* p_mode */) {
  inc_func_call_count(__func__);
  return BTM_SUCCESS;
}
tBTM_STATUS BTM_SetSsrParams(const RawAddress& /* remote_bda */, uint16_t /* max_lat */,
tBTM_STATUS BTM_SetSsrParams(const RawAddress& /* remote_bda */, uint16_t /* max_lat */,
                             uint16_t /* min_rmt_to */, uint16_t /* min_loc_to */) {
                             uint16_t /* min_rmt_to */, uint16_t /* min_loc_to */) {
  inc_func_call_count(__func__);
  inc_func_call_count(__func__);