Loading biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,11 @@ class SessionCallback : public BnSessionCallback { }; class Face : public testing::TestWithParam<std::string> { static void HalServiceDied(void* cookie) { auto halDeathPromise = static_cast<std::promise<void>*>(cookie); halDeathPromise->set_value(); } protected: void SetUp() override { // Prepare the callback. Loading @@ -176,8 +181,23 @@ class Face : public testing::TestWithParam<std::string> { ASSERT_NE(binder, nullptr); mHal = IFace::fromBinder(ndk::SpAIBinder(binder)); // Create HAL service death notifier auto halDeathPromise = std::make_shared<std::promise<void>>(); mHalDeathRecipient = ndk::ScopedAIBinder_DeathRecipient( AIBinder_DeathRecipient_new(&HalServiceDied)); ASSERT_EQ(STATUS_OK, AIBinder_linkToDeath(binder, mHalDeathRecipient.get(), static_cast<void*>(halDeathPromise.get()))); // Create a session. isOk = mHal->createSession(kSensorId, kUserId, mCb, &mSession).isOk(); if (!isOk) { // Failed to create session on first attempt, it is likely that the HAL service // is dying or dead. Wait for its death notification signal before next try auto future = halDeathPromise->get_future(); auto status = future.wait_for(std::chrono::milliseconds(500)); EXPECT_EQ(status, std::future_status::ready); } ++retries; } while (!isOk && retries < 2); Loading @@ -196,6 +216,7 @@ class Face : public testing::TestWithParam<std::string> { std::shared_ptr<IFace> mHal; std::shared_ptr<SessionCallback> mCb; std::shared_ptr<ISession> mSession; ::ndk::ScopedAIBinder_DeathRecipient mHalDeathRecipient; }; TEST_P(Face, GetSensorPropsWorksTest) { Loading Loading
biometrics/face/aidl/vts/VtsHalBiometricsFaceTargetTest.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -157,6 +157,11 @@ class SessionCallback : public BnSessionCallback { }; class Face : public testing::TestWithParam<std::string> { static void HalServiceDied(void* cookie) { auto halDeathPromise = static_cast<std::promise<void>*>(cookie); halDeathPromise->set_value(); } protected: void SetUp() override { // Prepare the callback. Loading @@ -176,8 +181,23 @@ class Face : public testing::TestWithParam<std::string> { ASSERT_NE(binder, nullptr); mHal = IFace::fromBinder(ndk::SpAIBinder(binder)); // Create HAL service death notifier auto halDeathPromise = std::make_shared<std::promise<void>>(); mHalDeathRecipient = ndk::ScopedAIBinder_DeathRecipient( AIBinder_DeathRecipient_new(&HalServiceDied)); ASSERT_EQ(STATUS_OK, AIBinder_linkToDeath(binder, mHalDeathRecipient.get(), static_cast<void*>(halDeathPromise.get()))); // Create a session. isOk = mHal->createSession(kSensorId, kUserId, mCb, &mSession).isOk(); if (!isOk) { // Failed to create session on first attempt, it is likely that the HAL service // is dying or dead. Wait for its death notification signal before next try auto future = halDeathPromise->get_future(); auto status = future.wait_for(std::chrono::milliseconds(500)); EXPECT_EQ(status, std::future_status::ready); } ++retries; } while (!isOk && retries < 2); Loading @@ -196,6 +216,7 @@ class Face : public testing::TestWithParam<std::string> { std::shared_ptr<IFace> mHal; std::shared_ptr<SessionCallback> mCb; std::shared_ptr<ISession> mSession; ::ndk::ScopedAIBinder_DeathRecipient mHalDeathRecipient; }; TEST_P(Face, GetSensorPropsWorksTest) { Loading