Merge "Effect: verify all AIDL IEffect versions are same as IFactory" into main

This commit is contained in:
Shunkai Yao 2024-02-02 20:23:29 +00:00 committed by Gerrit Code Review
commit 047484de60

View file

@ -296,6 +296,25 @@ TEST_P(EffectFactoryTest, QueryProcess) {
[&](const auto& proc) { return processingSet.find(proc) != processingSet.end(); })); [&](const auto& proc) { return processingSet.find(proc) != processingSet.end(); }));
} }
// Make sure all effect instances have same HAL version number as IFactory.
TEST_P(EffectFactoryTest, VersionNumberForAllEffectsEqualsToIFactory) {
std::vector<Descriptor> descs;
EXPECT_IS_OK(mEffectFactory->queryEffects(std::nullopt, std::nullopt, std::nullopt, &descs));
EXPECT_NE(descs.size(), 0UL);
std::vector<std::shared_ptr<IEffect>> effects = createWithDescs(descs);
int factoryVersion = 0;
EXPECT_IS_OK(mEffectFactory->getInterfaceVersion(&factoryVersion));
for (const auto& effect : effects) {
int effectVersion = 0;
EXPECT_NE(nullptr, effect);
EXPECT_IS_OK(effect->getInterfaceVersion(&effectVersion));
EXPECT_EQ(factoryVersion, effectVersion);
}
ASSERT_NO_FATAL_FAILURE(destroyEffects(effects));
}
INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactoryTest, INSTANTIATE_TEST_SUITE_P(EffectFactoryTest, EffectFactoryTest,
testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)), testing::ValuesIn(android::getAidlHalInstanceNames(IFactory::descriptor)),
android::PrintInstanceNameToString); android::PrintInstanceNameToString);