1 /* 2 * Copyright (c) 2025 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 #include "audio_inner_call.h" 17 #include <gtest/gtest.h> 18 19 using namespace testing::ext; 20 using namespace std; 21 22 namespace OHOS { 23 namespace AudioStandard { 24 25 class AudioInnerCallUnitTest : public ::testing::Test { 26 public: SetUpTestCase()27 static void SetUpTestCase(){}; TearDownTestCase()28 static void TearDownTestCase(){}; SetUp()29 virtual void SetUp(){}; TearDown()30 virtual void TearDown(){}; 31 }; 32 33 /** 34 * @tc.name : Test GetIAudioServerInnerCall 35 * @tc.number : GetIAudioServerInnerCall_001 36 * @tc.desc : Test GetIAudioServerInnerCall 37 */ 38 HWTEST_F(AudioInnerCallUnitTest, GetIAudioServerInnerCall_001, TestSize.Level1) 39 { 40 AudioInnerCall *audioInnerCall = AudioInnerCall::GetInstance(); 41 ASSERT_NE(audioInnerCall, nullptr); 42 audioInnerCall->isAudioServerRegistered_ = false; 43 audioInnerCall->RegisterAudioServer(nullptr); 44 IAudioServerInnerCall *result = audioInnerCall->GetIAudioServerInnerCall(); 45 EXPECT_EQ(result, nullptr); 46 } 47 48 /** 49 * @tc.name : Test GetIAudioServerInnerCall 50 * @tc.number : GetIAudioServerInnerCall_002 51 * @tc.desc : Test GetIAudioServerInnerCall 52 */ 53 HWTEST_F(AudioInnerCallUnitTest, GetIAudioServerInnerCall_002, TestSize.Level1) 54 { 55 AudioInnerCall *audioInnerCall = AudioInnerCall::GetInstance(); 56 ASSERT_NE(audioInnerCall, nullptr); 57 audioInnerCall->isAudioServerRegistered_ = true; 58 audioInnerCall->RegisterAudioServer(nullptr); 59 IAudioServerInnerCall *result = audioInnerCall->GetIAudioServerInnerCall(); 60 EXPECT_EQ(result, nullptr); 61 } 62 } // namespace AudioStandard 63 } // namespace OHOS