diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts index 1f59e0610a8e2d81c31b546dedcd9824ae876628..2dacb6574be66d2f68efc846b3037f365a781aca 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts +++ b/ability/ability_runtime/actsusers/ActsAmsUsersApi7AppA/entry/src/main/ets/ServiceAbility/service.ts @@ -13,13 +13,13 @@ * limitations under the License. */ import commonEvent from "@ohos.commonEvent" -import featureAbility from '@ohos.ability.featureAbility' +import particleAbility from '@ohos.ability.particleAbility' export default { onStart() { console.info('ServiceAbility onStart'); commonEvent.publish("ACTS_InterfaceMultiUsers_0100_Start_CommonEvent", () => { console.log(" Publish ACTS_InterfaceMultiUsersExtension_CommonEvent callback") - featureAbility.terminateSelf().then(() => { + particleAbility.terminateSelf().then(() => { console.log('terminateSelf promise'); commonEvent.publish("ACTS_TerminateSelf_CommonEvent", () => { console.log(" Publish ACTS_TerminateSelf_CommonEvent callback") diff --git a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets index acc8ff7f6421555793e2b9dd5837e5416fc91576..c532c04c7d9322a2dd1f04af9eabc89285e0571b 100644 --- a/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets +++ b/ability/ability_runtime/actsusers/ActsAmsUsersSystemTest/entry/src/main/ets/test/Ability.test.ets @@ -65,6 +65,13 @@ export default function abilityTest() { }, 1000); }) + afterEach(async (done) => { + console.error("ACTS_InterfaceMultiUsers afterEach called"); + setTimeout(function() { + done(); + }, 500); + }) + console.debug("====>in ACTS_InterfaceMultiUsers====>"); /* * @tc.number : ACTS_startAbility_0100 @@ -72,24 +79,25 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options succeeded.(promise) */ it('ACTS_StartAbility_0100', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0100' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', @@ -97,14 +105,14 @@ export default function abilityTest() { }, { windowMode:0 }).then((data)=>{ - console.debug("====>startAbility end====>"); - console.debug("====>data is====>" + JSON.stringify(data)); + console.debug(TAG + "====>startAbility end====>"); + console.debug(TAG + "====>data is====>" + JSON.stringify(data)); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); done(); @@ -113,7 +121,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0100 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -127,20 +135,21 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options failed.(promise) */ it('ACTS_StartAbility_0200', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0200' let Subscriber function SubscribeCallBack (err, data) { expect().assertFail(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then((data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', @@ -148,18 +157,18 @@ export default function abilityTest() { }, { windowMode:0 }).then(()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); done(); } function timeout() { - console.debug('ACTS_startAbility_0200 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0200 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } @@ -172,12 +181,13 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options succeeded.(callback) */ it('ACTS_StartAbility_0300', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0300' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } @@ -185,12 +195,12 @@ export default function abilityTest() { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', @@ -198,14 +208,14 @@ export default function abilityTest() { }, { windowMode:0 },() => { - console.debug("====>startAbility end====>" ); + console.debug(TAG + "====>startAbility end====>" ); }) }) }) function UnSubscribeCallback() { flag = false - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); expect(startresult).assertEqual(true); done(); } @@ -213,7 +223,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0300 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0300 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -228,21 +238,22 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options failed.(callback) */ it('ACTS_StartAbility_0400', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0400' let Subscriber function SubscribeCallBack (err, data) { expect().assertFail(); - console.debug("====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0200 Subscribe CallBack data:====>" + JSON.stringify(data)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); }) - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.error', @@ -250,17 +261,17 @@ export default function abilityTest() { }, { windowMode:0 },() => { - console.debug("====>startAbility end====>" ); + console.debug(TAG + "====>startAbility end====>" ); }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); done(); } function timeout() { - console.debug('ACTS_startAbility_0400 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0400 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } @@ -274,37 +285,38 @@ export default function abilityTest() { * @tc.desc : Starting mainability2 with startability succeeded.(promise) */ it('ACTS_StartAbility_0500', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0500' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' }).then((data)=>{ - console.debug("====>startAbility end====>"); - console.debug("====>data is====>" + JSON.stringify(data)); + console.debug(TAG + "====>startAbility end====>"); + console.debug(TAG + "====>data is====>" + JSON.stringify(data)); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); done(); @@ -313,7 +325,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0100 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -327,12 +339,13 @@ export default function abilityTest() { * @tc.desc : Starting mainability2 with startability succeeded.(callback) */ it('ACTS_StartAbility_0700', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0700' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } @@ -340,25 +353,25 @@ export default function abilityTest() { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' },() => { - console.debug("====>startAbility end====>" ); + console.debug(TAG + "====>startAbility end====>" ); }) }) }) function UnSubscribeCallback() { flag = false - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); expect(startresult).assertEqual(true); done(); } @@ -366,7 +379,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0300 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0300 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -381,36 +394,37 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options succeeded.(promise) */ it('ACTS_StartAbility_0900', 0, async function (done) { + let TAG = 'ACTS_StartAbility_0900' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.example.userservicesystemapi7', abilityName: 'com.example.userservicesystemapi7.ServiceAbility' }).then(()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); done(); @@ -419,7 +433,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_0900 - timeout'); + console.debug(TAG + 'ACTS_startAbility_0900 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -432,36 +446,37 @@ export default function abilityTest() { * @tc.desc : Start an ability with the parameter startability with options succeeded.(promise) */ it('ACTS_startAbility_1000', 0, async function (done) { + let TAG = 'ACTS_startAbility_1000' let Subscriber var flag = true var startresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent"){ startresult = true } commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.example.userservicesystemapi7', abilityName: 'com.example.userservicesystemapi7.ServiceAbility' },()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(startresult).assertEqual(true); done(); @@ -470,7 +485,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbility_1000 - timeout'); + console.debug(TAG + 'ACTS_startAbility_1000 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -484,16 +499,17 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult succeeded.(promise) */ it('ACTS_StartAbilityForResult_0100', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0100' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('AMS_startAbilityForResult_0100 - timeout'); + console.debug(TAG + 'AMS_startAbilityForResult_0100 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', @@ -501,9 +517,9 @@ export default function abilityTest() { }, { windowMode:0 }).then((data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false - console.debug("====>data.resultCode is====>"+JSON); + console.debug(TAG + "====>data.resultCode is====>"+JSON); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -516,12 +532,13 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult failed.(promise) */ it('ACTS_StartAbilityForResult_0200', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0200' function timeout() { - console.debug('ACTS_startAbilityForResult_0200 - timeout'); + console.debug(TAG + 'ACTS_startAbilityForResult_0200 - timeout'); done(); } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', @@ -529,7 +546,7 @@ export default function abilityTest() { }, { windowMode:0 }).then((data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); expect().assertFail(); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') @@ -543,16 +560,17 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult succeeded.(callback) */ it('ACTS_StartAbilityForResult_0300', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0300' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbilityForResult_0300 - timeout'); + console.debug(TAG + 'ACTS_startAbilityForResult_0300 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', @@ -560,7 +578,7 @@ export default function abilityTest() { },{ windowMode : 0 },(err,data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') @@ -574,12 +592,13 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult failed.(callback) */ it('ACTS_StartAbilityForResult_0400', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0400' function timeout() { - console.debug('ACTS_startAbilityForResult_0400 - timeout'); + console.debug(TAG + 'ACTS_startAbilityForResult_0400 - timeout'); done(); } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.error', @@ -588,7 +607,7 @@ export default function abilityTest() { windowMode:0 },(err,data)=>{ expect().assertFail(); - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -601,24 +620,25 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult succeeded.(promise) */ it('ACTS_StartAbilityForResult_0500', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0500' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('AMS_startAbilityForResult_0500 - timeout'); + console.debug(TAG + 'AMS_startAbilityForResult_0500 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', }).then((data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false - console.debug("====>data.resultCode is====>"+JSON); + console.debug(TAG + "====>data.resultCode is====>"+JSON); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -631,22 +651,23 @@ export default function abilityTest() { * @tc.desc : Starting mainability3 with startAbilityForResult succeeded.(callback) */ it('ACTS_StartAbilityForResult_0700', 0, async function (done) { + let TAG = 'ACTS_StartAbilityForResult_0700' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_startAbilityForResult_0700 - timeout'); + console.debug(TAG + 'ACTS_startAbilityForResult_0700 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', },(err,data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') @@ -660,38 +681,39 @@ export default function abilityTest() { * @tc.desc : Starting mainability2 with startAbility then terminateself ability succeeded.(promise) */ it('ACTS_TerminateSelf_0100', 0, async function (done) { + let TAG = 'ACTS_TerminateSelf_0100' let Subscriber var flag = true var terminateresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0100 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_TerminateSelf_CommonEvent"){ terminateresult = true - console.debug("====>terminateresult is:====>" + JSON.stringify(terminateresult)); + console.debug(TAG + "====>terminateresult is:====>" + JSON.stringify(terminateresult)); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); } } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' }).then(()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false expect(terminateresult).assertEqual(true); done(); @@ -700,7 +722,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_TerminateSelf_0100 - timeout'); + console.debug(TAG + 'ACTS_TerminateSelf_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -715,12 +737,13 @@ export default function abilityTest() { * @tc.desc : Starting mainability2 with startAbility then terminateself ability succeeded.(callback) */ it('ACTS_TerminateSelf_0300', 0, async function (done) { + let TAG = 'ACTS_TerminateSelf_0300' let Subscriber var flag = true var terminateresult = false function SubscribeCallBack (err, data) { expect(data.event == "ACTS_InterfaceMultiUsers_0100_Start_CommonEvent" || data.event == "ACTS_TerminateSelf_CommonEvent").assertTrue(); - console.debug("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>0300 Subscribe CallBack data:====>" + JSON.stringify(data)); if(data.event == "ACTS_TerminateSelf_CommonEvent"){ terminateresult = true commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); @@ -729,25 +752,25 @@ export default function abilityTest() { } commonEvent.createSubscriber(subscriberInfo_MainAbility).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async(SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); globalThis.abilityContext.startAbility( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility2' },() => { - console.debug("====>startAbility end====>" ); + console.debug(TAG + "====>startAbility end====>" ); }) }) }) function UnSubscribeCallback() { flag = false - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); expect(terminateresult).assertEqual(true); done(); } @@ -755,7 +778,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_TerminateSelf_0300 - timeout'); + console.debug(TAG + 'ACTS_TerminateSelf_0300 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -771,24 +794,25 @@ export default function abilityTest() { * then terminateself ability and return result succeeded.(promise) */ it('ACTS_TerminateSelfWithResult_0100', 0, async function (done) { + let TAG = 'ACTS_TerminateSelfWithResult_0100' var flag = true function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_TerminateSelfWithResult_0100 - timeout'); + console.debug(TAG + 'ACTS_TerminateSelfWithResult_0100 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', }).then((data)=>{ - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); flag = false - console.debug("====>data.resultCode is====>"+JSON); + console.debug(TAG + "====>data.resultCode is====>"+JSON); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -802,23 +826,24 @@ export default function abilityTest() { * then terminateself ability and return result succeeded.(callback) */ it('ACTS_TerminateSelfWithResult_0300', 0, async function (done) { + let TAG = 'ACTS_TerminateSelfWithResult_0300' var flag = true function timeout() { if (flag == true) { expect().assertFail(); - console.debug('ACTS_TerminateSelfWithResult_0300 - timeout'); + console.debug(TAG + 'ACTS_TerminateSelfWithResult_0300 - timeout'); done(); } } setTimeout(timeout, START_ABILITY_TIMEOUT); - console.debug("====>start startAbilityForResult====>"); + console.debug(TAG + "====>start startAbilityForResult====>"); await globalThis.abilityContext.startAbilityForResult( { bundleName: 'com.acts.actsinterfacemultiuserstest', abilityName: 'com.acts.actsinterfacemultiuserstest.MainAbility3', },(err,data)=>{ flag = false - console.debug("====>startAbilityForResult end====>"); + console.debug(TAG + "====>startAbilityForResult end====>"); expect(data.resultCode).assertEqual(1) expect(data.want.action).assertEqual('ACTION') done(); @@ -832,28 +857,29 @@ export default function abilityTest() { * then terminateself ability and return result failed.(promise) */ it('ACTS_KillProcess_0100', 0, async function (done) { + let TAG = 'ACTS_KillProcess_0100' var Subscriber var flag = true function SubscribeCallBack (err, data) { expect(data.event == "ACTS_KillProcess").assertTrue(); - console.debug("====>ACTS_KillProcess_0100 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>ACTS_KillProcess_0100 Subscribe CallBack data:====>" + JSON.stringify(data)); appManager.getProcessRunningInfos().then((data)=> { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) for(var i = 0; ihas com.acts.killprocesshap=====>') + console.info(TAG + '====>has com.acts.killprocesshap=====>') break } } - console.log('====>i is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocesshap'){ expect().assertFail() } appManager.killProcessesByBundleName('com.acts.killprocesshap').then((data)=>{ - console.info('====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) setTimeout(()=>{ appManager.getProcessRunningInfos().then((data)=> { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) for(var i = 0; i { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.killprocesshap', abilityName: 'com.acts.killprocesshap.MainAbility' }).then((data)=>{ - console.debug("====>startAbility end====>"); - console.debug("====>data is====>" + JSON.stringify(data)); + console.debug(TAG + "====>startAbility end====>"); + console.debug(TAG + "====>data is====>" + JSON.stringify(data)); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false done(); } @@ -892,7 +918,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_KillProcess_0100 - timeout'); + console.debug(TAG + 'ACTS_KillProcess_0100 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -907,28 +933,29 @@ export default function abilityTest() { * then terminateself ability and return result failed.(callback) */ it('ACTS_KillProcess_0200', 0, async function (done) { + let TAG = 'ACTS_KillProcess_0200' var Subscriber var flag = true function SubscribeCallBack (err, data) { expect(data.event == "ACTS_KillProcess").assertTrue(); - console.debug("====>ACTS_KillProcess_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); + console.debug(TAG + "====>ACTS_KillProcess_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); appManager.getProcessRunningInfos().then((data)=> { - console.info('====>ACTS_KillProcess_0200 getProcessRunningInfos=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0200 getProcessRunningInfos=====>' + JSON.stringify(data)) for(var i = 0; ihas com.acts.killprocesshap=====>') + console.info(TAG + '====>has com.acts.killprocesshap=====>') break } } - console.log('====>i is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocesshap'){ expect().assertFail() } appManager.killProcessesByBundleName('com.acts.killprocesshap',(data)=>{ - console.info('====>ACTS_KillProcess_0200 killProcessesByBundleName=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0200 killProcessesByBundleName=====>' + JSON.stringify(data)) setTimeout(()=> { appManager.getProcessRunningInfos().then((data) => { - console.info('====>ACTS_KillProcess_0200 getProcessRunningInfos2=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0200 getProcessRunningInfos2=====>' + JSON.stringify(data)) for (var i = 0; i < data.length; i++) { if (data[i].processName == 'com.acts.killprocesshap') { expect().assertFail() @@ -942,24 +969,24 @@ export default function abilityTest() { }) } commonEvent.createSubscriber(subscriberInfo_killprocess).then(async (data) => { - console.debug("====>Create Subscriber====>"); + console.debug(TAG + "====>Create Subscriber====>"); data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug("====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); + console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); Subscriber = data; commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug("====>start startAbility====>"); + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.killprocesshap', abilityName: 'com.acts.killprocesshap.MainAbility' }).then((data)=>{ - console.debug("====>startAbility end====>"); - console.debug("====>data is====>" + JSON.stringify(data)); + console.debug(TAG + "====>startAbility end====>"); + console.debug(TAG + "====>data is====>" + JSON.stringify(data)); }) }) }) function UnSubscribeCallback() { - console.debug("====>UnSubscribeCallback====>"); + console.debug(TAG + "====>UnSubscribeCallback====>"); flag = false done(); } @@ -967,7 +994,7 @@ export default function abilityTest() { function timeout() { if(flag == true) { expect().assertFail(); - console.debug('ACTS_KillProcess_0200 - timeout'); + console.debug(TAG + 'ACTS_KillProcess_0200 - timeout'); commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) } } @@ -982,24 +1009,25 @@ export default function abilityTest() { * then terminateself ability and return result failed.(promise) */ it('ACTS_ThirdPartyKillProcess_0100', 0, async function (done) { - console.debug("====>start startAbility====>"); + let TAG = 'ACTS_ThirdPartyKillProcess_0100' + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.killprocessthirdhap', abilityName: 'com.acts.killprocessthirdhap.MainAbility' }).then(()=>{ - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) setTimeout(()=>{ appManager.getProcessRunningInfos().then((data)=> { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) for(var i = 0; ihas com.acts.killprocessthirdhap=====>') + console.info(TAG + '====>has com.acts.killprocessthirdhap=====>') break } } - console.log('====>i is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocessthirdhap'){ expect().assertFail() } @@ -1007,13 +1035,13 @@ export default function abilityTest() { },1000) setTimeout(()=> { appManager.getProcessRunningInfos().then((data) => { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) for (var i = 0; i < data.length; i++) { if (data[i].processName == 'com.acts.killprocessthirdhap') { break } } - console.log('====>i2 is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i2 is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocessthirdhap'){ expect().assertFail() } @@ -1029,24 +1057,25 @@ export default function abilityTest() { * then terminateself ability and return result failed.(callback) */ it('ACTS_ThirdPartyKillProcess_0200', 0, async function (done) { - console.debug("====>start startAbility====>"); + let TAG = 'ACTS_ThirdPartyKillProcess_0200' + console.debug(TAG + "====>start startAbility====>"); await globalThis.abilityContext.startAbility( { bundleName: 'com.acts.killprocessthirdhap2', abilityName: 'com.acts.killprocessthirdhap2.MainAbility' }).then(() => { - console.debug("====>startAbility end====>"); + console.debug(TAG + "====>startAbility end====>"); }) setTimeout(() => { appManager.getProcessRunningInfos().then((data) => { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) for (var i = 0; i < data.length; i++) { if (data[i].processName == 'com.acts.killprocessthirdhap2') { console.info('====>has com.acts.killprocessthirdhap2=====>') break } } - console.log('====>i is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i is:====>' + JSON.stringify(i)) if (i == data.length && data[i].processName != 'com.acts.killprocessthirdhap2') { expect().assertFail() } @@ -1054,13 +1083,13 @@ export default function abilityTest() { },1000) setTimeout(() => { appManager.getProcessRunningInfos().then((data) => { - console.info('====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) + console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) for (var i = 0; i < data.length; i++) { if (data[i].processName == 'com.acts.killprocessthirdhap2') { break } } - console.log('====>i2 is:====>' + JSON.stringify(i)) + console.log(TAG + '====>i2 is:====>' + JSON.stringify(i)) if(i==data.length && data[i].processName!='com.acts.killprocessthirdhap'){ expect().assertFail() }