MainAbility.ts 1.8 KB
Newer Older
Y
yangzk 已提交
1
import Ability from '@ohos.app.ability.UIAbility'
J
jiyong_sd 已提交
2 3 4
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from '@ohos/hypium'
import testsuite from '../test/List.test'
M
Mupceet 已提交
5 6 7 8 9 10

export default class MainAbility extends Ability {
    onCreate(want,launchParam){
        // Ability is creating, initialize resources for this ability
        console.log("[Demo] MainAbility onCreate")
        globalThis.abilityWant = want;
J
jiyong_sd 已提交
11 12 13 14 15 16
        var abilityDelegator: any
        abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator()
        var abilityDelegatorArguments: any
        abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments()
        console.info('start run testcase!!!')
        Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite)
M
Mupceet 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29
    }

    onDestroy() {
        // Ability is destroying, release resources for this ability
        console.log("[Demo] MainAbility onDestroy")
    }

    onWindowStageCreate(windowStage) {
        // Main window is created, set main page for this ability
        console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage)
        //globalThis.windowStage = windowStage
        //globalThis.abilityStorage = this.storage
        globalThis.abilityContext = this.context
J
jiyong_sd 已提交
30
        windowStage.setUIContent(this.context, "MainAbility/pages/index/index", null)
M
Mupceet 已提交
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
    }

    onWindowStageDestroy() {
        //Main window is destroyed, release UI related resources
        console.log("[Demo] MainAbility onWindowStageDestroy")
    }

    onForeground() {
        // Ability has brought to foreground
        console.log("[Demo] MainAbility onForeground")
    }

    onBackground() {
        // Ability has back to background
        console.log("[Demo] MainAbility onBackground")
    }
};