diff --git a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets index d883b980c9608f83f98f5ccab50bff2804274707..32e87595eca233f7752932a4db398cdb1375d0e3 100644 --- a/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets +++ b/ability/ability_runtime/stage/actslifecyclesinglehaptest/entry/src/main/ets/test/LifeCycleTest.ets @@ -83,7 +83,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -138,7 +138,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility1", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -149,7 +149,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -212,7 +212,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility1", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -223,7 +223,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -297,7 +297,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility3", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start3 successful. Data: ' + data); }).catch((error) => { @@ -308,7 +308,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start2 successful. Data: ' + data); }).catch((error) => { @@ -386,7 +386,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility1", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start1 successful. Data: ' + data); }).catch((error) => { @@ -397,7 +397,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility3", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start3 successful. Data: ' + data); }).catch((error) => { @@ -418,7 +418,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility4", } - globalThis.globalThis.abilityContext.startAbility(str2) + globalThis.abilityContext.startAbility(str2) .then((data) => { console.info(TAG + ' start4 successful. Data: ' + data); }).catch((error) => { @@ -463,7 +463,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility1", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start1 successful. Data: ' + data); }).catch((error) => { @@ -474,7 +474,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility5", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start5 successful. Data: ' + data); }).catch((error) => { @@ -486,7 +486,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str2) + globalThis.abilityContext.startAbility(str2) .then((data) => { console.info(TAG + ' start2 successful. Data: ' + data); }).catch((error) => { @@ -619,7 +619,7 @@ export default function lifecycleTest() { listKey8.push(abilityname + " onAbilityContinue"); } } - let applicationContext = globalThis.globalThis.abilityContext.getApplicationContext(); + let applicationContext = globalThis.abilityContext.getApplicationContext(); id1 = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback); console.log(TAG + " registerAbilityLifecycleCallback1 number: " + JSON.stringify(id1)); applicationContext.unregisterAbilityLifecycleCallback(id1, (error, data) => { @@ -668,7 +668,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility1", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -679,7 +679,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -691,7 +691,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -704,7 +704,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -775,7 +775,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility1", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -786,7 +786,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -798,7 +798,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -866,7 +866,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility6", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -881,7 +881,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -919,7 +919,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility7", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -934,7 +934,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility7", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -983,7 +983,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility8", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -998,7 +998,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility8", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1167,7 +1167,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility11", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1178,7 +1178,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1194,7 +1194,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility11", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1205,7 +1205,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1347,7 +1347,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility12", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1358,7 +1358,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1390,7 +1390,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility12", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1401,7 +1401,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1459,7 +1459,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility1", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1470,7 +1470,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility12", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1481,7 +1481,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str2) + globalThis.abilityContext.startAbility(str2) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1534,7 +1534,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility1", } - globalThis.globalThis.abilityContext.startAbility(str) + globalThis.abilityContext.startAbility(str) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1545,7 +1545,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility12", } - globalThis.globalThis.abilityContext.startAbility(str1) + globalThis.abilityContext.startAbility(str1) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1556,7 +1556,7 @@ export default function lifecycleTest() { "bundleName": "com.example.lifecycle_xts", "abilityName": "MainAbility2", } - globalThis.globalThis.abilityContext.startAbility(str2) + globalThis.abilityContext.startAbility(str2) .then((data) => { console.info(TAG + ' start successful. Data: ' + data); }).catch((error) => { @@ -1609,12 +1609,12 @@ export default function lifecycleTest() { expect(exlist[2]).assertEqual("MainAbility2 onAbilityForeground"); expect(exlist[3]).assertEqual("MainAbility2 onAbilityBackground"); expect(exlist[4]).assertEqual("MainAbility2 onWindowStageDestroy"); - expect(exlist12[0]).assertEqual("MainAbility2 onAbilityDestroy"); - expect(exlist12[1]).assertEqual("MainAbility12 onAbilityCreate"); - expect(exlist12[2]).assertEqual("MainAbility12 onWindowStageCreate"); - expect(exlist12[3]).assertEqual("MainAbility12 onAbilityForeground"); - expect(exlist12[4]).assertEqual("MainAbility12 onAbilityBackground"); - expect(exlist12[5]).assertEqual("MainAbility12 onAbilityForeground"); + expect(exlist[5]).assertEqual("MainAbility2 onAbilityDestroy"); + expect(exlist12[0]).assertEqual("MainAbility12 onAbilityCreate"); + expect(exlist12[1]).assertEqual("MainAbility12 onWindowStageCreate"); + expect(exlist12[2]).assertEqual("MainAbility12 onAbilityForeground"); + expect(exlist12[3]).assertEqual("MainAbility12 onAbilityBackground"); + expect(exlist12[4]).assertEqual("MainAbility12 onAbilityForeground"); expect(exlist1[0]).assertEqual("MainAbility2 onAbilityCreate"); expect(exlist1[1]).assertEqual("MainAbility2 onWindowStageCreate"); expect(exlist1[2]).assertEqual("MainAbility2 onAbilityForeground");