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

Commit a4a52e1d authored by David Duarte's avatar David Duarte
Browse files

GD: Use gtest ASSERT in SetCommandFuture

Test: None
Change-Id: Ic3add8e1925ab4b1deddd32ae9fe23a2edb3e1a6
parent 2749dae5
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -297,7 +297,7 @@ class TestHciLayer : public HciLayer {
  }

  void SetCommandFuture() {
    ASSERT_LOG(command_promise_ == nullptr, "Promises, Promises, ... Only one at a time.");
    ASSERT_EQ(command_promise_, nullptr) << "Promises, Promises, ... Only one at a time.";
    command_promise_ = std::make_unique<std::promise<void>>();
    command_future_ = std::make_unique<std::future<void>>(command_promise_->get_future());
  }
@@ -447,7 +447,7 @@ class LeImplTest : public ::testing::Test {

  void set_random_device_address_policy() {
    // Set address policy
    hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
    hci::Address address;
    Address::FromString("D0:05:04:03:02:01", address);
    hci::AddressWithType address_with_type(address, hci::AddressType::RANDOM_DEVICE_ADDRESS);
@@ -649,11 +649,11 @@ TEST_F(LeImplTest, connection_complete_with_periperal_role) {
  set_random_device_address_policy();

  // Create connection
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  le_impl_->create_le_connection(
      {{0x21, 0x22, 0x23, 0x24, 0x25, 0x26}, AddressType::PUBLIC_DEVICE_ADDRESS}, true, false);
  hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  hci_layer_->CommandCompleteCallback(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
  hci_layer_->CommandStatusCallback(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
@@ -688,11 +688,11 @@ TEST_F(LeImplTest, enhanced_connection_complete_with_periperal_role) {

  controller_->AddSupported(OpCode::LE_EXTENDED_CREATE_CONNECTION);
  // Create connection
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  le_impl_->create_le_connection(
      {{0x21, 0x22, 0x23, 0x24, 0x25, 0x26}, AddressType::PUBLIC_DEVICE_ADDRESS}, true, false);
  hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  hci_layer_->CommandCompleteCallback(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  hci_layer_->GetCommand(OpCode::LE_EXTENDED_CREATE_CONNECTION);
  hci_layer_->CommandStatusCallback(LeExtendedCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
@@ -731,10 +731,10 @@ TEST_F(LeImplTest, connection_complete_with_central_role) {
  Address::FromString("D0:05:04:03:02:01", remote_address);
  hci::AddressWithType address_with_type(remote_address, hci::AddressType::PUBLIC_DEVICE_ADDRESS);
  // Create connection
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  le_impl_->create_le_connection(address_with_type, true, false);
  hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  hci_layer_->CommandCompleteCallback(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
  hci_layer_->CommandStatusCallback(LeCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
@@ -769,10 +769,10 @@ TEST_F(LeImplTest, enhanced_connection_complete_with_central_role) {
  Address::FromString("D0:05:04:03:02:01", remote_address);
  hci::AddressWithType address_with_type(remote_address, hci::AddressType::PUBLIC_DEVICE_ADDRESS);
  // Create connection
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  le_impl_->create_le_connection(address_with_type, true, false);
  hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(hci_layer_->SetCommandFuture());
  hci_layer_->CommandCompleteCallback(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  hci_layer_->GetCommand(OpCode::LE_EXTENDED_CREATE_CONNECTION);
  hci_layer_->CommandStatusCallback(LeExtendedCreateConnectionStatusBuilder::Create(ErrorCode::SUCCESS, 0x01));
+9 −8
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ class RoundRobinSchedulerTest : public ::testing::Test {
  }

  void SetPacketFuture(uint16_t count) {
    ASSERT_LOG(packet_promise_ == nullptr, "Promises, Promises, ... Only one at a time.");
    ASSERT_EQ(packet_promise_, nullptr) << "Promises, Promises, ... Only one at a time.";
    packet_count_ = count;
    packet_promise_ = std::make_unique<std::promise<void>>();
    packet_future_ = std::make_unique<std::future<void>>(packet_promise_->get_future());
@@ -186,7 +186,7 @@ TEST_F(RoundRobinSchedulerTest, buffer_packet) {
  auto connection_queue = std::make_shared<AclConnection::Queue>(10);
  round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::CLASSIC, handle, connection_queue);

  SetPacketFuture(2);
  ASSERT_NO_FATAL_FAILURE(SetPacketFuture(2));
  AclConnection::QueueUpEnd* queue_up_end = connection_queue->GetUpEnd();
  std::vector<uint8_t> packet1 = {0x01, 0x02, 0x03};
  std::vector<uint8_t> packet2 = {0x04, 0x05, 0x06};
@@ -210,7 +210,7 @@ TEST_F(RoundRobinSchedulerTest, buffer_packet_from_two_connections) {
  round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::CLASSIC, handle, connection_queue);
  round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::LE, le_handle, le_connection_queue);

  SetPacketFuture(2);
  ASSERT_NO_FATAL_FAILURE(SetPacketFuture(2));
  AclConnection::QueueUpEnd* queue_up_end = connection_queue->GetUpEnd();
  AclConnection::QueueUpEnd* le_queue_up_end = le_connection_queue->GetUpEnd();
  std::vector<uint8_t> packet = {0x01, 0x02, 0x03};
@@ -233,7 +233,7 @@ TEST_F(RoundRobinSchedulerTest, do_not_register_when_credits_is_zero) {
  auto connection_queue = std::make_shared<AclConnection::Queue>(15);
  round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::CLASSIC, handle, connection_queue);

  SetPacketFuture(10);
  ASSERT_NO_FATAL_FAILURE(SetPacketFuture(10));
  AclConnection::QueueUpEnd* queue_up_end = connection_queue->GetUpEnd();
  for (uint8_t i = 0; i < 15; i++) {
    std::vector<uint8_t> packet = {0x01, 0x02, 0x03, i};
@@ -247,7 +247,7 @@ TEST_F(RoundRobinSchedulerTest, do_not_register_when_credits_is_zero) {
  }
  ASSERT_EQ(round_robin_scheduler_->GetCredits(), 0);

  SetPacketFuture(5);
  ASSERT_NO_FATAL_FAILURE(SetPacketFuture(5));
  controller_->SendCompletedAclPacketsCallback(0x01, 10);
  sync_handler();
  packet_future_->wait();
@@ -277,7 +277,7 @@ TEST_F(RoundRobinSchedulerTest, buffer_packet_intervally) {
  auto le_connection_queue1 = std::make_shared<AclConnection::Queue>(10);
  auto le_connection_queue2 = std::make_shared<AclConnection::Queue>(10);

  SetPacketFuture(18);
  ASSERT_NO_FATAL_FAILURE(SetPacketFuture(18));
  AclConnection::QueueUpEnd* queue_up_end1 = connection_queue1->GetUpEnd();
  AclConnection::QueueUpEnd* queue_up_end2 = connection_queue2->GetUpEnd();
  AclConnection::QueueUpEnd* le_queue_up_end1 = le_connection_queue1->GetUpEnd();
@@ -334,7 +334,7 @@ TEST_F(RoundRobinSchedulerTest, send_fragments_without_interval) {
  round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::CLASSIC, handle, connection_queue);
  round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::LE, le_handle, le_connection_queue);

  SetPacketFuture(5);
  ASSERT_NO_FATAL_FAILURE(SetPacketFuture(5));
  AclConnection::QueueUpEnd* queue_up_end = connection_queue->GetUpEnd();
  AclConnection::QueueUpEnd* le_queue_up_end = le_connection_queue->GetUpEnd();
  std::vector<uint8_t> packet(controller_->hci_mtu_, 0xff);
@@ -380,7 +380,8 @@ TEST_F(RoundRobinSchedulerTest, receive_le_credit_when_next_fragment_is_classic)
  round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::CLASSIC, handle, connection_queue);
  round_robin_scheduler_->Register(RoundRobinScheduler::ConnectionType::LE, le_handle, le_connection_queue);

  SetPacketFuture(controller_->le_max_acl_packet_credits_ + controller_->max_acl_packet_credits_);
  ASSERT_NO_FATAL_FAILURE(
      SetPacketFuture(controller_->le_max_acl_packet_credits_ + controller_->max_acl_packet_credits_));
  AclConnection::QueueUpEnd* queue_up_end = connection_queue->GetUpEnd();
  AclConnection::QueueUpEnd* le_queue_up_end = le_connection_queue->GetUpEnd();
  std::vector<uint8_t> huge_packet(2000);
+57 −57

File changed.

Preview size limit exceeded, changes collapsed.

+5 −5
Original line number Diff line number Diff line
@@ -146,7 +146,7 @@ class TestHciLayer : public HciLayer {
  }

  void SetCommandFuture() {
    ASSERT_TRUE(hci_command_promise_ == nullptr) << "Promises, Promises, ... Only one at a time.";
    ASSERT_EQ(hci_command_promise_, nullptr) << "Promises, Promises, ... Only one at a time.";
    hci_command_promise_ = std::make_unique<std::promise<void>>();
    command_future_ = std::make_unique<std::future<void>>(hci_command_promise_->get_future());
  }
@@ -641,11 +641,11 @@ class AclManagerWithLeConnectionTest : public AclManagerWithCallbacksTest {

    Address remote_public_address = Address::FromString(kRemotePublicDeviceStringA).value();
    remote_with_type_ = AddressWithType(remote_public_address, AddressType::PUBLIC_DEVICE_ADDRESS);
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    acl_manager_->CreateLeConnection(remote_with_type_, true);
    test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
    test_hci_layer_->SendIncomingEvent(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_CREATE_CONNECTION);
    auto le_connection_management_command_view =
        LeConnectionManagementCommandView::Create(AclCommandView::Create(packet));
@@ -674,7 +674,7 @@ class AclManagerWithLeConnectionTest : public AclManagerWithCallbacksTest {
        0x0C80,
        ClockAccuracy::PPM_30));

    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    test_hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_FILTER_ACCEPT_LIST);
    test_hci_layer_->SendIncomingEvent(
        LeRemoveDeviceFromFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
@@ -732,7 +732,7 @@ class AclManagerWithResolvableAddressTest : public AclManagerWithCallbacksTest {
    fake_registry_.InjectTestModule(&Controller::Factory, test_controller_);
    client_handler_ = fake_registry_.GetTestModuleHandler(&HciLayer::Factory);
    ASSERT_NE(client_handler_, nullptr);
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    fake_registry_.Start<AclManager>(&thread_);
    acl_manager_ = static_cast<AclManager*>(fake_registry_.GetModuleUnderTest(&AclManager::Factory));
    hci::Address address;
+26 −26
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ class TestHciLayer : public HciLayer {
  }

  void SetCommandFuture() {
    ASSERT_LOG(command_promise_ == nullptr, "Promises, Promises, ... Only one at a time.");
    ASSERT_EQ(command_promise_, nullptr) << "Promises, Promises, ... Only one at a time.";
    command_promise_ = std::make_unique<std::promise<void>>();
    command_future_ = std::make_unique<std::future<void>>(command_promise_->get_future());
  }
@@ -227,7 +227,7 @@ TEST_F(LeAddressManagerTest, rotator_address_for_single_client) {
      minimum_rotation_time,
      maximum_rotation_time);

  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->Register(clients[0].get());
  sync_handler(handler_);
  test_hci_layer_->GetCommand(OpCode::LE_SET_RANDOM_ADDRESS);
@@ -250,7 +250,7 @@ TEST_F(LeAddressManagerTest, rotator_non_resolvable_address_for_single_client) {
      minimum_rotation_time,
      maximum_rotation_time);

  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->Register(clients[0].get());
  sync_handler(handler_);
  test_hci_layer_->GetCommand(OpCode::LE_SET_RANDOM_ADDRESS);
@@ -313,7 +313,7 @@ class LeAddressManagerWithSingleClientTest : public LeAddressManagerTest {
        minimum_rotation_time,
        maximum_rotation_time);

    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    le_address_manager_->Register(clients[0].get());
    sync_handler(handler_);
    test_hci_layer_->GetCommand(OpCode::LE_SET_RANDOM_ADDRESS);
@@ -340,7 +340,7 @@ class LeAddressManagerWithSingleClientTest : public LeAddressManagerTest {
TEST_F(LeAddressManagerWithSingleClientTest, add_device_to_connect_list) {
  Address address;
  Address::FromString("01:02:03:04:05:06", address);
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->AddDeviceToFilterAcceptList(FilterAcceptListAddressType::RANDOM, address);
  auto packet = test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  auto packet_view = LeAddDeviceToFilterAcceptListView::Create(
@@ -356,12 +356,12 @@ TEST_F(LeAddressManagerWithSingleClientTest, add_device_to_connect_list) {
TEST_F(LeAddressManagerWithSingleClientTest, remove_device_from_connect_list) {
  Address address;
  Address::FromString("01:02:03:04:05:06", address);
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->AddDeviceToFilterAcceptList(FilterAcceptListAddressType::RANDOM, address);
  test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  test_hci_layer_->IncomingEvent(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));

  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->RemoveDeviceFromFilterAcceptList(FilterAcceptListAddressType::RANDOM, address);
  auto packet = test_hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_FILTER_ACCEPT_LIST);
  auto packet_view = LeRemoveDeviceFromFilterAcceptListView::Create(
@@ -376,12 +376,12 @@ TEST_F(LeAddressManagerWithSingleClientTest, remove_device_from_connect_list) {
TEST_F(LeAddressManagerWithSingleClientTest, clear_filter_accept_list) {
  Address address;
  Address::FromString("01:02:03:04:05:06", address);
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->AddDeviceToFilterAcceptList(FilterAcceptListAddressType::RANDOM, address);
  test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  test_hci_layer_->IncomingEvent(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));

  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->ClearFilterAcceptList();
  test_hci_layer_->GetCommand(OpCode::LE_CLEAR_FILTER_ACCEPT_LIST);
  test_hci_layer_->IncomingEvent(LeClearFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
@@ -395,7 +395,7 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_add_device_to_resolving_li
  Octet16 peer_irk = {0xec, 0x02, 0x34, 0xa3, 0x57, 0xc8, 0xad, 0x05, 0x34, 0x10, 0x10, 0xa6, 0x0a, 0x39, 0x7d, 0x9b};
  Octet16 local_irk = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10};

  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->AddDeviceToResolvingList(
      PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS, address, peer_irk, local_irk);
  {
@@ -406,7 +406,7 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_add_device_to_resolving_li
    test_hci_layer_->IncomingEvent(LeSetAddressResolutionEnableCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  }
  {
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_RESOLVING_LIST);
    auto packet_view = LeAddDeviceToResolvingListView::Create(LeSecurityCommandView::Create(packet));
    ASSERT_TRUE(packet_view.IsValid());
@@ -417,7 +417,7 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_add_device_to_resolving_li
    test_hci_layer_->IncomingEvent(LeAddDeviceToResolvingListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  }
  {
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
    auto packet_view = LeSetAddressResolutionEnableView::Create(LeSecurityCommandView::Create(packet));
    ASSERT_TRUE(packet_view.IsValid());
@@ -433,19 +433,19 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_remove_device_from_resolvi
  Address::FromString("01:02:03:04:05:06", address);
  Octet16 peer_irk = {0xec, 0x02, 0x34, 0xa3, 0x57, 0xc8, 0xad, 0x05, 0x34, 0x10, 0x10, 0xa6, 0x0a, 0x39, 0x7d, 0x9b};
  Octet16 local_irk = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10};
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->AddDeviceToResolvingList(
      PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS, address, peer_irk, local_irk);
  test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
  test_hci_layer_->IncomingEvent(LeSetAddressResolutionEnableCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_RESOLVING_LIST);
  test_hci_layer_->IncomingEvent(LeAddDeviceToResolvingListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
  test_hci_layer_->IncomingEvent(LeSetAddressResolutionEnableCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));

  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->RemoveDeviceFromResolvingList(PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS, address);
  {
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
@@ -455,7 +455,7 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_remove_device_from_resolvi
    test_hci_layer_->IncomingEvent(LeSetAddressResolutionEnableCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  }
  {
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_REMOVE_DEVICE_FROM_RESOLVING_LIST);
    auto packet_view = LeRemoveDeviceFromResolvingListView::Create(LeSecurityCommandView::Create(packet));
    ASSERT_TRUE(packet_view.IsValid());
@@ -464,7 +464,7 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_remove_device_from_resolvi
    test_hci_layer_->IncomingEvent(LeRemoveDeviceFromResolvingListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  }
  {
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
    auto packet_view = LeSetAddressResolutionEnableView::Create(LeSecurityCommandView::Create(packet));
    ASSERT_TRUE(packet_view.IsValid());
@@ -480,19 +480,19 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_clear_resolving_list) {
  Address::FromString("01:02:03:04:05:06", address);
  Octet16 peer_irk = {0xec, 0x02, 0x34, 0xa3, 0x57, 0xc8, 0xad, 0x05, 0x34, 0x10, 0x10, 0xa6, 0x0a, 0x39, 0x7d, 0x9b};
  Octet16 local_irk = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10};
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->AddDeviceToResolvingList(
      PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS, address, peer_irk, local_irk);
  test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
  test_hci_layer_->IncomingEvent(LeSetAddressResolutionEnableCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_RESOLVING_LIST);
  test_hci_layer_->IncomingEvent(LeAddDeviceToResolvingListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
  test_hci_layer_->IncomingEvent(LeSetAddressResolutionEnableCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));

  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->ClearResolvingList();
  {
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
@@ -502,14 +502,14 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_clear_resolving_list) {
    test_hci_layer_->IncomingEvent(LeSetAddressResolutionEnableCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  }
  {
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_CLEAR_RESOLVING_LIST);
    auto packet_view = LeClearResolvingListView::Create(LeSecurityCommandView::Create(packet));
    ASSERT_TRUE(packet_view.IsValid());
    test_hci_layer_->IncomingEvent(LeClearResolvingListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));
  }
  {
    test_hci_layer_->SetCommandFuture();
    ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
    auto packet = test_hci_layer_->GetCommand(OpCode::LE_SET_ADDRESS_RESOLUTION_ENABLE);
    auto packet_view = LeSetAddressResolutionEnableView::Create(LeSecurityCommandView::Create(packet));
    ASSERT_TRUE(packet_view.IsValid());
@@ -523,7 +523,7 @@ TEST_F(LeAddressManagerWithSingleClientTest, DISABLED_clear_resolving_list) {
TEST_F(LeAddressManagerWithSingleClientTest, register_during_command_complete) {
  Address address;
  Address::FromString("01:02:03:04:05:06", address);
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->AddDeviceToFilterAcceptList(FilterAcceptListAddressType::RANDOM, address);
  auto packet = test_hci_layer_->GetCommand(OpCode::LE_ADD_DEVICE_TO_FILTER_ACCEPT_LIST);
  auto packet_view = LeAddDeviceToFilterAcceptListView::Create(
@@ -534,7 +534,7 @@ TEST_F(LeAddressManagerWithSingleClientTest, register_during_command_complete) {
  test_hci_layer_->IncomingEvent(LeAddDeviceToFilterAcceptListCompleteBuilder::Create(0x01, ErrorCode::SUCCESS));

  AllocateClients(1);
  test_hci_layer_->SetCommandFuture();
  ASSERT_NO_FATAL_FAILURE(test_hci_layer_->SetCommandFuture());
  le_address_manager_->Register(clients[1].get());
  clients[0].get()->WaitForResume();
  clients[1].get()->WaitForResume();
Loading