• 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 { Configuration } from '@ohos.app.ability.Configuration';
19import { Log } from '../../../main/ets/common/utils/utils';
20import SecurityExtAbility from '../../../main/ets/SecurityExtAbility/SecurityExtAbility';
21
22let want: Want = {
23  abilityName: '',
24  parameters: {
25    'ohos.sensitive.resource': 'microphone',
26    'ohos.display.id': 0
27  }
28};
29
30let configuration: Configuration = {
31  language: ''
32}
33
34export default function SecurityExtAbilityTest() {
35  describe('SecurityExtAbilityTest', () => {
36    // Defines a test suite. Two parameters are supported: test suite name and test suite function.
37    beforeAll(() => {
38      // Presets an action, which is performed only once before all test cases of the test suite start.
39      // This API supports only one parameter: preset action function.
40    })
41    beforeEach(() => {
42      // Presets an action, which is performed before each unit test case starts.
43      // The number of execution times is the same as the number of test cases defined by **it**.
44      // This API supports only one parameter: preset action function.
45    })
46    afterEach(() => {
47      // Presets a clear action, which is performed after each unit test case ends.
48      // The number of execution times is the same as the number of test cases defined by **it**.
49      // This API supports only one parameter: clear action function.
50    })
51    afterAll(() => {
52      // Presets a clear action, which is performed after all test cases of the test suite end.
53      // This API supports only one parameter: clear action function.
54    })
55
56    it('SecurityExtAbilityTest_000', 0, () => {
57      Log.info(`SecurityExtAbilityTest_000 begin`);
58      let ability = new SecurityExtAbility();
59      ability.onCreate(want);
60    })
61
62    it('SecurityExtAbilityTest_001', 0, () => {
63      Log.info(`SecurityExtAbilityTest_001 begin`);
64      let ability = new SecurityExtAbility();
65      ability.onRequest(want, 1);
66    })
67
68    it('SecurityExtAbilityTest_002', 0, () => {
69      Log.info(`SecurityExtAbilityTest_002 begin`);
70      let ability = new SecurityExtAbility();
71      ability.onConfigurationUpdate(configuration);
72    })
73
74    it('SecurityExtAbilityTest_003', 0, () => {
75      Log.info(`SecurityExtAbilityTest_003 begin`);
76      let ability = new SecurityExtAbility();
77      ability.onDestroy();
78    })
79  })
80}