1 /* 2 * Copyright (c) 2022-2023 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 16 #ifndef OHOS_AUDIO_MANAGER_TEST_UTILS 17 #define OHOS_AUDIO_MANAGER_TEST_UTILS 18 19 #include "daudio_errorcode.h" 20 #include "iaudio_data_transport.h" 21 #include "iaudio_event_callback.h" 22 23 namespace OHOS { 24 namespace DistributedHardware { 25 class MockIAudioEventCallback : public IAudioEventCallback { 26 public: 27 MockIAudioEventCallback() = default; 28 ~MockIAudioEventCallback() = default; 29 NotifyEvent(const AudioEvent & event)30 void NotifyEvent(const AudioEvent &event) override 31 { 32 (void) event; 33 } 34 }; 35 36 class MockIAudioDataTransport : public IAudioDataTransport { 37 public: 38 MockIAudioDataTransport() = default; 39 ~MockIAudioDataTransport() = default; 40 SetUp(const AudioParam & localParam,const AudioParam & remoteParam,const std::shared_ptr<IAudioDataTransCallback> & callback,const PortCapType capType)41 int32_t SetUp(const AudioParam &localParam, const AudioParam &remoteParam, 42 const std::shared_ptr<IAudioDataTransCallback> &callback, const PortCapType capType) override 43 { 44 return DH_SUCCESS; 45 } 46 Start()47 int32_t Start() override 48 { 49 return DH_SUCCESS; 50 } 51 Stop()52 int32_t Stop() override 53 { 54 return DH_SUCCESS; 55 } 56 Release()57 int32_t Release() override 58 { 59 return DH_SUCCESS; 60 } 61 Pause()62 int32_t Pause() override 63 { 64 return DH_SUCCESS; 65 } 66 Restart(const AudioParam & localParam,const AudioParam & remoteParam)67 int32_t Restart(const AudioParam &localParam, const AudioParam &remoteParam) override 68 { 69 return DH_SUCCESS; 70 } 71 FeedAudioData(std::shared_ptr<AudioData> & audioData)72 int32_t FeedAudioData(std::shared_ptr<AudioData> &audioData) override 73 { 74 return DH_SUCCESS; 75 } 76 InitEngine(IAVEngineProvider * providerPtr)77 int32_t InitEngine(IAVEngineProvider *providerPtr) override 78 { 79 return DH_SUCCESS; 80 } 81 SendMessage(uint32_t type,std::string content,std::string dstDevId)82 int32_t SendMessage(uint32_t type, std::string content, std::string dstDevId) override 83 { 84 return 0; 85 } 86 CreateCtrl()87 int32_t CreateCtrl() override 88 { 89 return 0; 90 } 91 }; 92 } // namespace DistributedHardware 93 } // namespace OHOS 94 #endif // OHOS_AUDIO_MANAGER_TEST_UTILS 95