1 /* 2 * Copyright (c) 2021-2024 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 AUDIO_POLICY_MANAGER_UNIT_TEST_H 17 #define AUDIO_POLICY_MANAGER_UNIT_TEST_H 18 19 #include "gtest/gtest.h" 20 #include "audio_policy_manager.h" 21 22 namespace OHOS { 23 namespace AudioStandard { 24 class ConcreteAudioRingerModeCallback : public AudioRingerModeCallback { 25 public: OnRingerModeUpdated(const AudioRingerMode & ringerMode)26 void OnRingerModeUpdated(const AudioRingerMode &ringerMode) override {} 27 }; 28 29 class ConcreteAudioManagerMicrophoneBlockedCallback : public AudioManagerMicrophoneBlockedCallback { 30 public: OnMicrophoneBlocked(const MicrophoneBlockedInfo & microphoneBlockedInfo)31 void OnMicrophoneBlocked(const MicrophoneBlockedInfo µphoneBlockedInfo) override {} 32 }; 33 34 class ConcreteAudioRendererStateChange : public AudioRendererStateChangeCallback { 35 public: OnRendererStateChange(const std::vector<std::shared_ptr<AudioRendererChangeInfo>> & audioRendererChangeInfos)36 void OnRendererStateChange( 37 const std::vector<std::shared_ptr<AudioRendererChangeInfo>> &audioRendererChangeInfos) override {} 38 }; 39 40 class ConcreteAudioCapturerStateChangeCallback : public AudioCapturerStateChangeCallback { 41 public: OnCapturerStateChange(const std::vector<std::shared_ptr<AudioCapturerChangeInfo>> & audioCapturerChangeInfos)42 void OnCapturerStateChange( 43 const std::vector<std::shared_ptr<AudioCapturerChangeInfo>> &audioCapturerChangeInfos) override {} 44 }; 45 46 class ConcreteAudioSessionCallback : public AudioSessionCallback { 47 public: OnAudioSessionDeactive(const AudioSessionDeactiveEvent & deactiveEvent)48 void OnAudioSessionDeactive(const AudioSessionDeactiveEvent &deactiveEvent) override {} 49 }; 50 51 class ConcreteHeadTrackingDataRequestedChangeCallback : public HeadTrackingDataRequestedChangeCallback { 52 public: OnHeadTrackingDataRequestedChange(bool isRequested)53 void OnHeadTrackingDataRequestedChange(bool isRequested) override {} 54 }; 55 56 class ConcreteAudioDeviceRefiner : public AudioDeviceRefiner { 57 public: OnAudioOutputDeviceRefined(std::vector<std::shared_ptr<AudioDeviceDescriptor>> & descs,RouterType routerType,StreamUsage streamUsage,int32_t clientUid,AudioPipeType audioPipeType)58 virtual int32_t OnAudioOutputDeviceRefined(std::vector<std::shared_ptr<AudioDeviceDescriptor>> &descs, 59 RouterType routerType, StreamUsage streamUsage, int32_t clientUid, AudioPipeType audioPipeType) 60 override { return 0; } OnAudioInputDeviceRefined(std::vector<std::shared_ptr<AudioDeviceDescriptor>> & descs,RouterType routerType,SourceType sourceType,int32_t clientUid,AudioPipeType audioPipeType)61 virtual int32_t OnAudioInputDeviceRefined(std::vector<std::shared_ptr<AudioDeviceDescriptor>> &descs, 62 RouterType routerType, SourceType sourceType, int32_t clientUid, AudioPipeType audioPipeType) 63 override {return 0;} 64 }; 65 66 class ConcreteAudioDeviceAnahs : public AudioDeviceAnahs { 67 public: OnExtPnpDeviceStatusChanged(std::string anahsStatus,std::string anahsShowType)68 int32_t OnExtPnpDeviceStatusChanged(std::string anahsStatus, std::string anahsShowType) override { return 0; } 69 }; 70 71 class ConcreteAudioManagerAudioSceneChangedCallback : public AudioManagerAudioSceneChangedCallback { 72 public: OnAudioSceneChange(const AudioScene audioScene)73 void OnAudioSceneChange(const AudioScene audioScene) override {} 74 }; 75 76 class AudioPolicyManagerUnitTest : public testing::Test { 77 public: 78 // SetUpTestCase: Called before all test cases 79 static void SetUpTestCase(void); 80 // TearDownTestCase: Called after all test case 81 static void TearDownTestCase(void); 82 // SetUp: Called before each test cases 83 void SetUp(void); 84 // TearDown: Called after each test cases 85 void TearDown(void); 86 }; 87 } // namespace AudioStandard 88 } // namespace OHOS 89 #endif // AUDIO_POLICY_MANAGER_UNIT_TEST_H 90