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 16import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; 17import { Want } from '@kit.AbilityKit'; 18import { Log } from '../../../main/ets/common/utils/utils'; 19import PermissionStateSheetAbility from '../../../main/ets/PermissionSheet/PermissionStateSheetAbility'; 20import AbilityConstant from '@ohos.app.ability.AbilityConstant'; 21import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession'; 22 23let want: Want = { 24 abilityName: '', 25 parameters: { 26 'ohos.sensitive.resource': 'microphone', 27 'ohos.display.id': 0 28 } 29}; 30 31export default function PermissionStateSheetAbilityTest() { 32 describe('PermissionStateSheetAbilityTest', () => { 33 // Defines a test suite. Two parameters are supported: test suite name and test suite function. 34 beforeAll(() => { 35 // Presets an action, which is performed only once before all test cases of the test suite start. 36 // This API supports only one parameter: preset action function. 37 }) 38 beforeEach(() => { 39 // Presets an action, which is performed before each unit test case starts. 40 // The number of execution times is the same as the number of test cases defined by **it**. 41 // This API supports only one parameter: preset action function. 42 }) 43 afterEach(() => { 44 // Presets a clear action, which is performed after each unit test case ends. 45 // The number of execution times is the same as the number of test cases defined by **it**. 46 // This API supports only one parameter: clear action function. 47 }) 48 afterAll(() => { 49 // Presets a clear action, which is performed after all test cases of the test suite end. 50 // This API supports only one parameter: clear action function. 51 }) 52 53 it('PermissionStateSheetAbilityTest_000', 0, () => { 54 Log.info(`PermissionStateSheetAbilityTest_000 begin`); 55 let ability = new PermissionStateSheetAbility(); 56 let param: AbilityConstant.LaunchParam = { 57 launchReason: 0, 58 lastExitReason: 0, 59 lastExitMessage: '' 60 }; 61 ability.onCreate(param); 62 }) 63 64 it('PermissionStateSheetAbilityTest_002', 0, () => { 65 Log.info(`PermissionStateSheetAbilityTest_002 begin`); 66 let ability = new PermissionStateSheetAbility(); 67 ability.onForeground(); 68 }) 69 70 it('PermissionStateSheetAbilityTest_003', 0, () => { 71 Log.info(`PermissionStateSheetAbilityTest_003 begin`); 72 let ability = new PermissionStateSheetAbility(); 73 ability.onBackground(); 74 }) 75 76 it('PermissionStateSheetAbilityTest_004', 0, () => { 77 Log.info(`PermissionStateSheetAbilityTest_004 begin`); 78 let ability = new PermissionStateSheetAbility(); 79 ability.onSessionDestroy(); 80 }) 81 82 it('PermissionStateSheetAbilityTest_005', 0, () => { 83 Log.info(`PermissionStateSheetAbilityTest_005 begin`); 84 let ability = new PermissionStateSheetAbility(); 85 ability.onDestroy() 86 }) 87 }) 88}