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 f259dc2ac56d413dc3a97179e644975e774cb51f..f430fd1b6e86921bc66a233cdc64164b1c51c54d 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 @@ -850,158 +850,6 @@ export default function abilityTest() { }) }) - /* - * @tc.number : ACTS_KillProcess_0100 - * @tc.name : Use terminateselfwithresult to terminate ability and return result - * @tc.desc : Starting mainability3 with startAbilityforresult - * 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(TAG + "====>ACTS_KillProcess_0100 Subscribe CallBack data:====>" + JSON.stringify(data)); - appManager.getProcessRunningInfos().then((data)=> { - console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos=====>' + JSON.stringify(data)) - for(var i = 0; ihas com.acts.killprocesshap=====>') - break - } - } - 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(TAG + '====>ACTS_KillProcess_0100 killProcessesByBundleName=====>' + JSON.stringify(data)) - setTimeout(()=>{ - appManager.getProcessRunningInfos().then((data)=> { - console.info(TAG + '====>ACTS_KillProcess_0100 getProcessRunningInfos2=====>' + JSON.stringify(data)) - for(var i = 0; i { - console.debug(TAG + "====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug(TAG + "====>start startAbility====>"); - await globalThis.abilityContext.startAbility( - { - bundleName: 'com.acts.killprocesshap', - abilityName: 'com.acts.killprocesshap.MainAbility' - }).then((data)=>{ - console.debug(TAG + "====>startAbility end====>"); - console.debug(TAG + "====>data is====>" + JSON.stringify(data)); - }) - }) - }) - function UnSubscribeCallback() { - console.debug(TAG + "====>UnSubscribeCallback====>"); - flag = false - done(); - } - - function timeout() { - if(flag == true) { - expect().assertFail(); - console.debug(TAG + 'ACTS_KillProcess_0100 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, 19500); - }) - - /* - * @tc.number : ACTS_KillProcess_0200 - * @tc.name : Use terminateselfwithresult to terminate ability and return result - * @tc.desc : Starting mainability3 with startAbilityforresult - * 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(TAG + "====>ACTS_KillProcess_0200 Subscribe CallBack data:====>" + JSON.stringify(data)); - appManager.getProcessRunningInfos().then((data)=> { - console.info(TAG + '====>ACTS_KillProcess_0200 getProcessRunningInfos=====>' + JSON.stringify(data)) - for(var i = 0; ihas com.acts.killprocesshap=====>') - break - } - } - 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(TAG + '====>ACTS_KillProcess_0200 killProcessesByBundleName=====>' + JSON.stringify(data)) - setTimeout(()=> { - appManager.getProcessRunningInfos().then((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() - break - } - } - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback); - }) - },15000) - }) - }) - } - commonEvent.createSubscriber(subscriberInfo_killprocess).then(async (data) => { - console.debug(TAG + "====>Create Subscriber====>"); - data.getSubscribeInfo().then(async (SubscribeInfo)=>{ - console.debug(TAG + "====>SubscribeInfo is====>" + JSON.stringify(SubscribeInfo)); - Subscriber = data; - commonEvent.subscribe(Subscriber, SubscribeCallBack); - console.debug(TAG + "====>start startAbility====>"); - await globalThis.abilityContext.startAbility( - { - bundleName: 'com.acts.killprocesshap', - abilityName: 'com.acts.killprocesshap.MainAbility' - }).then((data)=>{ - console.debug(TAG + "====>startAbility end====>"); - console.debug(TAG + "====>data is====>" + JSON.stringify(data)); - }) - }) - }) - function UnSubscribeCallback() { - console.debug(TAG + "====>UnSubscribeCallback====>"); - flag = false - done(); - } - - function timeout() { - if(flag == true) { - expect().assertFail(); - console.debug(TAG + 'ACTS_KillProcess_0200 - timeout'); - commonEvent.unsubscribe(Subscriber, UnSubscribeCallback) - } - } - - setTimeout(timeout, 19500); - }) - /* * @tc.number : ACTS_ThirdPartyKillProcess_0100 * @tc.name : Use terminateselfwithresult to terminate ability and return result