diff --git a/ability/ability_runtime/actsforresult/forresulttest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsforresult/forresulttest/signature/openharmony_sx.p7b index a16b3e4710160ef4fa3502ee406fe42a8bdc74af..a2d09096e3a6018969de68d273fa723cb67d3fd2 100644 Binary files a/ability/ability_runtime/actsforresult/forresulttest/signature/openharmony_sx.p7b and b/ability/ability_runtime/actsforresult/forresulttest/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsforresult/main/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts b/ability/ability_runtime/actsforresult/main/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts index eb7bcc3a7fd059465ba45417764d1377d447e9e1..ac561280112564d3d825b35a00bdc3adcd80ffc2 100644 --- a/ability/ability_runtime/actsforresult/main/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts +++ b/ability/ability_runtime/actsforresult/main/entry/src/main/ets/UIExtensionAbility/UIExtAbility.ts @@ -59,7 +59,7 @@ export default class UIExtAbility extends UIExtensionAbility { } if (want.action === 'AsyncCallback_0300') { - console.info('=======>UIExtAbility onSessionCreate want.action == AsyncCallback_0200======>'); + console.info('=======>UIExtAbility onSessionCreate want.action == AsyncCallback_0300======>'); this.context.startAbilityForResult({ action: 'AsyncCallback_0300', bundleName: 'com.example.mainhap', diff --git a/ability/ability_runtime/actsforresult/main/entry/src/main/ets/entryability/EntryAbility.ts b/ability/ability_runtime/actsforresult/main/entry/src/main/ets/entryability/EntryAbility.ts index 7b1d03ea7b6cabf027bf744a10249f6dd0367142..3beb062939f41578b065119cefa4bd50209a5c1d 100644 --- a/ability/ability_runtime/actsforresult/main/entry/src/main/ets/entryability/EntryAbility.ts +++ b/ability/ability_runtime/actsforresult/main/entry/src/main/ets/entryability/EntryAbility.ts @@ -19,12 +19,12 @@ import window from '@ohos.window'; export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate'); - globalThis.terminate = () => { + globalThis.terminate = (str) => { setTimeout(() => { this.context.terminateSelf().then(() => { - console.debug("====>terminateSelf end"); + console.info("====>terminateSelf " + JSON.stringify(str) + " end"); }).catch((err) => { - console.debug("====>terminateSelf err:" + JSON.stringify(err)); + console.info("====>terminateSelf " + JSON.stringify(str) + " err:" + JSON.stringify(err)); }); }, 50) }; diff --git a/ability/ability_runtime/actsforresult/main/signature/openharmony_sx.p7b b/ability/ability_runtime/actsforresult/main/signature/openharmony_sx.p7b index 5e31a34b0f09788261fcdfaa2b8183b9cc00e21e..4edeeb9a19094e2e10903ccd7ceebc421357aa06 100644 Binary files a/ability/ability_runtime/actsforresult/main/signature/openharmony_sx.p7b and b/ability/ability_runtime/actsforresult/main/signature/openharmony_sx.p7b differ diff --git a/ability/ability_runtime/actsforresult/maintest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsforresult/maintest/entry/src/main/ets/test/Ability.test.ets index 5a2036c78c1379c4245c346fbc4adb3ea2544a92..92ec7ec4728bf1029674757a3dd14af0b80b7392 100644 --- a/ability/ability_runtime/actsforresult/maintest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsforresult/maintest/entry/src/main/ets/test/Ability.test.ets @@ -74,15 +74,12 @@ export default function abilityTest() { function unSubscribeCallback() { console.info(`====>AsyncCallback_0100 unSubscribeCallback 'ACTS_CALL_EVENT'`) - globalThis.terminate() + globalThis.terminate('AsyncCallback_0100') done() } }) it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0200',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { @@ -122,9 +119,7 @@ export default function abilityTest() { }) it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0300',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) + await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>AsyncCallback_0300 createSubscriber ${data}`) @@ -164,7 +159,7 @@ export default function abilityTest() { function unSubscribeCallback() { console.info(`====>AsyncCallback_0300 unSubscribeCallback 'ACTS_CALL_EVENT'`) setTimeout(() => { - globalThis.terminate() + globalThis.terminate('AsyncCallback_0300') abilityDelegator.executeShellCommand('aa force-stop com.example.forresulttestsecond').then((result) =>{ console.info('====>AsyncCallback_0300 unSubscribeCallback pkill ok' + JSON.stringify(result)); done() @@ -177,9 +172,6 @@ export default function abilityTest() { }) it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0400',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { @@ -216,16 +208,13 @@ export default function abilityTest() { console.info(`====>AsyncCallback_0400 unSubscribeCallback 'ACTS_CALL_EVENT'`) setTimeout(() => { - globalThis.terminate() + globalThis.terminate('AsyncCallback_0400') done() - }, 10000) + }, 1000) } }) it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0500',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { @@ -245,7 +234,7 @@ export default function abilityTest() { console.info(`====>AsyncCallback_0500 subscribeCallBack all ${data.event}`) if(data.event == 'ACTS_CALL_EVENT') { console.info(`====>AsyncCallback_0500 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`) - expect(data.parameters.result != 0).assertTrue(); + expect(data.parameters.num).assertEqual(16000001); commonEvent.unsubscribe(subscriber, unSubscribeCallback) } } @@ -253,16 +242,13 @@ export default function abilityTest() { function unSubscribeCallback() { console.info(`====>AsyncCallback_0500 unSubscribeCallback 'ACTS_CALL_EVENT'`) setTimeout(() => { - globalThis.terminate() + globalThis.terminate('AsyncCallback_0500') done() }, 2000) } }) it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0600',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { @@ -304,9 +290,7 @@ export default function abilityTest() { it('ACTS_UIExtensionAbility_StartAbilityForResult_AsyncCallback_0700',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) + await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>AsyncCallback_0700 createSubscriber ${data}`) @@ -346,9 +330,7 @@ export default function abilityTest() { }) it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0100',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) + await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>Promise_0100 createSubscriber ${data}`) @@ -374,15 +356,12 @@ export default function abilityTest() { function unSubscribeCallback() { console.info(`====>Promise_0100 unSubscribeCallback 'ACTS_CALL_EVENT'`) - globalThis.terminate() + globalThis.terminate('Promise_0100') done() } }) it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0200',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>Promise_0200 createSubscriber ${data}`) @@ -416,9 +395,7 @@ export default function abilityTest() { }) it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0300',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) + await Driver.create().delayMs(2000) var subscriber await commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>Promise_0300 createSubscriber ${data}`) @@ -452,7 +429,7 @@ export default function abilityTest() { expect(data.parameters.str).assertEqual('ACTION'); expect(data.parameters.result).assertEqual(0); } - globalThis.terminate() + globalThis.terminate('Promise_0300') abilityDelegator.executeShellCommand('aa force-stop com.example.forresulttestsecond').then(result =>{ console.info('====>Promise_0300 unSubscribeCallback pkill ok' + JSON.stringify(result)); commonEvent.unsubscribe(subscriber, unSubscribeCallback) @@ -469,9 +446,7 @@ export default function abilityTest() { }) it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0400',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) + await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>Promise_0400 createSubscriber ${data}`) @@ -506,16 +481,14 @@ export default function abilityTest() { function unSubscribeCallback() { console.info(`====>Promise_0400 unSubscribeCallback 'ACTS_CALL_EVENT'`) setTimeout(() => { - globalThis.terminate() + globalThis.terminate('Promise_0400') done() }, 1000) } }) it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0500',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) + await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>Promise_0500 createSubscriber ${data}`) @@ -534,24 +507,22 @@ export default function abilityTest() { console.info(`====>Promise_0500 subscribeCallBack all ${data.event}`) if(data.event == 'ACTS_CALL_EVENT') { console.info(`====>Promise_0500 subscribeCallBack 'ACTS_CALL_EVENT' ${data}`) - expect(data.parameters.result != 0).assertTrue(); + expect(data.parameters.num).assertEqual(16000001); commonEvent.unsubscribe(subscriber, unSubscribeCallback) } } function unSubscribeCallback() { console.info(`====>Promise_0500 unSubscribeCallback 'ACTS_CALL_EVENT'`) + globalThis.terminate('Promise_0500') setTimeout(() => { - globalThis.terminate() done() - }, 2000) + }, 1000) } }) it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0600',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) + await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>Promise_0600 createSubscriber ${data}`) @@ -591,9 +562,7 @@ export default function abilityTest() { }) it('ACTS_UIExtensionAbility_StartAbilityForResult_Promise_0700',0, async function (done) { - await setTimeout(() => { - console.info(`====>beforeEach setTimeout'`) - }, 2000) + await Driver.create().delayMs(2000) var subscriber commonEvent.createSubscriber(ACTS_CallFunction).then(async (data) => { console.info(`====>Promise_0700 createSubscriber ${data}`) diff --git a/ability/ability_runtime/actsforresult/maintest/signature/openharmony_sx.p7b b/ability/ability_runtime/actsforresult/maintest/signature/openharmony_sx.p7b index 5e31a34b0f09788261fcdfaa2b8183b9cc00e21e..4edeeb9a19094e2e10903ccd7ceebc421357aa06 100644 Binary files a/ability/ability_runtime/actsforresult/maintest/signature/openharmony_sx.p7b and b/ability/ability_runtime/actsforresult/maintest/signature/openharmony_sx.p7b differ