Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2022 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #define LOG_TAG "VtsHalEnvironmentalReverbTest" |
| 18 | |
| 19 | #include <Utils.h> |
| 20 | #include <aidl/Vintf.h> |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 21 | #include <unordered_set> |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 22 | #include "EffectHelper.h" |
| 23 | |
| 24 | using namespace android; |
| 25 | |
| 26 | using aidl::android::hardware::audio::effect::Capability; |
| 27 | using aidl::android::hardware::audio::effect::Descriptor; |
| 28 | using aidl::android::hardware::audio::effect::EnvironmentalReverb; |
| 29 | using aidl::android::hardware::audio::effect::IEffect; |
| 30 | using aidl::android::hardware::audio::effect::IFactory; |
| 31 | using aidl::android::hardware::audio::effect::kEnvReverbTypeUUID; |
| 32 | using aidl::android::hardware::audio::effect::Parameter; |
| 33 | |
| 34 | /** |
| 35 | * Here we focus on specific parameter checking, general IEffect interfaces testing performed in |
| 36 | * VtsAudioEffectTargetTest. |
| 37 | * Testing parameter range, assuming the parameter supported by effect is in this range. |
| 38 | * This range is verified with IEffect.getDescriptor() and range defined in the documentation, for |
| 39 | * any index supported value test expects EX_NONE from IEffect.setParameter(), otherwise expects |
| 40 | * EX_ILLEGAL_ARGUMENT. |
| 41 | */ |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 42 | |
| 43 | class EnvironmentalReverbHelper : public EffectHelper { |
| 44 | public: |
| 45 | EnvironmentalReverbHelper(std::pair<std::shared_ptr<IFactory>, Descriptor> pair) { |
| 46 | std::tie(mFactory, mDescriptor) = pair; |
| 47 | } |
| 48 | |
| 49 | void SetUpReverb() { |
| 50 | ASSERT_NE(nullptr, mFactory); |
| 51 | ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor)); |
| 52 | |
| 53 | Parameter::Specific specific = getDefaultParamSpecific(); |
| 54 | Parameter::Common common = EffectHelper::createParamCommon( |
| 55 | 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */, |
| 56 | kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */); |
| 57 | IEffect::OpenEffectReturn ret; |
| 58 | ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &ret, EX_NONE)); |
| 59 | ASSERT_NE(nullptr, mEffect); |
| 60 | } |
| 61 | |
| 62 | void TearDownReverb() { |
| 63 | ASSERT_NO_FATAL_FAILURE(close(mEffect)); |
| 64 | ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect)); |
| 65 | } |
| 66 | |
| 67 | Parameter::Specific getDefaultParamSpecific() { |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 68 | EnvironmentalReverb er = EnvironmentalReverb::make<EnvironmentalReverb::roomLevelMb>(-6000); |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 69 | Parameter::Specific specific = |
| 70 | Parameter::Specific::make<Parameter::Specific::environmentalReverb>(er); |
| 71 | return specific; |
| 72 | } |
| 73 | |
| 74 | static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100; |
| 75 | std::shared_ptr<IFactory> mFactory; |
| 76 | std::shared_ptr<IEffect> mEffect; |
| 77 | Descriptor mDescriptor; |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 78 | int mRoomLevel = -6000; |
| 79 | int mRoomHfLevel = 0; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 80 | int mDecayTime = 1000; |
| 81 | int mDecayHfRatio = 500; |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 82 | int mLevel = -6000; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 83 | int mDelay = 40; |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 84 | int mDiffusion = 1000; |
| 85 | int mDensity = 1000; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 86 | bool mBypass = false; |
| 87 | |
| 88 | void SetAndGetReverbParameters() { |
| 89 | for (auto& it : mTags) { |
| 90 | auto& tag = it.first; |
| 91 | auto& er = it.second; |
| 92 | |
| 93 | // validate parameter |
| 94 | Descriptor desc; |
| 95 | ASSERT_STATUS(EX_NONE, mEffect->getDescriptor(&desc)); |
| 96 | const bool valid = isTagInRange(it.first, it.second, desc); |
| 97 | const binder_exception_t expected = valid ? EX_NONE : EX_ILLEGAL_ARGUMENT; |
| 98 | |
| 99 | // set |
| 100 | Parameter expectParam; |
| 101 | Parameter::Specific specific; |
| 102 | specific.set<Parameter::Specific::environmentalReverb>(er); |
| 103 | expectParam.set<Parameter::specific>(specific); |
| 104 | EXPECT_STATUS(expected, mEffect->setParameter(expectParam)) << expectParam.toString(); |
| 105 | |
| 106 | // only get if parameter in range and set success |
| 107 | if (expected == EX_NONE) { |
| 108 | Parameter getParam; |
| 109 | Parameter::Id id; |
| 110 | EnvironmentalReverb::Id erId; |
| 111 | erId.set<EnvironmentalReverb::Id::commonTag>(tag); |
| 112 | id.set<Parameter::Id::environmentalReverbTag>(erId); |
| 113 | // if set success, then get should match |
| 114 | EXPECT_STATUS(expected, mEffect->getParameter(id, &getParam)); |
| 115 | EXPECT_EQ(expectParam, getParam); |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | void addRoomLevelParam() { |
| 121 | EnvironmentalReverb er; |
| 122 | er.set<EnvironmentalReverb::roomLevelMb>(mRoomLevel); |
| 123 | mTags.push_back({EnvironmentalReverb::roomLevelMb, er}); |
| 124 | } |
| 125 | |
| 126 | void addRoomHfLevelParam(int roomHfLevel) { |
| 127 | EnvironmentalReverb er; |
| 128 | er.set<EnvironmentalReverb::roomHfLevelMb>(roomHfLevel); |
| 129 | mTags.push_back({EnvironmentalReverb::roomHfLevelMb, er}); |
| 130 | } |
| 131 | |
| 132 | void addDecayTimeParam(int decayTime) { |
| 133 | EnvironmentalReverb er; |
| 134 | er.set<EnvironmentalReverb::decayTimeMs>(decayTime); |
| 135 | mTags.push_back({EnvironmentalReverb::decayTimeMs, er}); |
| 136 | } |
| 137 | |
| 138 | void addDecayHfRatioParam(int decayHfRatio) { |
| 139 | EnvironmentalReverb er; |
| 140 | er.set<EnvironmentalReverb::decayHfRatioPm>(decayHfRatio); |
| 141 | mTags.push_back({EnvironmentalReverb::decayHfRatioPm, er}); |
| 142 | } |
| 143 | |
| 144 | void addLevelParam(int level) { |
| 145 | EnvironmentalReverb er; |
| 146 | er.set<EnvironmentalReverb::levelMb>(level); |
| 147 | mTags.push_back({EnvironmentalReverb::levelMb, er}); |
| 148 | } |
| 149 | |
| 150 | void addDelayParam(int delay) { |
| 151 | EnvironmentalReverb er; |
| 152 | er.set<EnvironmentalReverb::delayMs>(delay); |
| 153 | mTags.push_back({EnvironmentalReverb::delayMs, er}); |
| 154 | } |
| 155 | |
| 156 | void addDiffusionParam(int diffusion) { |
| 157 | EnvironmentalReverb er; |
| 158 | er.set<EnvironmentalReverb::diffusionPm>(diffusion); |
| 159 | mTags.push_back({EnvironmentalReverb::diffusionPm, er}); |
| 160 | } |
| 161 | |
| 162 | void addDensityParam(int density) { |
| 163 | EnvironmentalReverb er; |
| 164 | er.set<EnvironmentalReverb::densityPm>(density); |
| 165 | mTags.push_back({EnvironmentalReverb::densityPm, er}); |
| 166 | } |
| 167 | |
| 168 | void addBypassParam(bool bypass) { |
| 169 | EnvironmentalReverb er; |
| 170 | er.set<EnvironmentalReverb::bypass>(bypass); |
| 171 | mTags.push_back({EnvironmentalReverb::bypass, er}); |
| 172 | } |
| 173 | |
| 174 | bool isTagInRange(const EnvironmentalReverb::Tag& tag, const EnvironmentalReverb er, |
| 175 | const Descriptor& desc) const { |
| 176 | const EnvironmentalReverb::Capability& erCap = |
| 177 | desc.capability.get<Capability::environmentalReverb>(); |
| 178 | switch (tag) { |
| 179 | case EnvironmentalReverb::roomLevelMb: { |
| 180 | int roomLevel = er.get<EnvironmentalReverb::roomLevelMb>(); |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 181 | return isRoomLevelInRange(erCap, roomLevel); |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 182 | } |
| 183 | case EnvironmentalReverb::roomHfLevelMb: { |
| 184 | int roomHfLevel = er.get<EnvironmentalReverb::roomHfLevelMb>(); |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 185 | return isRoomHfLevelInRange(erCap, roomHfLevel); |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 186 | } |
| 187 | case EnvironmentalReverb::decayTimeMs: { |
| 188 | int decayTime = er.get<EnvironmentalReverb::decayTimeMs>(); |
| 189 | return isDecayTimeInRange(erCap, decayTime); |
| 190 | } |
| 191 | case EnvironmentalReverb::decayHfRatioPm: { |
| 192 | int decayHfRatio = er.get<EnvironmentalReverb::decayHfRatioPm>(); |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 193 | return isDecayHfRatioInRange(erCap, decayHfRatio); |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 194 | } |
| 195 | case EnvironmentalReverb::levelMb: { |
| 196 | int level = er.get<EnvironmentalReverb::levelMb>(); |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 197 | return isLevelInRange(erCap, level); |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 198 | } |
| 199 | case EnvironmentalReverb::delayMs: { |
| 200 | int delay = er.get<EnvironmentalReverb::delayMs>(); |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 201 | return isDelayInRange(erCap, delay); |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 202 | } |
| 203 | case EnvironmentalReverb::diffusionPm: { |
| 204 | int diffusion = er.get<EnvironmentalReverb::diffusionPm>(); |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 205 | return isDiffusionInRange(erCap, diffusion); |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 206 | } |
| 207 | case EnvironmentalReverb::densityPm: { |
| 208 | int density = er.get<EnvironmentalReverb::densityPm>(); |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 209 | return isDensityInRange(erCap, density); |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 210 | } |
| 211 | case EnvironmentalReverb::bypass: { |
| 212 | return true; |
| 213 | } |
| 214 | default: |
| 215 | return false; |
| 216 | } |
| 217 | return false; |
| 218 | } |
| 219 | |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 220 | bool isRoomLevelInRange(const EnvironmentalReverb::Capability& cap, int roomLevel) const { |
| 221 | return roomLevel >= cap.minRoomLevelMb && roomLevel <= cap.maxRoomLevelMb; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 222 | } |
| 223 | |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 224 | bool isRoomHfLevelInRange(const EnvironmentalReverb::Capability& cap, int roomHfLevel) const { |
| 225 | return roomHfLevel >= cap.minRoomHfLevelMb && roomHfLevel <= cap.maxRoomHfLevelMb; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 226 | } |
| 227 | |
| 228 | bool isDecayTimeInRange(const EnvironmentalReverb::Capability& cap, int decayTime) const { |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 229 | return decayTime >= 0 && decayTime <= cap.maxDecayTimeMs; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 230 | } |
| 231 | |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 232 | bool isDecayHfRatioInRange(const EnvironmentalReverb::Capability& cap, int decayHfRatio) const { |
| 233 | return decayHfRatio >= cap.minDecayHfRatioPm && decayHfRatio <= cap.maxDecayHfRatioPm; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 234 | } |
| 235 | |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 236 | bool isLevelInRange(const EnvironmentalReverb::Capability& cap, int level) const { |
| 237 | return level >= cap.minLevelMb && level <= cap.maxLevelMb; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 238 | } |
| 239 | |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 240 | bool isDelayInRange(const EnvironmentalReverb::Capability& cap, int delay) const { |
| 241 | return delay >= 0 && delay <= cap.maxDelayMs; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 242 | } |
| 243 | |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 244 | bool isDiffusionInRange(const EnvironmentalReverb::Capability& cap, int diffusion) const { |
| 245 | return diffusion >= 0 && diffusion <= cap.maxDiffusionPm; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 246 | } |
| 247 | |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 248 | bool isDensityInRange(const EnvironmentalReverb::Capability& cap, int density) const { |
| 249 | return density >= 0 && density <= cap.maxDensityPm; |
| 250 | } |
| 251 | |
| 252 | static std::unordered_set<int> getRoomLevelValues() { |
| 253 | auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, |
| 254 | kEnvReverbTypeUUID); |
| 255 | int minRoomLevelMb = std::numeric_limits<int>::max(); |
| 256 | int maxRoomLevelMb = std::numeric_limits<int>::min(); |
| 257 | for (const auto& it : descList) { |
| 258 | maxRoomLevelMb = std::max( |
| 259 | it.second.capability.get<Capability::environmentalReverb>().maxRoomLevelMb, |
| 260 | maxRoomLevelMb); |
| 261 | minRoomLevelMb = std::min( |
| 262 | it.second.capability.get<Capability::environmentalReverb>().minRoomLevelMb, |
| 263 | minRoomLevelMb); |
| 264 | } |
| 265 | return {std::numeric_limits<int>::min(), minRoomLevelMb - 1, minRoomLevelMb, |
| 266 | (minRoomLevelMb + maxRoomLevelMb) >> 1, maxRoomLevelMb, maxRoomLevelMb + 1, |
| 267 | std::numeric_limits<int>::max()}; |
| 268 | } |
| 269 | |
| 270 | static std::unordered_set<int> getRoomHfLevelValues() { |
| 271 | auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, |
| 272 | kEnvReverbTypeUUID); |
| 273 | int minRoomHfLevelMb = std::numeric_limits<int>::max(); |
| 274 | int maxRoomHfLevelMb = std::numeric_limits<int>::min(); |
| 275 | for (const auto& it : descList) { |
| 276 | maxRoomHfLevelMb = std::max( |
| 277 | it.second.capability.get<Capability::environmentalReverb>().maxRoomHfLevelMb, |
| 278 | maxRoomHfLevelMb); |
| 279 | minRoomHfLevelMb = std::min( |
| 280 | it.second.capability.get<Capability::environmentalReverb>().minRoomHfLevelMb, |
| 281 | minRoomHfLevelMb); |
| 282 | } |
| 283 | return {std::numeric_limits<int>::min(), |
| 284 | minRoomHfLevelMb - 1, |
| 285 | minRoomHfLevelMb, |
| 286 | (minRoomHfLevelMb + maxRoomHfLevelMb) >> 1, |
| 287 | maxRoomHfLevelMb, |
| 288 | maxRoomHfLevelMb + 1, |
| 289 | std::numeric_limits<int>::max()}; |
| 290 | } |
| 291 | |
| 292 | static std::unordered_set<int> getDecayTimeValues() { |
| 293 | auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, |
| 294 | kEnvReverbTypeUUID); |
| 295 | const auto max = std::max_element( |
| 296 | descList.begin(), descList.end(), |
| 297 | [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a, |
| 298 | const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) { |
| 299 | return a.second.capability.get<Capability::environmentalReverb>() |
| 300 | .maxDecayTimeMs < |
| 301 | b.second.capability.get<Capability::environmentalReverb>() |
| 302 | .maxDecayTimeMs; |
| 303 | }); |
| 304 | if (max == descList.end()) { |
| 305 | return {0}; |
| 306 | } |
| 307 | int maxDecayTimeMs = |
| 308 | max->second.capability.get<Capability::environmentalReverb>().maxDecayTimeMs; |
| 309 | return {-1, 0, maxDecayTimeMs >> 1, maxDecayTimeMs - 1, maxDecayTimeMs, maxDecayTimeMs + 1}; |
| 310 | } |
| 311 | |
| 312 | static std::unordered_set<int> getDecayHfRatioValues() { |
| 313 | auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, |
| 314 | kEnvReverbTypeUUID); |
| 315 | int minDecayHfRatioPm = std::numeric_limits<int>::max(); |
| 316 | int maxDecayHfRatioPm = std::numeric_limits<int>::min(); |
| 317 | for (const auto& it : descList) { |
| 318 | maxDecayHfRatioPm = std::max( |
| 319 | it.second.capability.get<Capability::environmentalReverb>().maxDecayHfRatioPm, |
| 320 | maxDecayHfRatioPm); |
| 321 | minDecayHfRatioPm = std::min( |
| 322 | it.second.capability.get<Capability::environmentalReverb>().minDecayHfRatioPm, |
| 323 | minDecayHfRatioPm); |
| 324 | } |
| 325 | return {std::numeric_limits<int>::min(), |
| 326 | minDecayHfRatioPm - 1, |
| 327 | minDecayHfRatioPm, |
| 328 | (minDecayHfRatioPm + maxDecayHfRatioPm) >> 1, |
| 329 | maxDecayHfRatioPm, |
| 330 | maxDecayHfRatioPm + 1, |
| 331 | std::numeric_limits<int>::max()}; |
| 332 | } |
| 333 | |
| 334 | static std::unordered_set<int> getLevelValues() { |
| 335 | auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, |
| 336 | kEnvReverbTypeUUID); |
| 337 | int minLevelMb = std::numeric_limits<int>::max(); |
| 338 | int maxLevelMb = std::numeric_limits<int>::min(); |
| 339 | for (const auto& it : descList) { |
| 340 | maxLevelMb = |
| 341 | std::max(it.second.capability.get<Capability::environmentalReverb>().maxLevelMb, |
| 342 | maxLevelMb); |
| 343 | minLevelMb = |
| 344 | std::min(it.second.capability.get<Capability::environmentalReverb>().minLevelMb, |
| 345 | minLevelMb); |
| 346 | } |
| 347 | return {std::numeric_limits<int>::min(), minLevelMb - 1, minLevelMb, |
| 348 | (minLevelMb + maxLevelMb) >> 1, maxLevelMb, maxLevelMb + 1, |
| 349 | std::numeric_limits<int>::max()}; |
| 350 | } |
| 351 | |
| 352 | static std::unordered_set<int> getDelayValues() { |
| 353 | auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, |
| 354 | kEnvReverbTypeUUID); |
| 355 | const auto max = std::max_element( |
| 356 | descList.begin(), descList.end(), |
| 357 | [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a, |
| 358 | const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) { |
| 359 | return a.second.capability.get<Capability::environmentalReverb>().maxDelayMs < |
| 360 | b.second.capability.get<Capability::environmentalReverb>().maxDelayMs; |
| 361 | }); |
| 362 | if (max == descList.end()) { |
| 363 | return {0}; |
| 364 | } |
| 365 | int maxDelayMs = max->second.capability.get<Capability::environmentalReverb>().maxDelayMs; |
| 366 | return {-1, 0, maxDelayMs >> 1, maxDelayMs - 1, maxDelayMs, maxDelayMs + 1}; |
| 367 | } |
| 368 | |
| 369 | static std::unordered_set<int> getDiffusionValues() { |
| 370 | auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, |
| 371 | kEnvReverbTypeUUID); |
| 372 | const auto max = std::max_element( |
| 373 | descList.begin(), descList.end(), |
| 374 | [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a, |
| 375 | const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) { |
| 376 | return a.second.capability.get<Capability::environmentalReverb>() |
| 377 | .maxDiffusionPm < |
| 378 | b.second.capability.get<Capability::environmentalReverb>() |
| 379 | .maxDiffusionPm; |
| 380 | }); |
| 381 | if (max == descList.end()) { |
| 382 | return {0}; |
| 383 | } |
| 384 | int maxDiffusionPm = |
| 385 | max->second.capability.get<Capability::environmentalReverb>().maxDiffusionPm; |
| 386 | return {-1, 0, maxDiffusionPm >> 1, maxDiffusionPm - 1, maxDiffusionPm, maxDiffusionPm + 1}; |
| 387 | } |
| 388 | |
| 389 | static std::unordered_set<int> getDensityValues() { |
| 390 | auto descList = EffectFactoryHelper::getAllEffectDescriptors(IFactory::descriptor, |
| 391 | kEnvReverbTypeUUID); |
| 392 | const auto max = std::max_element( |
| 393 | descList.begin(), descList.end(), |
| 394 | [](const std::pair<std::shared_ptr<IFactory>, Descriptor>& a, |
| 395 | const std::pair<std::shared_ptr<IFactory>, Descriptor>& b) { |
| 396 | return a.second.capability.get<Capability::environmentalReverb>().maxDensityPm < |
| 397 | b.second.capability.get<Capability::environmentalReverb>().maxDensityPm; |
| 398 | }); |
| 399 | if (max == descList.end()) { |
| 400 | return {0}; |
| 401 | } |
| 402 | int maxDensityPm = |
| 403 | max->second.capability.get<Capability::environmentalReverb>().maxDensityPm; |
| 404 | return {-1, 0, maxDensityPm >> 1, maxDensityPm - 1, maxDensityPm, maxDensityPm + 1}; |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 405 | } |
| 406 | |
| 407 | private: |
| 408 | std::vector<std::pair<EnvironmentalReverb::Tag, EnvironmentalReverb>> mTags; |
| 409 | void CleanUp() { mTags.clear(); } |
| 410 | }; |
| 411 | |
| 412 | class EnvironmentalReverbRoomLevelTest |
| 413 | : public ::testing::TestWithParam< |
| 414 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>, |
| 415 | public EnvironmentalReverbHelper { |
| 416 | public: |
| 417 | EnvironmentalReverbRoomLevelTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 418 | mRoomLevel = std::get<1>(GetParam()); |
| 419 | } |
| 420 | |
| 421 | void SetUp() override { SetUpReverb(); } |
| 422 | |
| 423 | void TearDown() override { TearDownReverb(); } |
| 424 | }; |
| 425 | |
| 426 | TEST_P(EnvironmentalReverbRoomLevelTest, SetAndGetRoomLevel) { |
| 427 | EXPECT_NO_FATAL_FAILURE(addRoomLevelParam()); |
| 428 | SetAndGetReverbParameters(); |
| 429 | } |
| 430 | |
| 431 | INSTANTIATE_TEST_SUITE_P( |
| 432 | EnvironmentalReverbTest, EnvironmentalReverbRoomLevelTest, |
| 433 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 434 | IFactory::descriptor, kEnvReverbTypeUUID)), |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 435 | testing::ValuesIn(EnvironmentalReverbHelper::getRoomLevelValues())), |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 436 | [](const testing::TestParamInfo<EnvironmentalReverbRoomLevelTest::ParamType>& info) { |
| 437 | auto descriptor = std::get<0>(info.param).second; |
| 438 | std::string roomLevel = std::to_string(std::get<1>(info.param)); |
| 439 | |
| 440 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 441 | descriptor.common.name + "_UUID_" + |
| 442 | descriptor.common.id.uuid.toString() + "_roomLevel" + roomLevel; |
| 443 | std::replace_if( |
| 444 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 445 | return name; |
| 446 | }); |
| 447 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbRoomLevelTest); |
| 448 | |
| 449 | class EnvironmentalReverbRoomHfLevelTest |
| 450 | : public ::testing::TestWithParam< |
| 451 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>, |
| 452 | public EnvironmentalReverbHelper { |
| 453 | public: |
| 454 | EnvironmentalReverbRoomHfLevelTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 455 | mRoomHfLevel = std::get<1>(GetParam()); |
| 456 | } |
| 457 | |
| 458 | void SetUp() override { SetUpReverb(); } |
| 459 | |
| 460 | void TearDown() override { TearDownReverb(); } |
| 461 | }; |
| 462 | |
| 463 | TEST_P(EnvironmentalReverbRoomHfLevelTest, SetAndGetRoomHfLevel) { |
| 464 | EXPECT_NO_FATAL_FAILURE(addRoomHfLevelParam(mRoomHfLevel)); |
| 465 | SetAndGetReverbParameters(); |
| 466 | } |
| 467 | |
| 468 | INSTANTIATE_TEST_SUITE_P( |
| 469 | EnvironmentalReverbTest, EnvironmentalReverbRoomHfLevelTest, |
| 470 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 471 | IFactory::descriptor, kEnvReverbTypeUUID)), |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 472 | testing::ValuesIn(EnvironmentalReverbHelper::getRoomHfLevelValues())), |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 473 | [](const testing::TestParamInfo<EnvironmentalReverbRoomHfLevelTest::ParamType>& info) { |
| 474 | auto descriptor = std::get<0>(info.param).second; |
| 475 | std::string roomHfLevel = std::to_string(std::get<1>(info.param)); |
| 476 | |
| 477 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 478 | descriptor.common.name + "_UUID_" + |
| 479 | descriptor.common.id.uuid.toString() + "_roomHfLevel" + roomHfLevel; |
| 480 | std::replace_if( |
| 481 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 482 | return name; |
| 483 | }); |
| 484 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbRoomHfLevelTest); |
| 485 | |
| 486 | class EnvironmentalReverbDecayTimeTest |
| 487 | : public ::testing::TestWithParam< |
| 488 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>, |
| 489 | public EnvironmentalReverbHelper { |
| 490 | public: |
| 491 | EnvironmentalReverbDecayTimeTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 492 | mDecayTime = std::get<1>(GetParam()); |
| 493 | } |
| 494 | |
| 495 | void SetUp() override { SetUpReverb(); } |
| 496 | |
| 497 | void TearDown() override { TearDownReverb(); } |
| 498 | }; |
| 499 | |
| 500 | TEST_P(EnvironmentalReverbDecayTimeTest, SetAndGetDecayTime) { |
| 501 | EXPECT_NO_FATAL_FAILURE(addDecayTimeParam(mDecayTime)); |
| 502 | SetAndGetReverbParameters(); |
| 503 | } |
| 504 | |
| 505 | INSTANTIATE_TEST_SUITE_P( |
| 506 | EnvironmentalReverbTest, EnvironmentalReverbDecayTimeTest, |
| 507 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 508 | IFactory::descriptor, kEnvReverbTypeUUID)), |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 509 | testing::ValuesIn(EnvironmentalReverbHelper::getDecayTimeValues())), |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 510 | [](const testing::TestParamInfo<EnvironmentalReverbDecayTimeTest::ParamType>& info) { |
| 511 | auto descriptor = std::get<0>(info.param).second; |
| 512 | std::string decayTime = std::to_string(std::get<1>(info.param)); |
| 513 | |
| 514 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 515 | descriptor.common.name + "_UUID_" + |
| 516 | descriptor.common.id.uuid.toString() + "_decayTime" + decayTime; |
| 517 | std::replace_if( |
| 518 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 519 | return name; |
| 520 | }); |
| 521 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDecayTimeTest); |
| 522 | |
| 523 | class EnvironmentalReverbDecayHfRatioTest |
| 524 | : public ::testing::TestWithParam< |
| 525 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>, |
| 526 | public EnvironmentalReverbHelper { |
| 527 | public: |
| 528 | EnvironmentalReverbDecayHfRatioTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 529 | mDecayHfRatio = std::get<1>(GetParam()); |
| 530 | } |
| 531 | |
| 532 | void SetUp() override { SetUpReverb(); } |
| 533 | |
| 534 | void TearDown() override { TearDownReverb(); } |
| 535 | }; |
| 536 | |
| 537 | TEST_P(EnvironmentalReverbDecayHfRatioTest, SetAndGetDecayHfRatio) { |
| 538 | EXPECT_NO_FATAL_FAILURE(addDecayHfRatioParam(mDecayHfRatio)); |
| 539 | SetAndGetReverbParameters(); |
| 540 | } |
| 541 | |
| 542 | INSTANTIATE_TEST_SUITE_P( |
| 543 | EnvironmentalReverbTest, EnvironmentalReverbDecayHfRatioTest, |
| 544 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 545 | IFactory::descriptor, kEnvReverbTypeUUID)), |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 546 | testing::ValuesIn(EnvironmentalReverbHelper::getDecayHfRatioValues())), |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 547 | [](const testing::TestParamInfo<EnvironmentalReverbDecayHfRatioTest::ParamType>& info) { |
| 548 | auto descriptor = std::get<0>(info.param).second; |
| 549 | std::string decayHfRatio = std::to_string(std::get<1>(info.param)); |
| 550 | |
| 551 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 552 | descriptor.common.name + "_UUID_" + |
| 553 | descriptor.common.id.uuid.toString() + "_decayHfRatio" + |
| 554 | decayHfRatio; |
| 555 | std::replace_if( |
| 556 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 557 | return name; |
| 558 | }); |
| 559 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDecayHfRatioTest); |
| 560 | |
| 561 | class EnvironmentalReverbLevelTest |
| 562 | : public ::testing::TestWithParam< |
| 563 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>, |
| 564 | public EnvironmentalReverbHelper { |
| 565 | public: |
| 566 | EnvironmentalReverbLevelTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 567 | mLevel = std::get<1>(GetParam()); |
| 568 | } |
| 569 | |
| 570 | void SetUp() override { SetUpReverb(); } |
| 571 | |
| 572 | void TearDown() override { TearDownReverb(); } |
| 573 | }; |
| 574 | |
| 575 | TEST_P(EnvironmentalReverbLevelTest, SetAndGetLevel) { |
| 576 | EXPECT_NO_FATAL_FAILURE(addLevelParam(mLevel)); |
| 577 | SetAndGetReverbParameters(); |
| 578 | } |
| 579 | |
| 580 | INSTANTIATE_TEST_SUITE_P( |
| 581 | EnvironmentalReverbTest, EnvironmentalReverbLevelTest, |
| 582 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 583 | IFactory::descriptor, kEnvReverbTypeUUID)), |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 584 | testing::ValuesIn(EnvironmentalReverbHelper::getLevelValues())), |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 585 | [](const testing::TestParamInfo<EnvironmentalReverbDecayHfRatioTest::ParamType>& info) { |
| 586 | auto descriptor = std::get<0>(info.param).second; |
| 587 | std::string level = std::to_string(std::get<1>(info.param)); |
| 588 | |
| 589 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 590 | descriptor.common.name + "_UUID_" + |
| 591 | descriptor.common.id.uuid.toString() + "_level" + level; |
| 592 | std::replace_if( |
| 593 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 594 | return name; |
| 595 | }); |
| 596 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbLevelTest); |
| 597 | |
| 598 | class EnvironmentalReverbDelayTest |
| 599 | : public ::testing::TestWithParam< |
| 600 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>, |
| 601 | public EnvironmentalReverbHelper { |
| 602 | public: |
| 603 | EnvironmentalReverbDelayTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 604 | mDelay = std::get<1>(GetParam()); |
| 605 | } |
| 606 | |
| 607 | void SetUp() override { SetUpReverb(); } |
| 608 | |
| 609 | void TearDown() override { TearDownReverb(); } |
| 610 | }; |
| 611 | |
| 612 | TEST_P(EnvironmentalReverbDelayTest, SetAndGetDelay) { |
| 613 | EXPECT_NO_FATAL_FAILURE(addDelayParam(mDelay)); |
| 614 | SetAndGetReverbParameters(); |
| 615 | } |
| 616 | |
| 617 | INSTANTIATE_TEST_SUITE_P( |
| 618 | EnvironmentalReverbTest, EnvironmentalReverbDelayTest, |
| 619 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 620 | IFactory::descriptor, kEnvReverbTypeUUID)), |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 621 | testing::ValuesIn(EnvironmentalReverbHelper::getDelayValues())), |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 622 | [](const testing::TestParamInfo<EnvironmentalReverbDelayTest::ParamType>& info) { |
| 623 | auto descriptor = std::get<0>(info.param).second; |
| 624 | std::string delay = std::to_string(std::get<1>(info.param)); |
| 625 | |
| 626 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 627 | descriptor.common.name + "_UUID_" + |
| 628 | descriptor.common.id.uuid.toString() + "_delay" + delay; |
| 629 | std::replace_if( |
| 630 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 631 | return name; |
| 632 | }); |
| 633 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDelayTest); |
| 634 | |
| 635 | class EnvironmentalReverbDiffusionTest |
| 636 | : public ::testing::TestWithParam< |
| 637 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>, |
| 638 | public EnvironmentalReverbHelper { |
| 639 | public: |
| 640 | EnvironmentalReverbDiffusionTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 641 | mDiffusion = std::get<1>(GetParam()); |
| 642 | } |
| 643 | |
| 644 | void SetUp() override { SetUpReverb(); } |
| 645 | |
| 646 | void TearDown() override { TearDownReverb(); } |
| 647 | }; |
| 648 | |
| 649 | TEST_P(EnvironmentalReverbDiffusionTest, SetAndGetDiffusion) { |
| 650 | EXPECT_NO_FATAL_FAILURE(addDiffusionParam(mDiffusion)); |
| 651 | SetAndGetReverbParameters(); |
| 652 | } |
| 653 | |
| 654 | INSTANTIATE_TEST_SUITE_P( |
| 655 | EnvironmentalReverbTest, EnvironmentalReverbDiffusionTest, |
| 656 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 657 | IFactory::descriptor, kEnvReverbTypeUUID)), |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 658 | testing::ValuesIn(EnvironmentalReverbHelper::getDiffusionValues())), |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 659 | [](const testing::TestParamInfo<EnvironmentalReverbDiffusionTest::ParamType>& info) { |
| 660 | auto descriptor = std::get<0>(info.param).second; |
| 661 | std::string diffusion = std::to_string(std::get<1>(info.param)); |
| 662 | |
| 663 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 664 | descriptor.common.name + "_UUID_" + |
| 665 | descriptor.common.id.uuid.toString() + "_diffusion" + diffusion; |
| 666 | std::replace_if( |
| 667 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 668 | return name; |
| 669 | }); |
| 670 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDiffusionTest); |
| 671 | |
| 672 | class EnvironmentalReverbDensityTest |
| 673 | : public ::testing::TestWithParam< |
| 674 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int>>, |
| 675 | public EnvironmentalReverbHelper { |
| 676 | public: |
| 677 | EnvironmentalReverbDensityTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 678 | mDensity = std::get<1>(GetParam()); |
| 679 | } |
| 680 | |
| 681 | void SetUp() override { SetUpReverb(); } |
| 682 | |
| 683 | void TearDown() override { TearDownReverb(); } |
| 684 | }; |
| 685 | |
| 686 | TEST_P(EnvironmentalReverbDensityTest, SetAndGetDensity) { |
| 687 | EXPECT_NO_FATAL_FAILURE(addDensityParam(mDensity)); |
| 688 | SetAndGetReverbParameters(); |
| 689 | } |
| 690 | |
| 691 | INSTANTIATE_TEST_SUITE_P( |
| 692 | EnvironmentalReverbTest, EnvironmentalReverbDensityTest, |
| 693 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 694 | IFactory::descriptor, kEnvReverbTypeUUID)), |
Sham Rathod | e362a46 | 2023-01-05 18:46:21 +0530 | [diff] [blame] | 695 | testing::ValuesIn(EnvironmentalReverbHelper::getDensityValues())), |
Shraddha Basantwani | dbb0ed6 | 2022-11-17 20:32:18 +0530 | [diff] [blame] | 696 | [](const testing::TestParamInfo<EnvironmentalReverbDensityTest::ParamType>& info) { |
| 697 | auto descriptor = std::get<0>(info.param).second; |
| 698 | std::string density = std::to_string(std::get<1>(info.param)); |
| 699 | |
| 700 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 701 | descriptor.common.name + "_UUID_" + |
| 702 | descriptor.common.id.uuid.toString() + "_density" + density; |
| 703 | std::replace_if( |
| 704 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 705 | return name; |
| 706 | }); |
| 707 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbDensityTest); |
| 708 | |
| 709 | class EnvironmentalReverbBypassTest |
| 710 | : public ::testing::TestWithParam< |
| 711 | std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, bool>>, |
| 712 | public EnvironmentalReverbHelper { |
| 713 | public: |
| 714 | EnvironmentalReverbBypassTest() : EnvironmentalReverbHelper(std::get<0>(GetParam())) { |
| 715 | mBypass = std::get<1>(GetParam()); |
| 716 | } |
| 717 | |
| 718 | void SetUp() override { SetUpReverb(); } |
| 719 | |
| 720 | void TearDown() override { TearDownReverb(); } |
| 721 | }; |
| 722 | |
| 723 | TEST_P(EnvironmentalReverbBypassTest, SetAndGetBypass) { |
| 724 | EXPECT_NO_FATAL_FAILURE(addBypassParam(mBypass)); |
| 725 | SetAndGetReverbParameters(); |
| 726 | } |
| 727 | |
| 728 | INSTANTIATE_TEST_SUITE_P( |
| 729 | EnvironmentalReverbTest, EnvironmentalReverbBypassTest, |
| 730 | ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors( |
| 731 | IFactory::descriptor, kEnvReverbTypeUUID)), |
| 732 | testing::Bool()), |
| 733 | [](const testing::TestParamInfo<EnvironmentalReverbBypassTest::ParamType>& info) { |
| 734 | auto descriptor = std::get<0>(info.param).second; |
| 735 | std::string bypass = std::to_string(std::get<1>(info.param)); |
| 736 | |
| 737 | std::string name = "Implementor_" + descriptor.common.implementor + "_name_" + |
| 738 | descriptor.common.name + "_UUID_" + |
| 739 | descriptor.common.id.uuid.toString() + "_bypass" + bypass; |
| 740 | std::replace_if( |
| 741 | name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_'); |
| 742 | return name; |
| 743 | }); |
| 744 | GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(EnvironmentalReverbBypassTest); |
| 745 | |
| 746 | int main(int argc, char** argv) { |
| 747 | ::testing::InitGoogleTest(&argc, argv); |
| 748 | ABinderProcess_setThreadPoolMaxThreadCount(1); |
| 749 | ABinderProcess_startThreadPool(); |
| 750 | return RUN_ALL_TESTS(); |
| 751 | } |