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

Commit 0a69a824 authored by Chris Manton's avatar Chris Manton
Browse files

Test stack/acl/btm_acl::on_acl_br_edr_{success,failed}

Try not to re-converge divergent code paths

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working

Change-Id: Ic8a795369972bb38e5ab9bb51c9e735c382680e4
parent 7af046d2
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -87,7 +87,7 @@ using testing::Test;
class StackBtmTest : public Test {
 public:
 protected:
  void SetUp() override {}
  void SetUp() override { mock_function_count_map.clear(); }
  void TearDown() override {}
};

@@ -101,7 +101,7 @@ TEST_F(StackBtmTest, DynamicLifecycle) {
  delete btm;
}

TEST_F(StackBtmTest, InformBtmOnConnection) {
TEST_F(StackBtmTest, InformClientOnConnectionSuccess) {
  MOCK_bluetooth_shim_is_gd_acl_enabled_ = true;

  get_btm_client_interface().lifecycle.btm_init();
@@ -115,4 +115,18 @@ TEST_F(StackBtmTest, InformBtmOnConnection) {
  get_btm_client_interface().lifecycle.btm_free();
}

TEST_F(StackBtmTest, NoInformClientOnConnectionFail) {
  MOCK_bluetooth_shim_is_gd_acl_enabled_ = true;

  get_btm_client_interface().lifecycle.btm_init();

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

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

  get_btm_client_interface().lifecycle.btm_free();
}

}  // namespace