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

Commit 60277a09 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Add stack::test::btm::stack_back_test::InformBtmOnConnection am: 341d6123

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1512841

Change-Id: Idbd85adaae1f8d6c4adda3e79748021177ceda62
parents 9ea633b9 341d6123
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include "osi/include/osi.h"
#include "stack/btm/btm_int.h"
#include "stack/btm/btm_int_types.h"
#include "stack/include/acl_hci_link_interface.h"
#include "types/raw_address.h"

base::MessageLoop* get_main_message_loop() { return nullptr; }

@@ -67,6 +69,8 @@ const stack_config_t* stack_config_get_interface(void) {

std::map<std::string, int> mock_function_count_map;

bool MOCK_bluetooth_shim_is_gd_acl_enabled_;

namespace {

using testing::_;
@@ -97,4 +101,18 @@ TEST_F(StackBtmTest, DynamicLifecycle) {
  delete btm;
}

TEST_F(StackBtmTest, InformBtmOnConnection) {
  MOCK_bluetooth_shim_is_gd_acl_enabled_ = true;

  btm_init();

  RawAddress bda({0x11, 0x22, 0x33, 0x44, 0x55, 0x66});

  btm_acl_connected(bda, 2, HCI_SUCCESS, false);
  ASSERT_EQ(static_cast<size_t>(1),
            mock_function_count_map.count("BTA_dm_acl_up"));

  btm_free();
}

}  // namespace
+3 −1
Original line number Diff line number Diff line
@@ -34,13 +34,15 @@ extern std::map<std::string, int> mock_function_count_map;
#define UNUSED_ATTR
#endif

extern bool MOCK_bluetooth_shim_is_gd_acl_enabled_;

bool bluetooth::shim::is_any_gd_enabled() {
  mock_function_count_map[__func__]++;
  return false;
}
bool bluetooth::shim::is_gd_acl_enabled() {
  mock_function_count_map[__func__]++;
  return false;
  return MOCK_bluetooth_shim_is_gd_acl_enabled_;
}
bool bluetooth::shim::is_gd_advertising_enabled() {
  mock_function_count_map[__func__]++;