1 /* 2 * Copyright (c) 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_CLIENT_STUB_IMPL_TEST_H 17 #define AUDIO_POLICY_CLIENT_STUB_IMPL_TEST_H 18 19 #include "gtest/gtest.h" 20 #include "audio_policy_client_stub_impl.h" 21 22 namespace OHOS { 23 namespace AudioStandard { 24 25 class AudioPolicyClientStubImplTest : public testing::Test { 26 public: 27 // SetUpTestCase: Called before all test cases 28 static void SetUpTestCase(void); 29 // TearDownTestCase: Called after all test case 30 static void TearDownTestCase(void); 31 // SetUp: Called before each test cases 32 void SetUp(void); 33 // TearDown: Called after each test cases 34 void TearDown(void); 35 }; 36 37 class ConcreteVolumeKeyEventCallback : public VolumeKeyEventCallback { 38 public: ConcreteVolumeKeyEventCallback()39 ConcreteVolumeKeyEventCallback() {} OnVolumeKeyEvent(VolumeEvent volumeEvent)40 void OnVolumeKeyEvent(VolumeEvent volumeEvent) override {} OnVolumeDegreeEvent(VolumeEvent volumeEvent)41 void OnVolumeDegreeEvent(VolumeEvent volumeEvent) override {} 42 }; 43 44 class ConcreteAudioFocusInfoChangeCallback : public AudioFocusInfoChangeCallback { 45 public: ConcreteAudioFocusInfoChangeCallback()46 ConcreteAudioFocusInfoChangeCallback() {} OnAudioFocusInfoChange(const std::list<std::pair<AudioInterrupt,AudioFocuState>> & focusInfoList)47 void OnAudioFocusInfoChange(const std::list<std::pair<AudioInterrupt, AudioFocuState>> &focusInfoList) override {} 48 }; 49 50 class ConcreteAudioManagerDeviceChangeCallback : public AudioManagerDeviceChangeCallback { 51 public: ConcreteAudioManagerDeviceChangeCallback()52 ConcreteAudioManagerDeviceChangeCallback() {} OnDeviceChange(const DeviceChangeAction & deviceChangeAction)53 void OnDeviceChange(const DeviceChangeAction &deviceChangeAction) override {} 54 }; 55 56 class ConcreteAudioRingerModeCallback : public AudioRingerModeCallback { 57 public: ConcreteAudioRingerModeCallback()58 ConcreteAudioRingerModeCallback() {}; OnRingerModeUpdated(const AudioRingerMode & ringerMode)59 void OnRingerModeUpdated(const AudioRingerMode &ringerMode) override {} 60 }; 61 62 class ConcreteAudioSessionCallback : public AudioSessionCallback { 63 public: OnAudioSessionDeactive(const AudioSessionDeactiveEvent & deactiveEvent)64 void OnAudioSessionDeactive(const AudioSessionDeactiveEvent &deactiveEvent) override {} 65 }; 66 67 class ConcreteAudioManagerMicStateChangeCallback : public AudioManagerMicStateChangeCallback { OnMicStateUpdated(const MicStateChangeEvent & micStateChangeEvent)68 void OnMicStateUpdated(const MicStateChangeEvent &micStateChangeEvent) override {} 69 }; 70 71 class ConcreteAudioManagerMicrophoneBlockedCallback : public AudioManagerMicrophoneBlockedCallback { OnMicrophoneBlocked(const MicrophoneBlockedInfo & microphoneBlockedInfo)72 void OnMicrophoneBlocked(const MicrophoneBlockedInfo µphoneBlockedInfo) override {} 73 }; 74 75 class ConcreteAudioPreferredOutputDeviceChangeCallback : public AudioPreferredOutputDeviceChangeCallback { OnPreferredOutputDeviceUpdated(const std::vector<std::shared_ptr<AudioDeviceDescriptor>> & desc)76 void OnPreferredOutputDeviceUpdated(const std::vector<std::shared_ptr<AudioDeviceDescriptor>> &desc) override {} 77 }; 78 79 class ConcreteAudioPreferredInputDeviceChangeCallback : public AudioPreferredInputDeviceChangeCallback { OnPreferredInputDeviceUpdated(const std::vector<std::shared_ptr<AudioDeviceDescriptor>> & desc)80 void OnPreferredInputDeviceUpdated(const std::vector<std::shared_ptr<AudioDeviceDescriptor>> &desc) override {} 81 }; 82 83 class ConcreteAudioRendererStateChangeCallback : public AudioRendererStateChangeCallback { OnRendererStateChange(const std::vector<std::shared_ptr<AudioRendererChangeInfo>> & audioRendererChangeInfos)84 void OnRendererStateChange( 85 const std::vector<std::shared_ptr<AudioRendererChangeInfo>> &audioRendererChangeInfos) override {} 86 }; 87 88 class ConcreteDeviceChangeWithInfoCallback : public DeviceChangeWithInfoCallback { OnDeviceChangeWithInfo(const uint32_t sessionId,const AudioDeviceDescriptor & deviceInfo,const AudioStreamDeviceChangeReasonExt reason)89 void OnDeviceChangeWithInfo(const uint32_t sessionId, const AudioDeviceDescriptor &deviceInfo, 90 const AudioStreamDeviceChangeReasonExt reason) override {} OnRecreateStreamEvent(const uint32_t sessionId,const int32_t streamFlag,const AudioStreamDeviceChangeReasonExt reason)91 void OnRecreateStreamEvent(const uint32_t sessionId, const int32_t streamFlag, 92 const AudioStreamDeviceChangeReasonExt reason) override {} 93 }; 94 95 class ConcreteAudioCapturerStateChangeCallback : public AudioCapturerStateChangeCallback { OnCapturerStateChange(const std::vector<std::shared_ptr<AudioCapturerChangeInfo>> & audioCapturerChangeInfos)96 void OnCapturerStateChange( 97 const std::vector<std::shared_ptr<AudioCapturerChangeInfo>> &audioCapturerChangeInfos) override {} 98 }; 99 100 class ConcreteHeadTrackingDataRequestedChangeCallback : public HeadTrackingDataRequestedChangeCallback { OnHeadTrackingDataRequestedChange(bool isRequested)101 void OnHeadTrackingDataRequestedChange(bool isRequested) override {} 102 }; 103 104 class ConcreteAudioSpatializationEnabledChangeCallback : public AudioSpatializationEnabledChangeCallback { OnSpatializationEnabledChange(const bool & enabled)105 void OnSpatializationEnabledChange(const bool &enabled) override {} OnSpatializationEnabledChangeForAnyDevice(const std::shared_ptr<AudioDeviceDescriptor> & deviceDescriptor,const bool & enabled)106 void OnSpatializationEnabledChangeForAnyDevice(const std::shared_ptr<AudioDeviceDescriptor> &deviceDescriptor, 107 const bool &enabled) override {} 108 }; 109 110 class ConcreteAudioHeadTrackingEnabledChangeCallback : public AudioHeadTrackingEnabledChangeCallback { OnHeadTrackingEnabledChange(const bool & enabled)111 void OnHeadTrackingEnabledChange(const bool &enabled) override {} OnHeadTrackingEnabledChangeForAnyDevice(const std::shared_ptr<AudioDeviceDescriptor> & deviceDescriptor,const bool & enabled)112 void OnHeadTrackingEnabledChangeForAnyDevice(const std::shared_ptr<AudioDeviceDescriptor> &deviceDescriptor, 113 const bool &enabled) override {} 114 }; 115 116 class ConcreteSpatialEnabledChangeForCurrentDeviceCb : public AudioSpatializationEnabledChangeForCurrentDeviceCallback { OnSpatializationEnabledChangeForCurrentDevice(const bool & enabled)117 void OnSpatializationEnabledChangeForCurrentDevice(const bool &enabled) override {} 118 }; 119 120 class ConcreteAudioManagerAppVolumeChangeCallback : public AudioManagerAppVolumeChangeCallback { OnAppVolumeChangedForUid(int32_t appUid,const VolumeEvent & event)121 void OnAppVolumeChangedForUid(int32_t appUid, const VolumeEvent &event) override {}; 122 OnSelfAppVolumeChanged(const VolumeEvent & event)123 void OnSelfAppVolumeChanged(const VolumeEvent &event) override {}; 124 }; 125 126 class ConcreteAudioManagerAudioSceneChangedCallback : public AudioManagerAudioSceneChangedCallback { OnAudioSceneChange(const AudioScene audioScene)127 void OnAudioSceneChange(const AudioScene audioScene) override {}; 128 }; 129 130 class ConcreteAudioFormatUnsupportedErrorCallback : public AudioFormatUnsupportedErrorCallback { OnFormatUnsupportedError(const AudioErrors & errorCode)131 void OnFormatUnsupportedError(const AudioErrors &errorCode) override {}; 132 }; 133 134 class ConcreteSystemVolumeChangeCallback : public SystemVolumeChangeCallback { OnSystemVolumeChange(VolumeEvent volumeEvent)135 void OnSystemVolumeChange(VolumeEvent volumeEvent) override {}; 136 }; 137 138 class ConcreteAudioManagerActiveVolumeTypeChangeCallback : public AudioManagerActiveVolumeTypeChangeCallback { OnActiveVolumeTypeChanged(const AudioVolumeType & event)139 void OnActiveVolumeTypeChanged(const AudioVolumeType &event) override {}; 140 }; 141 142 class ConcreteAudioSessionStateChangedCallback : public AudioSessionStateChangedCallback { OnAudioSessionStateChanged(const AudioSessionStateChangedEvent & stateChangedEvent)143 void OnAudioSessionStateChanged(const AudioSessionStateChangedEvent &stateChangedEvent) override {}; 144 }; 145 146 class ConcreteAudioSessionCurrentDeviceChangedCallback : public AudioSessionCurrentDeviceChangedCallback { OnAudioSessionCurrentDeviceChanged(const CurrentOutputDeviceChangedEvent & deviceChangedEvent)147 void OnAudioSessionCurrentDeviceChanged(const CurrentOutputDeviceChangedEvent &deviceChangedEvent) override {}; 148 }; 149 150 class ConcreteStreamVolumeChangeCallback : public StreamVolumeChangeCallback { OnStreamVolumeChange(StreamVolumeEvent streamVolumeEvent)151 void OnStreamVolumeChange(StreamVolumeEvent streamVolumeEvent) override {}; 152 }; 153 } // namespace AudioStandard 154 } // namespace OHOS 155 #endif // AUDIO_POLICY_CLIENT_STUB_IMPL_TEST_H 156