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

Commit 177171f3 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Updates bluetooth hal test to use VtsHalHidlTargetTestBase v3"

parents bfefc5ef b8012eb9
Loading
Loading
Loading
Loading
+54 −53
Original line number Original line Diff line number Diff line
@@ -158,7 +158,7 @@ class BluetoothHidlTest : public ::testing::VtsHalHidlTargetTestBase {


    EXPECT_TRUE(
    EXPECT_TRUE(
        bluetooth_cb->WaitForCallback(kCallbackNameInitializationComplete)
        bluetooth_cb->WaitForCallback(kCallbackNameInitializationComplete)
            .first);
            .no_timeout);


    ASSERT_EQ(initialized, true);
    ASSERT_EQ(initialized, true);
  }
  }
@@ -260,8 +260,8 @@ void BluetoothHidlTest::wait_for_command_complete_event(hidl_vec<uint8_t> cmd) {
  int status_event_count = 0;
  int status_event_count = 0;
  hidl_vec<uint8_t> event;
  hidl_vec<uint8_t> event;
  do {
  do {
    EXPECT_TRUE(
      EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
        bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
                      .no_timeout);
      EXPECT_LT(static_cast<size_t>(0), event_queue.size());
      EXPECT_LT(static_cast<size_t>(0), event_queue.size());
      if (event_queue.size() == 0) {
      if (event_queue.size() == 0) {
          event.resize(0);
          event.resize(0);
@@ -294,7 +294,7 @@ void BluetoothHidlTest::setBufferSizes() {
  bluetooth->sendHciCommand(cmd);
  bluetooth->sendHciCommand(cmd);


  EXPECT_TRUE(
  EXPECT_TRUE(
      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);


  EXPECT_LT(static_cast<size_t>(0), event_queue.size());
  EXPECT_LT(static_cast<size_t>(0), event_queue.size());
  if (event_queue.size() == 0) return;
  if (event_queue.size() == 0) return;
@@ -348,8 +348,8 @@ void BluetoothHidlTest::sendAndCheckHCI(int num_packets) {
    bluetooth->sendHciCommand(cmd);
    bluetooth->sendHciCommand(cmd);


    // Check the loopback of the HCI packet
    // Check the loopback of the HCI packet
    EXPECT_TRUE(
    EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
        bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
                    .no_timeout);
    hidl_vec<uint8_t> event = event_queue.front();
    hidl_vec<uint8_t> event = event_queue.front();
    event_queue.pop();
    event_queue.pop();
    size_t compare_length =
    size_t compare_length =
@@ -385,8 +385,8 @@ void BluetoothHidlTest::sendAndCheckSCO(int num_packets, size_t size,
    bluetooth->sendScoData(sco_vector);
    bluetooth->sendScoData(sco_vector);


    // Check the loopback of the SCO packet
    // Check the loopback of the SCO packet
    EXPECT_TRUE(
    EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameScoEventReceived)
        bluetooth_cb->WaitForCallback(kCallbackNameScoEventReceived).first);
                    .no_timeout);
    hidl_vec<uint8_t> sco_loopback = sco_queue.front();
    hidl_vec<uint8_t> sco_loopback = sco_queue.front();
    sco_queue.pop();
    sco_queue.pop();


@@ -431,8 +431,8 @@ void BluetoothHidlTest::sendAndCheckACL(int num_packets, size_t size,
    bluetooth->sendAclData(acl_vector);
    bluetooth->sendAclData(acl_vector);


    // Check the loopback of the ACL packet
    // Check the loopback of the ACL packet
    EXPECT_TRUE(
    EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameAclEventReceived)
        bluetooth_cb->WaitForCallback(kCallbackNameAclEventReceived).first);
                    .no_timeout);
    hidl_vec<uint8_t> acl_loopback = acl_queue.front();
    hidl_vec<uint8_t> acl_loopback = acl_queue.front();
    acl_queue.pop();
    acl_queue.pop();


@@ -458,8 +458,8 @@ void BluetoothHidlTest::sendAndCheckACL(int num_packets, size_t size,


// Return the number of completed packets reported by the controller.
// Return the number of completed packets reported by the controller.
int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
int BluetoothHidlTest::wait_for_completed_packets_event(uint16_t handle) {
  EXPECT_TRUE(
    EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
                    .no_timeout);
    int packets_processed = 0;
    int packets_processed = 0;
    while (event_queue.size() > 0) {
    while (event_queue.size() > 0) {
        hidl_vec<uint8_t> event = event_queue.front();
        hidl_vec<uint8_t> event = event_queue.front();
@@ -486,8 +486,8 @@ void BluetoothHidlTest::enterLoopbackMode(std::vector<uint16_t>& sco_handles,
  int connection_event_count = 0;
  int connection_event_count = 0;
  hidl_vec<uint8_t> event;
  hidl_vec<uint8_t> event;
  do {
  do {
    EXPECT_TRUE(
      EXPECT_TRUE(bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived)
        bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
                      .no_timeout);
      event = event_queue.front();
      event = event_queue.front();
      event_queue.pop();
      event_queue.pop();
      EXPECT_GT(event.size(),
      EXPECT_GT(event.size(),
@@ -504,7 +504,8 @@ void BluetoothHidlTest::enterLoopbackMode(std::vector<uint16_t>& sco_handles,


          // Save handles
          // Save handles
          uint16_t handle = event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE] |
          uint16_t handle = event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE] |
                        event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE + 1] << 8;
                            event[EVENT_CONNECTION_COMPLETE_HANDLE_LSBYTE + 1]
                                << 8;
          if (connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO)
          if (connection_type == EVENT_CONNECTION_COMPLETE_TYPE_SCO)
              sco_handles.push_back(handle);
              sco_handles.push_back(handle);
          else
          else
@@ -541,7 +542,7 @@ TEST_F(BluetoothHidlTest, HciVersionTest) {
  bluetooth->sendHciCommand(cmd);
  bluetooth->sendHciCommand(cmd);


  EXPECT_TRUE(
  EXPECT_TRUE(
      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);


  hidl_vec<uint8_t> event = event_queue.front();
  hidl_vec<uint8_t> event = event_queue.front();
  event_queue.pop();
  event_queue.pop();
@@ -562,7 +563,7 @@ TEST_F(BluetoothHidlTest, HciUnknownCommand) {
  bluetooth->sendHciCommand(cmd);
  bluetooth->sendHciCommand(cmd);


  EXPECT_TRUE(
  EXPECT_TRUE(
      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).first);
      bluetooth_cb->WaitForCallback(kCallbackNameHciEventReceived).no_timeout);


  hidl_vec<uint8_t> event = event_queue.front();
  hidl_vec<uint8_t> event = event_queue.front();
  event_queue.pop();
  event_queue.pop();