Loading secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -83,10 +83,15 @@ class MySecureElementCallback : public BnSecureElementCallback { void expectCallbackHistory(std::vector<bool>&& want) { std::unique_lock<std::mutex> l(m); cv.wait_for(l, 2s, [&]() { return history.size() >= want.size(); }); cv.wait_for(l, 5s, [&]() { return history.size() >= want.size(); }); EXPECT_THAT(history, ElementsAreArray(want)); } void resetCallbackHistory() { std::unique_lock<std::mutex> l(m); history.clear(); } private: std::mutex m; // guards history std::condition_variable cv; Loading Loading @@ -118,7 +123,9 @@ class SecureElementAidl : public ::testing::TestWithParam<std::string> { } void TearDown() override { secure_element_callback_->resetCallbackHistory(); EXPECT_OK(secure_element_->reset()); secure_element_callback_->expectCallbackHistory({false, true}); secure_element_ = nullptr; secure_element_callback_ = nullptr; } Loading Loading
secure_element/aidl/vts/VtsHalSecureElementTargetTest.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -83,10 +83,15 @@ class MySecureElementCallback : public BnSecureElementCallback { void expectCallbackHistory(std::vector<bool>&& want) { std::unique_lock<std::mutex> l(m); cv.wait_for(l, 2s, [&]() { return history.size() >= want.size(); }); cv.wait_for(l, 5s, [&]() { return history.size() >= want.size(); }); EXPECT_THAT(history, ElementsAreArray(want)); } void resetCallbackHistory() { std::unique_lock<std::mutex> l(m); history.clear(); } private: std::mutex m; // guards history std::condition_variable cv; Loading Loading @@ -118,7 +123,9 @@ class SecureElementAidl : public ::testing::TestWithParam<std::string> { } void TearDown() override { secure_element_callback_->resetCallbackHistory(); EXPECT_OK(secure_element_->reset()); secure_element_callback_->expectCallbackHistory({false, true}); secure_element_ = nullptr; secure_element_callback_ = nullptr; } Loading