From 21cb99f085804ac47e743d2384d68646d1e2f75a Mon Sep 17 00:00:00 2001 From: chengxingzhen Date: Wed, 24 Aug 2022 16:47:28 +0800 Subject: [PATCH] =?UTF-8?q?XTS=E6=8E=A5=E5=8F=A3=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chengxingzhen --- .../entry/src/main/ets/test/Ability.test.ets | 5 ++- .../entry/src/main/ets/test/Ability.test.ets | 2 ++ .../main/ets/ServiceAbility/ServiceAbility.ts | 2 ++ .../main/ets/test/ApiCoverAbility.test.ets | 31 +++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) diff --git a/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets index 37cbf1f99..9b3273043 100644 --- a/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets @@ -109,7 +109,10 @@ export default function abilityTest() { data.addAbilityMonitor( { abilityName: 'MainAbility2', - onAbilityForeground: onAbilityForeground + onAbilityForeground: onAbilityForeground, + onWindowStageRestore:(Ability)=>{ + console.info("===>onWindowStageRestore"); + } }, (async (err) => { console.debug("====>ACTS_AddAbilityMonitor_0200 success====>" + err.code); await globalThis.abilitydelegator.startAbility( diff --git a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets index aefa1ec9e..06b6e8e82 100644 --- a/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets @@ -97,6 +97,8 @@ export default function abilityTest() { var state = abilityDelegator.getAbilityState(ability); console.debug("====>ACTS_GetAbilityState_0300 state:" + state); expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.FOREGROUND); + expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.CREATE).assertTrue() + expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.DESTROY).assertTrue() abilityDelegator.doAbilityBackground(ability, (err, isBackground)=>{ console.debug("====>doAbilityBackground_0300 data:" + JSON.stringify(isBackground)); expect(isBackground).assertTrue(); diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts index 9aaa52cb2..981797990 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -21,11 +21,13 @@ export default class ServiceAbility extends ServiceExtension { onCreate(want:Want) { globalThis.abilityWant = want; let direction = this.context.config.direction + let pointerDervice = this.context.config.hasPointerDevice let AbilityInfo = this.context.extensionAbilityInfo.bundleName console.log('ServiceAbility onCreate, want: ' + want.abilityName); var CommonEventPublishData = { parameters: { "config": direction, + "poniterDevices": pointerDervice, "AbilityInfo":AbilityInfo } } diff --git a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets index a68e1537d..255de016c 100644 --- a/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets +++ b/ability/ability_runtime/apicover/apicoverhaptest/entry/src/main/ets/test/ApiCoverAbility.test.ets @@ -418,6 +418,35 @@ export default function ApiCoverTest() { }) }); + /* + * @tc.number SUB_AA_Test_ProcessRunningInformation_0200 + * @tc.name Test getProcessRunningInformation by callback in appManager. + * @tc.desc Function test + * @tc.level 3 + */ + it('SUB_AA_Test_ProcessRunningInformation_0200', 0, async function (done) { + let process; + appManager.getProcessRunningInformation((error, processRunningInformations)=>{ + if(error.code == 0){ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations)); + for(let i = 0; i < processRunningInformations.length; i++){ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(processRunningInformations[i])); + expect(processRunningInformations[i].pid).assertLarger(0) + expect(processRunningInformations[i].uid).assertLarger(0) + if(processRunningInformations[i].processName == "com.example.apicoverhaptest"){ + process = processRunningInformations[i] + } + } + expect(process.bundleNames[0]).assertEqual("com.example.apicoverhaptest") + done() + }else{ + console.info("SUB_AA_Test_ProcessRunningInformation_0100:" + JSON.stringify(error)); + expect().assertFail() + done() + } + }) + }); + /* * @tc.number SUB_AA_FMS_AbilityStage_0100 * @tc.name Start AbilityStage and get config. @@ -476,6 +505,7 @@ export default function ApiCoverTest() { function SubscribeInfoCallback(err, data) { console.info("SUB_AA_FMS_AbilityStage_0200===SubscribeInfoCallback===" + JSON.stringify(data)) expect(data.parameters["config"]).assertEqual(0) + expect(data.parameters["poniterDevices"]).assertFalse() expect(data.parameters["AbilityInfo"]).assertEqual("com.example.apicoverhaptest") commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback) done() @@ -508,6 +538,7 @@ export default function ApiCoverTest() { */ it('SUB_AA_FMS_AcquireForm_0100', 0, async function (done) { let subscriber = null + let formExtensionContext:appContext.FormExtensionContext let subscribeInfo = { events: ["Form_StartAbility"] } -- GitLab