Merge "uwb: Keep VTS timeout to be consistent with UWB stack" into main

This commit is contained in:
Ayush Jain 2024-03-21 16:33:18 +00:00 committed by Gerrit Code Review
commit e63e865777

View file

@ -39,6 +39,8 @@ using ndk::SpAIBinder;
namespace { namespace {
constexpr static int kCallbackTimeoutMs = 250; constexpr static int kCallbackTimeoutMs = 250;
// this timeout should be same as AOSP stack timeout (HAL_OPEN_TIMEOUT_MS)
constexpr static int kOpenCallbackTimeoutMs = 20000;
} // namespace } // namespace
class UwbClientCallback : public BnUwbClientCallback { class UwbClientCallback : public BnUwbClientCallback {
@ -105,7 +107,7 @@ class UwbAidl : public testing::TestWithParam<std::string> {
open_cb_promise.set_value(); open_cb_promise.set_value();
} }
}); });
std::chrono::milliseconds timeout{kCallbackTimeoutMs}; std::chrono::milliseconds timeout{kOpenCallbackTimeoutMs};
const auto iuwb_chip = getAnyChip(); const auto iuwb_chip = getAnyChip();
EXPECT_TRUE(iuwb_chip->open(callback).isOk()); EXPECT_TRUE(iuwb_chip->open(callback).isOk());
EXPECT_EQ(open_cb_future.wait_for(timeout), std::future_status::ready); EXPECT_EQ(open_cb_future.wait_for(timeout), std::future_status::ready);
@ -137,7 +139,7 @@ TEST_P(UwbAidl, ChipOpen) {
open_cb_promise.set_value(); open_cb_promise.set_value();
} }
}); });
std::chrono::milliseconds timeout{kCallbackTimeoutMs}; std::chrono::milliseconds timeout{kOpenCallbackTimeoutMs};
const auto iuwb_chip = getAnyChip(); const auto iuwb_chip = getAnyChip();
EXPECT_TRUE(iuwb_chip->open(callback).isOk()); EXPECT_TRUE(iuwb_chip->open(callback).isOk());
EXPECT_EQ(open_cb_future.wait_for(timeout), std::future_status::ready); EXPECT_EQ(open_cb_future.wait_for(timeout), std::future_status::ready);
@ -158,12 +160,13 @@ TEST_P(UwbAidl, ChipClose) {
close_cb_promise.set_value(); close_cb_promise.set_value();
} }
}); });
std::chrono::milliseconds timeout{kCallbackTimeoutMs}; std::chrono::milliseconds open_timeout{kOpenCallbackTimeoutMs};
std::chrono::milliseconds close_timeout{kCallbackTimeoutMs};
const auto iuwb_chip = getAnyChip(); const auto iuwb_chip = getAnyChip();
EXPECT_TRUE(iuwb_chip->open(callback).isOk()); EXPECT_TRUE(iuwb_chip->open(callback).isOk());
EXPECT_EQ(open_cb_future.wait_for(timeout), std::future_status::ready); EXPECT_EQ(open_cb_future.wait_for(open_timeout), std::future_status::ready);
EXPECT_TRUE(iuwb_chip->close().isOk()); EXPECT_TRUE(iuwb_chip->close().isOk());
EXPECT_EQ(close_cb_future.wait_for(timeout), std::future_status::ready); EXPECT_EQ(close_cb_future.wait_for(close_timeout), std::future_status::ready);
} }
TEST_P(UwbAidl, ChipCoreInit) { TEST_P(UwbAidl, ChipCoreInit) {