Loading audio/aidl/vts/EffectFactoryHelper.h +0 −20 Original line number Diff line number Diff line Loading @@ -36,21 +36,6 @@ using aidl::android::media::audio::common::AudioUuid; class EffectFactoryHelper { public: explicit EffectFactoryHelper(const std::string& name) : mServiceName(name) {} void ConnectToFactoryService() { mEffectFactory = IFactory::fromBinder(binderUtil.connectToService(mServiceName)); ASSERT_NE(mEffectFactory, nullptr); } void RestartFactoryService() { ASSERT_NE(mEffectFactory, nullptr); mEffectFactory = IFactory::fromBinder(binderUtil.restartService()); ASSERT_NE(mEffectFactory, nullptr); } std::shared_ptr<IFactory> GetFactory() const { return mEffectFactory; } static std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> getAllEffectDescriptors( std::string serviceName, std::optional<AudioUuid> type = std::nullopt) { AudioHalBinderServiceUtil util; Loading Loading @@ -84,9 +69,4 @@ class EffectFactoryHelper { return EffectFactoryHelper::getHalVersion(factory) >= aidl::android::hardware::audio::effect::kReopenSupportedVersion; } private: std::shared_ptr<IFactory> mEffectFactory; std::string mServiceName; AudioHalBinderServiceUtil binderUtil; }; audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp +11 −10 Original line number Diff line number Diff line Loading @@ -56,10 +56,7 @@ using android::hardware::audio::common::testing::detail::TestExecutionTracer; /// Effect factory testing. class EffectFactoryTest : public testing::TestWithParam<std::string> { public: void SetUp() override { mFactoryHelper = std::make_unique<EffectFactoryHelper>(GetParam()); connectAndGetFactory(); } void SetUp() override { connectAndGetFactory(); } void TearDown() override { for (auto& effect : mEffects) { Loading @@ -68,13 +65,14 @@ class EffectFactoryTest : public testing::TestWithParam<std::string> { } } std::unique_ptr<EffectFactoryHelper> mFactoryHelper; std::string kServiceName = GetParam(); std::shared_ptr<IFactory> mEffectFactory; std::vector<std::shared_ptr<IEffect>> mEffects; const Descriptor::Identity kNullId = {.uuid = getEffectUuidNull()}; const Descriptor::Identity kZeroId = {.uuid = getEffectUuidZero()}; const Descriptor kNullDesc = {.common.id = kNullId}; const Descriptor kZeroDesc = {.common.id = kZeroId}; AudioHalBinderServiceUtil mBinderUtil; template <typename Functor> void ForEachId(const std::vector<Descriptor::Identity> ids, Functor functor) { Loading Loading @@ -117,8 +115,7 @@ class EffectFactoryTest : public testing::TestWithParam<std::string> { } } void connectAndGetFactory() { ASSERT_NO_FATAL_FAILURE(mFactoryHelper->ConnectToFactoryService()); mEffectFactory = mFactoryHelper->GetFactory(); mEffectFactory = IFactory::fromBinder(mBinderUtil.connectToService(kServiceName)); ASSERT_NE(mEffectFactory, nullptr); } }; Loading @@ -128,7 +125,9 @@ TEST_P(EffectFactoryTest, SetupAndTearDown) { } TEST_P(EffectFactoryTest, CanBeRestarted) { ASSERT_NO_FATAL_FAILURE(mFactoryHelper->RestartFactoryService()); ASSERT_NE(mEffectFactory, nullptr); mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); ASSERT_NE(mEffectFactory, nullptr); } /** Loading Loading @@ -250,7 +249,8 @@ TEST_P(EffectFactoryTest, CreateDestroyWithRestart) { EXPECT_NE(descs.size(), 0UL); creatAndDestroyDescs(descs); mFactoryHelper->RestartFactoryService(); mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); ASSERT_NE(mEffectFactory, nullptr); connectAndGetFactory(); creatAndDestroyDescs(descs); Loading @@ -263,7 +263,8 @@ TEST_P(EffectFactoryTest, EffectInvalidAfterRestart) { EXPECT_NE(descs.size(), 0UL); std::vector<std::shared_ptr<IEffect>> effects = createWithDescs(descs); ASSERT_NO_FATAL_FAILURE(mFactoryHelper->RestartFactoryService()); mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); ASSERT_NE(mEffectFactory, nullptr); connectAndGetFactory(); destroyEffects(effects, EX_ILLEGAL_ARGUMENT); Loading Loading
audio/aidl/vts/EffectFactoryHelper.h +0 −20 Original line number Diff line number Diff line Loading @@ -36,21 +36,6 @@ using aidl::android::media::audio::common::AudioUuid; class EffectFactoryHelper { public: explicit EffectFactoryHelper(const std::string& name) : mServiceName(name) {} void ConnectToFactoryService() { mEffectFactory = IFactory::fromBinder(binderUtil.connectToService(mServiceName)); ASSERT_NE(mEffectFactory, nullptr); } void RestartFactoryService() { ASSERT_NE(mEffectFactory, nullptr); mEffectFactory = IFactory::fromBinder(binderUtil.restartService()); ASSERT_NE(mEffectFactory, nullptr); } std::shared_ptr<IFactory> GetFactory() const { return mEffectFactory; } static std::vector<std::pair<std::shared_ptr<IFactory>, Descriptor>> getAllEffectDescriptors( std::string serviceName, std::optional<AudioUuid> type = std::nullopt) { AudioHalBinderServiceUtil util; Loading Loading @@ -84,9 +69,4 @@ class EffectFactoryHelper { return EffectFactoryHelper::getHalVersion(factory) >= aidl::android::hardware::audio::effect::kReopenSupportedVersion; } private: std::shared_ptr<IFactory> mEffectFactory; std::string mServiceName; AudioHalBinderServiceUtil binderUtil; };
audio/aidl/vts/VtsHalAudioEffectFactoryTargetTest.cpp +11 −10 Original line number Diff line number Diff line Loading @@ -56,10 +56,7 @@ using android::hardware::audio::common::testing::detail::TestExecutionTracer; /// Effect factory testing. class EffectFactoryTest : public testing::TestWithParam<std::string> { public: void SetUp() override { mFactoryHelper = std::make_unique<EffectFactoryHelper>(GetParam()); connectAndGetFactory(); } void SetUp() override { connectAndGetFactory(); } void TearDown() override { for (auto& effect : mEffects) { Loading @@ -68,13 +65,14 @@ class EffectFactoryTest : public testing::TestWithParam<std::string> { } } std::unique_ptr<EffectFactoryHelper> mFactoryHelper; std::string kServiceName = GetParam(); std::shared_ptr<IFactory> mEffectFactory; std::vector<std::shared_ptr<IEffect>> mEffects; const Descriptor::Identity kNullId = {.uuid = getEffectUuidNull()}; const Descriptor::Identity kZeroId = {.uuid = getEffectUuidZero()}; const Descriptor kNullDesc = {.common.id = kNullId}; const Descriptor kZeroDesc = {.common.id = kZeroId}; AudioHalBinderServiceUtil mBinderUtil; template <typename Functor> void ForEachId(const std::vector<Descriptor::Identity> ids, Functor functor) { Loading Loading @@ -117,8 +115,7 @@ class EffectFactoryTest : public testing::TestWithParam<std::string> { } } void connectAndGetFactory() { ASSERT_NO_FATAL_FAILURE(mFactoryHelper->ConnectToFactoryService()); mEffectFactory = mFactoryHelper->GetFactory(); mEffectFactory = IFactory::fromBinder(mBinderUtil.connectToService(kServiceName)); ASSERT_NE(mEffectFactory, nullptr); } }; Loading @@ -128,7 +125,9 @@ TEST_P(EffectFactoryTest, SetupAndTearDown) { } TEST_P(EffectFactoryTest, CanBeRestarted) { ASSERT_NO_FATAL_FAILURE(mFactoryHelper->RestartFactoryService()); ASSERT_NE(mEffectFactory, nullptr); mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); ASSERT_NE(mEffectFactory, nullptr); } /** Loading Loading @@ -250,7 +249,8 @@ TEST_P(EffectFactoryTest, CreateDestroyWithRestart) { EXPECT_NE(descs.size(), 0UL); creatAndDestroyDescs(descs); mFactoryHelper->RestartFactoryService(); mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); ASSERT_NE(mEffectFactory, nullptr); connectAndGetFactory(); creatAndDestroyDescs(descs); Loading @@ -263,7 +263,8 @@ TEST_P(EffectFactoryTest, EffectInvalidAfterRestart) { EXPECT_NE(descs.size(), 0UL); std::vector<std::shared_ptr<IEffect>> effects = createWithDescs(descs); ASSERT_NO_FATAL_FAILURE(mFactoryHelper->RestartFactoryService()); mEffectFactory = IFactory::fromBinder(mBinderUtil.restartService()); ASSERT_NE(mEffectFactory, nullptr); connectAndGetFactory(); destroyEffects(effects, EX_ILLEGAL_ARGUMENT); Loading