1 /* 2 * Copyright (c) 2021-2022 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_TEST_H 17 #define AUDIO_POLICY_TEST_H 18 19 #include <audio_system_manager.h> 20 #include <gtest/gtest.h> 21 #include <audio_policy_log.h> 22 23 namespace OHOS { 24 namespace AudioStandard { 25 namespace V1_0 { 26 using namespace std; 27 using namespace testing; 28 29 struct PolicyParam { 30 float volume; 31 AudioStreamType streamType; 32 AudioRingerMode ringerMode; 33 ActiveDeviceType actDeviceType; 34 DeviceType deviceType; 35 DeviceFlag deviceFlag; 36 DeviceRole deviceRole; 37 AudioScene audioScene; 38 bool active; 39 bool mute; 40 string key; 41 string value; 42 }; 43 44 class AudioRingerModeCallbackTest : public AudioRingerModeCallback { 45 public: 46 AudioRingerMode ringerMode_; 47 void OnRingerModeUpdated(const AudioRingerMode &ringerMode) override; 48 }; 49 50 class AudioPolicyTest : public TestWithParam<PolicyParam> { 51 public: AudioPolicyTest()52 AudioPolicyTest() {} 53 ~AudioPolicyTest()54 virtual ~AudioPolicyTest() {} 55 56 // SetUpTestCase: Called before all test cases 57 static void SetUpTestCase(void); 58 // TearDownTestCase: Called after all test case 59 static void TearDownTestCase(void); 60 // SetUp: Called before each test cases 61 void SetUp(void) override; 62 // TearDown: Called after each test cases 63 void TearDown(void) override; 64 }; 65 } // namespace V1_0 66 } // namespace AudioStandard 67 } // namespace OHOS 68 #endif // AUDIO_POLICY_TEST_H 69