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

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

Remove unused events in acl manager

Bug: 143697964
Test: Boots into gd without crashing
Change-Id: I344ef68cde2221b4d526c1fe347c92758f22b80a
parent 2461fd9c
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -85,15 +85,8 @@ struct AclManager::impl {
    hci_layer_->RegisterEventHandler(EventCode::CONNECTION_PACKET_TYPE_CHANGED,
                                     Bind(&impl::on_connection_packet_type_changed, common::Unretained(this)),
                                     handler_);
    hci_layer_->RegisterEventHandler(EventCode::MASTER_LINK_KEY_COMPLETE,
                                     Bind(&impl::on_master_link_key_complete, common::Unretained(this)), handler_);
    hci_layer_->RegisterEventHandler(EventCode::AUTHENTICATION_COMPLETE,
                                     Bind(&impl::on_authentication_complete, common::Unretained(this)), handler_);
    hci_layer_->RegisterEventHandler(EventCode::ENCRYPTION_CHANGE,
                                     Bind(&impl::on_encryption_change, common::Unretained(this)), handler_);
    hci_layer_->RegisterEventHandler(EventCode::CHANGE_CONNECTION_LINK_KEY_COMPLETE,
                                     Bind(&impl::on_change_connection_link_key_complete, common::Unretained(this)),
                                     handler_);
    hci_layer_->RegisterEventHandler(EventCode::READ_CLOCK_OFFSET_COMPLETE,
                                     Bind(&impl::on_read_clock_offset_complete, common::Unretained(this)), handler_);
    hci_layer_->RegisterEventHandler(EventCode::MODE_CHANGE, Bind(&impl::on_mode_change, common::Unretained(this)),
+0 −33
Original line number Diff line number Diff line
@@ -676,17 +676,6 @@ TEST_F(AclManagerTest, acl_send_data_credits) {
  connection->Disconnect(DisconnectReason::AUTHENTICATION_FAILURE);
}

TEST_F(AclManagerWithConnectionTest, send_master_link_key) {
  acl_manager_->MasterLinkKey(KeyFlag::TEMPORARY);
  auto packet = test_hci_layer_->GetCommandPacket(OpCode::MASTER_LINK_KEY);
  auto command_view = MasterLinkKeyView::Create(packet);
  ASSERT(command_view.IsValid());
  EXPECT_EQ(command_view.GetKeyFlag(), KeyFlag::TEMPORARY);

  EXPECT_CALL(mock_acl_manager_callbacks_, OnMasterLinkKeyComplete(0x123, KeyFlag::TEMPORARY));
  test_hci_layer_->IncomingEvent(MasterLinkKeyCompleteBuilder::Create(ErrorCode::SUCCESS, 0x123, KeyFlag::TEMPORARY));
}

TEST_F(AclManagerWithConnectionTest, send_switch_role) {
  acl_manager_->SwitchRole(connection_->GetAddress(), Role::SLAVE);
  auto packet = test_hci_layer_->GetCommandPacket(OpCode::SWITCH_ROLE);
@@ -744,28 +733,6 @@ TEST_F(AclManagerWithConnectionTest, send_authentication_requested) {
  test_hci_layer_->IncomingEvent(AuthenticationCompleteBuilder::Create(ErrorCode::SUCCESS, handle_));
}

TEST_F(AclManagerWithConnectionTest, send_set_connection_encryption) {
  connection_->SetConnectionEncryption(Enable::ENABLED);
  auto packet = test_hci_layer_->GetCommandPacket(OpCode::SET_CONNECTION_ENCRYPTION);
  auto command_view = SetConnectionEncryptionView::Create(packet);
  ASSERT(command_view.IsValid());
  EXPECT_EQ(command_view.GetEncryptionEnable(), Enable::ENABLED);

  EXPECT_CALL(mock_connection_management_callbacks_, OnEncryptionChange(EncryptionEnabled::BR_EDR_AES_CCM));
  test_hci_layer_->IncomingEvent(
      EncryptionChangeBuilder::Create(ErrorCode::SUCCESS, handle_, EncryptionEnabled::BR_EDR_AES_CCM));
}

TEST_F(AclManagerWithConnectionTest, send_change_connection_link_key) {
  connection_->ChangeConnectionLinkKey();
  auto packet = test_hci_layer_->GetCommandPacket(OpCode::CHANGE_CONNECTION_LINK_KEY);
  auto command_view = ChangeConnectionLinkKeyView::Create(packet);
  ASSERT(command_view.IsValid());

  EXPECT_CALL(mock_connection_management_callbacks_, OnChangeConnectionLinkKeyComplete);
  test_hci_layer_->IncomingEvent(ChangeConnectionLinkKeyCompleteBuilder::Create(ErrorCode::SUCCESS, handle_));
}

TEST_F(AclManagerWithConnectionTest, send_read_clock_offset) {
  connection_->ReadClockOffset();
  auto packet = test_hci_layer_->GetCommandPacket(OpCode::READ_CLOCK_OFFSET);