From 5c9ba456e29a2e9b8938a4f107276a5a67612ac9 Mon Sep 17 00:00:00 2001 From: zhoujun62 Date: Tue, 27 Sep 2022 22:27:42 +0800 Subject: [PATCH] XTS SUB_AA_OpenHarmony_IsTerminating_0500 fail Signed-off-by: zhoujun62 --- .../ets/test/AbilityIsTerminating.test.ets | 2 +- .../src/main/ets/test/VerificationTest.ets | 28 ++----------------- .../main/ets/ServiceAbility/ServiceAbility.ts | 10 +++++++ .../entry/src/main/ets/test/Ability.test.ets | 8 ++---- 4 files changed, 16 insertions(+), 32 deletions(-) diff --git a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/AbilityIsTerminating.test.ets b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/AbilityIsTerminating.test.ets index ed89fd387..7371f0eca 100644 --- a/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/AbilityIsTerminating.test.ets +++ b/ability/ability_runtime/actssupportfunction/actssupportfunctiontest/entry/src/main/ets/test/AbilityIsTerminating.test.ets @@ -224,4 +224,4 @@ export default function AbilityIsTerminatingTest() { }) }) }) -} \ No newline at end of file +} diff --git a/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets b/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets index 3250494c2..efe1453e2 100644 --- a/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets +++ b/ability/ability_runtime/faapicover/faapicoverhaptest/entry/src/main/ets/test/VerificationTest.ets @@ -134,35 +134,26 @@ export default function verificationTest(){ try { let list1 = [] - let list2 = ["Fa_Auxiliary_MainAbility4_onDestroy", "Fa_Auxiliary_MainAbility5_onDestroy"] + let list2 = ["Fa_Auxiliary_MainAbility4_onDestroy"] let number1 = undefined - let number2 = undefined let number3 = undefined let code1 = 536870912 let code2 = 2048 let subscriber = null let subscribeInfo = { - events: ["Fa_Auxiliary_MainAbility4_onCreate", "Fa_Auxiliary_MainAbility4_onDestroy", - "Fa_Auxiliary_MainAbility5_onCreate", "Fa_Auxiliary_MainAbility5_onDestroy"] + events: ["Fa_Auxiliary_MainAbility4_onCreate", "Fa_Auxiliary_MainAbility4_onDestroy"] } function SubscribeInfoCallback(err, data) { console.info(TAG + "===SubscribeInfoCallback===" + JSON.stringify(data)) if (data.event == "Fa_Auxiliary_MainAbility4_onCreate") { number1 = data.parameters.flags } - if (data.event == "Fa_Auxiliary_MainAbility5_onCreate") { - number2 = data.parameters.flags - } if (data.event == "Fa_Auxiliary_MainAbility4_onDestroy") { list1[0] = "Fa_Auxiliary_MainAbility4_onDestroy" } - if (data.event == "Fa_Auxiliary_MainAbility5_onDestroy") { - list1[1] = "Fa_Auxiliary_MainAbility5_onDestroy" - } if (JSON.stringify(list1) == JSON.stringify(list2)) { expect(number3).assertEqual(1); expect(number1).assertEqual(code1); - expect(number2).assertEqual(code2); commonEvent.unsubscribe(subscriber, UnSubscribeInfoCallback) } } @@ -204,21 +195,6 @@ export default function verificationTest(){ expect().assertFail(); done(); }); - - let wantNum3 = { - want: { - bundleName: 'ohos.acts.aafwk.test.faauxiliary', - abilityName: 'ohos.acts.aafwk.test.faauxiliary.MainAbility5', - flags: wantConstant.Flags.FLAG_INSTALL_ON_DEMAND - } - } - await ability_featureAbility.startAbility(wantNum3).then((data) => { - console.info(TAG + "startAbility data = " + JSON.stringify(data)); - }).catch((err) => { - console.info(TAG + "startAbility err = " + JSON.stringify(err)); - expect().assertFail(); - done(); - }); } catch (err) { console.info(TAG + "catch err = " + JSON.stringify(err)); expect().assertFail(); diff --git a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts index b1c64a712..213d8a9b8 100644 --- a/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts +++ b/ability/ability_runtime/newwant/actsnewwantrelyhap/entry/src/main/ets/ServiceAbility/ServiceAbility.ts @@ -17,6 +17,15 @@ import ServiceExtension from '@ohos.application.ServiceExtensionAbility'; import Want from '@ohos.application.Want'; import rpc from "@ohos.rpc"; +function sleep(delay) { + let start = new Date().getTime(); + while (true) { + if (new Date().getTime() - start > delay) { + break; + } + } +} + export default class ServiceAbility extends ServiceExtension { onCreate(want: Want) { globalThis.abilityWant = want; @@ -28,6 +37,7 @@ export default class ServiceAbility extends ServiceExtension { } onConnect(want) { + sleep(1000) var connId; console.log('ACTS_NewWant ServiceAbility onConnect, want:' + want.abilityName); globalThis.extensionContext = this.context diff --git a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets index 7fa7e6243..31a1abf9d 100644 --- a/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/newwant/actsnewwanttest/entry/src/main/ets/test/Ability.test.ets @@ -611,10 +611,8 @@ export default function abilityTest() { console.debug("ACTS_NewWant_Test_0800====>flagOnNewWant:====>" + flagOnNewWant) - if ((flagOnCreate == 0 && flagOnWindowStageCreate == 0 - && flagOnForeground == 2 && flagOnNewWant == 1) - || (flagOnCreate == 1 && flagOnWindowStageCreate == 1 - && flagOnForeground == 2 && flagOnNewWant == 0)) { + if (flagOnCreate == 0 && flagOnWindowStageCreate == 0 + && flagOnForeground == 2 && flagOnNewWant == 1) { flagNewWant = true; commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } @@ -626,4 +624,4 @@ export default function abilityTest() { } }) }) -} \ No newline at end of file +} -- GitLab