• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 &microphoneBlockedInfo) 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;}
GetSplitInfoRefined(std::string & splitInfo)64     virtual int32_t GetSplitInfoRefined(std::string &splitInfo)
65         override {return 0;}
OnDistributedOutputChange(bool isRemote)66     virtual int32_t OnDistributedOutputChange(bool isRemote)
67         override {return 0;}
68 };
69 
70 class ConcreteAudioDeviceAnahs : public AudioDeviceAnahs {
71 public:
OnExtPnpDeviceStatusChanged(std::string anahsStatus,std::string anahsShowType)72     int32_t OnExtPnpDeviceStatusChanged(std::string anahsStatus, std::string anahsShowType) override { return 0; }
73 };
74 
75 class ConcreteAudioManagerAudioSceneChangedCallback : public AudioManagerAudioSceneChangedCallback {
76 public:
OnAudioSceneChange(const AudioScene audioScene)77     void OnAudioSceneChange(const AudioScene audioScene) override {}
78 };
79 
80 class AudioPolicyManagerUnitTest : public testing::Test {
81 public:
82     // SetUpTestCase: Called before all test cases
83     static void SetUpTestCase(void);
84     // TearDownTestCase: Called after all test case
85     static void TearDownTestCase(void);
86     // SetUp: Called before each test cases
87     void SetUp(void);
88     // TearDown: Called after each test cases
89     void TearDown(void);
90 };
91 } // namespace AudioStandard
92 } // namespace OHOS
93 #endif // AUDIO_POLICY_MANAGER_UNIT_TEST_H
94