Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8af34b77 authored by Shunkai Yao's avatar Shunkai Yao Committed by Automerger Merge Worker
Browse files

Merge "aidl: Improve Effect VTS naming" am: 187b6b7e am: 68cceeb6 am: c7e09df3 am: a5d1487c

parents 0e7e98d5 a5d1487c
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -32,12 +32,14 @@
#include <gtest/gtest.h>
#include <system/audio_effects/aidl_effects_utils.h>
#include <system/audio_effects/effect_uuid.h>
#include <system/audio_aidl_utils.h>

#include "AudioHalBinderServiceUtil.h"
#include "EffectFactoryHelper.h"
#include "TestUtils.h"

using namespace android;
using ::android::audio::utils::toString;
using aidl::android::hardware::audio::effect::CommandId;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::IEffect;
@@ -63,6 +65,13 @@ typedef ::android::AidlMessageQueue<float,
                                    ::aidl::android::hardware::common::fmq::SynchronizedReadWrite>
        DataMQ;

static inline std::string getPrefix(Descriptor &descriptor) {
    std::string prefix = "Implementor_" + descriptor.common.implementor + "_name_" +
                               descriptor.common.name + "_UUID_" +
                               toString(descriptor.common.id.uuid);
    return prefix;
}

class EffectHelper {
  public:
    static void create(std::shared_ptr<IFactory> factory, std::shared_ptr<IEffect>& effect,
@@ -71,7 +80,7 @@ class EffectHelper {
        auto& id = desc.common.id;
        ASSERT_STATUS(status, factory->createEffect(id.uuid, &effect));
        if (status == EX_NONE) {
            ASSERT_NE(effect, nullptr) << id.uuid.toString();
            ASSERT_NE(effect, nullptr) << toString(id.uuid);
        }
    }

+1 −3
Original line number Diff line number Diff line
@@ -162,9 +162,7 @@ INSTANTIATE_TEST_SUITE_P(
            auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
            std::string echoDelay = std::to_string(std::get<PARAM_ECHO_DELAY>(info.param));
            std::string mobileMode = std::get<PARAM_MOBILE_MODE>(info.param) ? "true" : "false";
            std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
                               descriptor.common.name + "_UUID_" +
                               descriptor.common.id.uuid.toString() + "_EchoDelay_" + echoDelay +
            std::string name = getPrefix(descriptor) + "_EchoDelay_" + echoDelay +
                               "_MobileMode_" + mobileMode;
            std::replace_if(
                    name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
+1 −3
Original line number Diff line number Diff line
@@ -177,9 +177,7 @@ INSTANTIATE_TEST_SUITE_P(
                    std::to_string(std::get<PARAM_MAX_COMPRESSION_GAIN>(info.param));
            std::string enableLimiter = std::to_string(std::get<PARAM_ENABLE_LIMITER>(info.param));

            std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
                               descriptor.common.name + "_UUID_" +
                               descriptor.common.id.uuid.toString() + "_target_peak_level_" +
            std::string name = getPrefix(descriptor) + "_target_peak_level_" +
                               targetPeakLevel + "_max_compression_gain_" + maxCompressionGain +
                               "_enable_limiter_" + enableLimiter;
            std::replace_if(
+1 −3
Original line number Diff line number Diff line
@@ -183,9 +183,7 @@ INSTANTIATE_TEST_SUITE_P(
            std::string margin =
                    std::to_string(static_cast<int>(std::get<PARAM_SATURATION_MARGIN>(info.param)));

            std::string name = "Implementor_" + descriptor.common.implementor + "_name_" +
                               descriptor.common.name + "_UUID_" +
                               descriptor.common.id.uuid.toString() + "_digital_gain_" + gain +
            std::string name = getPrefix(descriptor) + "_digital_gain_" + gain +
                               "_level_estimator_" + estimator + "_margin_" + margin;
            std::replace_if(
                    name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
+7 −2
Original line number Diff line number Diff line
@@ -36,6 +36,11 @@
#include "EffectFactoryHelper.h"
#include "TestUtils.h"

#include <system/audio_aidl_utils.h>

using namespace android;
using ::android::audio::utils::toString;

using namespace android;

using aidl::android::hardware::audio::effect::Descriptor;
@@ -93,7 +98,7 @@ class EffectFactoryTest : public testing::TestWithParam<std::string> {
            std::shared_ptr<IEffect> effect;
            EXPECT_STATUS(expectStatus, mEffectFactory->createEffect(uuid, &effect));
            if (expectStatus == EX_NONE) {
                EXPECT_NE(effect, nullptr) << " null effect with uuid: " << uuid.toString();
                EXPECT_NE(effect, nullptr) << " null effect with uuid: " << toString(uuid);
                effects.push_back(std::move(effect));
            }
        }
@@ -148,7 +153,7 @@ TEST_P(EffectFactoryTest, ExpectAllAospEffectTypes) {
    }
    std::string msg = " missing type UUID:\n";
    for (const auto& uuid : typeUuidSet) {
        msg += (uuid.toString() + "\n");
        msg += (toString(uuid) + "\n");
    }
    SCOPED_TRACE(msg);
    EXPECT_EQ(0UL, typeUuidSet.size());
Loading