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 16import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit'; 17import abilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; 18 19import { Hypium } from '../../index'; 20 21import testsuite from '../test/List.test'; 22const ON_DESTROY_ERROR = -2; 23 24export default class TestAbility extends UIAbility { 25 private abilityDelegator: abilityDelegatorRegistry.AbilityDelegator; 26 27 constructor() { 28 super(); 29 this.abilityDelegator = abilityDelegatorRegistry.getAbilityDelegator(); 30 } 31 32 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { 33 const abilityDelegatorArguments = abilityDelegatorRegistry.getArguments(); 34 Hypium.hypiumTest(this.abilityDelegator, abilityDelegatorArguments, testsuite); 35 } 36 37 onDestroy() { 38 this.abilityDelegator.finishTest('TestAbility onDestory unexpectedly!', ON_DESTROY_ERROR); 39 } 40 onWindowStageDestroy() {} 41 42 onForeground() {} 43 44 onBackground() {} 45} 46