• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 GlobalSwitchSheetAbility from '../../../main/ets/PermissionSheet/GlobalSwitchSheetAbility';
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 GlobalSwitchSheetAbilityTest() {
32  describe('GlobalSwitchSheetAbilityTest', () => {
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('GlobalSwitchSheetAbilityTest_000', 0, () => {
54      Log.info(`GlobalSwitchSheetAbilityTest_000 begin`);
55      let ability = new GlobalSwitchSheetAbility();
56      let param: AbilityConstant.LaunchParam = {
57        launchReason: 0,
58        lastExitReason: 0,
59        lastExitMessage: ''
60      };
61      ability.onCreate(param);
62    })
63
64    it('GlobalSwitchSheetAbilityTest_002', 0, () => {
65      Log.info(`GlobalSwitchSheetAbilityTest_002 begin`);
66      let ability = new GlobalSwitchSheetAbility();
67      ability.onForeground();
68    })
69
70    it('GlobalSwitchSheetAbilityTest_003', 0, () => {
71      Log.info(`GlobalSwitchSheetAbilityTest_003 begin`);
72      let ability = new GlobalSwitchSheetAbility();
73      ability.onBackground();
74    })
75
76    it('GlobalSwitchSheetAbilityTest_004', 0, () => {
77      Log.info(`GlobalSwitchSheetAbilityTest_004 begin`);
78      let ability = new GlobalSwitchSheetAbility();
79      ability.onSessionDestroy();
80    })
81
82    it('GlobalSwitchSheetAbilityTest_005', 0, () => {
83      Log.info(`GlobalSwitchSheetAbilityTest_005 begin`);
84      let ability = new GlobalSwitchSheetAbility();
85      ability.onDestroy()
86    })
87  })
88}