1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef HPAE_AUDIO_SERVICE_DUMP_CALLBACK_UNIT_TEST_H 16 #define HPAE_AUDIO_SERVICE_DUMP_CALLBACK_UNIT_TEST_H 17 #include "audio_service_hpae_dump_callback.h" 18 19 namespace OHOS { 20 namespace AudioStandard { 21 class HpaeAudioServiceDumpCallbackUnitTest : public AudioServiceHpaeDumpCallback { 22 public: OnDumpSinkInfoCb(std::string & dumpStr,int32_t result)23 void OnDumpSinkInfoCb(std::string& dumpStr, int32_t result) override {} OnDumpSourceInfoCb(std::string & dumpStr,int32_t result)24 void OnDumpSourceInfoCb(std::string &dumpStr, int32_t result) override {} OnDumpAllAvailableDeviceCb(int32_t result)25 void OnDumpAllAvailableDeviceCb(int32_t result) override {} OnDumpSinkInputsInfoCb(std::vector<HpaeInputOutputInfo> & sinkInputs,int32_t result)26 void OnDumpSinkInputsInfoCb(std::vector<HpaeInputOutputInfo> &sinkInputs, int32_t result) override 27 { 28 if (result == 0) { 29 sinkInputs_.swap(sinkInputs); 30 } 31 } OnDumpSourceOutputsInfoCb(std::vector<HpaeInputOutputInfo> & sourceOutputs,int32_t result)32 void OnDumpSourceOutputsInfoCb(std::vector<HpaeInputOutputInfo> &sourceOutputs, int32_t result) override 33 { 34 if (result == 0) { 35 sourceOutputs_.swap(sourceOutputs); 36 } 37 } ~HpaeAudioServiceDumpCallbackUnitTest()38 ~HpaeAudioServiceDumpCallbackUnitTest() override {} GetSinkInputsSize()39 size_t GetSinkInputsSize() 40 { 41 return sinkInputs_.size(); 42 } GetSourceOutputsSize()43 size_t GetSourceOutputsSize() 44 { 45 return sourceOutputs_.size(); 46 } 47 private: 48 std::vector<HpaeInputOutputInfo> sinkInputs_; 49 std::vector<HpaeInputOutputInfo> sourceOutputs_; 50 }; 51 } 52 } 53 #endif