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 #ifndef AUDIO_ADAPTER_MANAGER_UNIT_TEST_H 17 #define AUDIO_ADAPTER_MANAGER_UNIT_TEST_H 18 19 #include "gtest/gtest.h" 20 #include "audio_adapter_manager.h" 21 #include "audio_interrupt_service.h" 22 #include "audio_policy_server_handler.h" 23 #include "audio_zone_service.h" 24 25 namespace OHOS { 26 namespace AudioStandard { 27 28 class AudioAdapterManagerUnitTest : public testing::Test { 29 public: 30 // SetUpTestCase: Called before all test cases 31 static void SetUpTestCase(void); 32 // TearDownTestCase: Called after all test case 33 static void TearDownTestCase(void); 34 SetUp()35 void SetUp() override 36 { 37 std::shared_ptr<AudioPolicyServerHandler> handler = std::make_shared<AudioPolicyServerHandler>(); 38 std::shared_ptr<AudioInterruptService> interruptService = std::make_shared<AudioInterruptService>(); 39 AudioZoneService::GetInstance().Init(handler, interruptService); 40 AudioZoneContext context; 41 zoneId1_ = AudioZoneService::GetInstance().CreateAudioZone("TestZone1", context, 0); 42 zoneId2_ = AudioZoneService::GetInstance().CreateAudioZone("TestZone2", context, 0); 43 } 44 TearDown()45 void TearDown() override 46 { 47 zoneId1_ = 0; 48 zoneId2_ = 0; 49 AudioZoneService::GetInstance().DeInit(); 50 } 51 52 int32_t zoneId1_ = 0; 53 int32_t zoneId2_ = 0; 54 }; 55 } // namespace AudioStandard 56 } // namespace OHOS 57 #endif //AUDIO_ADAPTER_MANAGER_UNIT_TEST_H