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

Commit 401876cd authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Remove unused events in acl manager"

parents bb8e74d7 b8c5940d
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);