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

Commit 1e2a0bf9 authored by Qasim Javed's avatar Qasim Javed
Browse files

Fix three flaky tests.

Bug: 245578454
Bug: 243824983
Tag: #gd-refactor
Test: atest bluetooth_test_gd_unit --gtest_filter='HciLayerTest.*'
--gtest_repeat=100

Change-Id: I2b26454c2fe3de64d4852f2aaf0ecc2672ef2cb2
parent 3f3280f4
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -252,14 +252,14 @@ TEST_F(HciLayerTest, successful_reset) {
}

TEST_F(HciLayerTest, abort_if_reset_complete_returns_error) {
  FailIfResetNotSent();
  ASSERT_DEATH(
      {
        FailIfResetNotSent();
        auto error_code = ErrorCode::UNSPECIFIED_ERROR;
        hal_->InjectResetCompleteEventWithCode(error_code);
        std::promise<void> promise;
        auto buf = std::make_unique<char[]>(kBufSize);
        std::snprintf(buf.get(), kBufSize, "Reset completed with status: %s", ErrorCodeText(error_code).c_str());
        std::promise<void> promise;
        log_capture_->WaitUntilLogContains(&promise, buf.get());
      },
      "");
@@ -301,9 +301,9 @@ TEST_F(HciLayerTest, le_event_handler_is_invoked) {
}

TEST_F(HciLayerTest, abort_on_second_register_event_handler) {
  FailIfResetNotSent();
  ASSERT_DEATH(
      {
        FailIfResetNotSent();
        hci_->RegisterEventHandler(EventCode::COMMAND_COMPLETE, hci_handler_->Bind([](EventView view) {}));
        std::promise<void> promise;
        log_capture_->WaitUntilLogContains(&promise, "Can not register a second handler for");
@@ -312,11 +312,11 @@ TEST_F(HciLayerTest, abort_on_second_register_event_handler) {
}

TEST_F(HciLayerTest, abort_on_second_register_le_event_handler) {
  ASSERT_DEATH(
      {
        FailIfResetNotSent();
        hci_->RegisterLeEventHandler(
            SubeventCode::ENHANCED_CONNECTION_COMPLETE, hci_handler_->Bind([](LeMetaEventView view) {}));
  ASSERT_DEATH(
      {
        hci_->RegisterLeEventHandler(
            SubeventCode::ENHANCED_CONNECTION_COMPLETE, hci_handler_->Bind([](LeMetaEventView view) {}));
        std::promise<void> promise;