提交 9429eba0 编写于 作者: C chengxingzhen

xts-系统api用例下库

Signed-off-by: Nchengxingzhen <chengxingzhen@huawei.com>
上级 7b8657cf
......@@ -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; i<data.length ;i++){
if (data[i].processName=='com.acts.killprocesshap'){
console.info(TAG + '====>has 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<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_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; i<data.length ;i++){
if (data[i].processName=='com.acts.killprocesshap'){
console.info(TAG + '====>has 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册