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 SLE_AUDIO_DEVICE_MANAGER_UNIT_TEST_H 17 #define SLE_AUDIO_DEVICE_MANAGER_UNIT_TEST_H 18 19 #include "gtest/gtest.h" 20 #include "sle_audio_device_manager.h" 21 #include "audio_errors.h" 22 23 namespace OHOS { 24 namespace AudioStandard { 25 26 class SleAudioDeviceManagerUnitTest : public testing::Test { 27 public: 28 // SetUpTestCase: Called before all test cases 29 static void SetUpTestCase(void); 30 // TearDownTestCase: Called after all test case 31 static void TearDownTestCase(void); 32 // SetUp: Called before each test cases 33 void SetUp(void); 34 // TearDown: Called after each test cases 35 void TearDown(void); 36 }; 37 38 class IStandardSleAudioOperationCallbackTest : public IStandardSleAudioOperationCallback { 39 public: AsObject()40 sptr<IRemoteObject> AsObject() override 41 { 42 return nullptr; 43 } 44 GetSleAudioDeviceList(std::vector<AudioDeviceDescriptor> & devices)45 int32_t GetSleAudioDeviceList(std::vector<AudioDeviceDescriptor> &devices) override 46 { 47 return SUCCESS; 48 } 49 GetSleVirtualAudioDeviceList(std::vector<AudioDeviceDescriptor> & devices)50 int32_t GetSleVirtualAudioDeviceList(std::vector<AudioDeviceDescriptor> &devices) override 51 { 52 return SUCCESS; 53 } 54 IsInBandRingOpen(const std::string & device,bool & ret)55 int32_t IsInBandRingOpen(const std::string &device, bool &ret) override 56 { 57 ret = true; 58 return SUCCESS; 59 } 60 GetSupportStreamType(const std::string & device,uint32_t & retType)61 int32_t GetSupportStreamType(const std::string &device, uint32_t &retType) override 62 { 63 retType = SUCCESS; 64 return SUCCESS; 65 } 66 SetActiveSinkDevice(const std::string & device,uint32_t streamType,int32_t & ret)67 int32_t SetActiveSinkDevice(const std::string &device, uint32_t streamType, int32_t &ret) override 68 { 69 ret = SUCCESS; 70 return SUCCESS; 71 } 72 StartPlaying(const std::string & device,uint32_t streamType,int32_t & ret)73 int32_t StartPlaying(const std::string &device, uint32_t streamType, int32_t &ret) override 74 { 75 ret = SUCCESS; 76 return SUCCESS; 77 } 78 StopPlaying(const std::string & device,uint32_t streamType,int32_t & ret)79 int32_t StopPlaying(const std::string &device, uint32_t streamType, int32_t &ret) override 80 { 81 ret = SUCCESS; 82 return SUCCESS; 83 } 84 ConnectAllowedProfiles(const std::string & remoteAddr,int32_t & ret)85 int32_t ConnectAllowedProfiles(const std::string &remoteAddr, int32_t &ret) override 86 { 87 ret = SUCCESS; 88 return SUCCESS; 89 } 90 SetDeviceAbsVolume(const std::string & remoteAddr,uint32_t volume,uint32_t streamType,int32_t & ret)91 int32_t SetDeviceAbsVolume(const std::string &remoteAddr, uint32_t volume, uint32_t streamType, 92 int32_t &ret) override 93 { 94 ret = SUCCESS; 95 return SUCCESS; 96 } 97 SendUserSelection(const std::string & device,uint32_t streamType,int32_t & ret)98 int32_t SendUserSelection(const std::string &device, uint32_t streamType, int32_t &ret) override 99 { 100 ret = SUCCESS; 101 return SUCCESS; 102 } 103 GetRenderPosition(const std::string & device,uint32_t & delayValue)104 int32_t GetRenderPosition(const std::string &device, uint32_t &delayValue) override 105 { 106 return SUCCESS; 107 } 108 }; 109 110 } // namespace AudioStandard 111 } // namespace OHOS 112 #endif // SLE_AUDIO_DEVICE_MANAGER_UNIT_TEST_H