提交 b07cec4f 编写于 作者: S songjindian

修复ActsAbilityMonitorTest概率失败

Signed-off-by: Nsongjindian <songjindian1@huawei.com>
上级 06833552
......@@ -652,36 +652,37 @@ export default function abilityTest() {
function UnSubscribeCallback() {
console.debug("====>commonEvent_foreground UnSubscribeCallback====>");
}
var AddAbility
function SubscribeCallBack(err, data) {
console.debug("====>Subscribe CallBack data:====>" + JSON.stringify(data));
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_1000===createSubscriber" + JSON.stringify(data));
var AddAbility = data
AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1000CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
Subscriber.unsubscribe(subscriber, UnSubscribeCallback);
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
Delegator.getCurrentTopAbility().then((ability) => {
console.info("===ACTS_AddAbilityMonitor_1000===ability" + JSON.stringify(ability).length);
Delegator.doAbilityBackground(ability).then(async () => {
console.info("===ACTS_AddAbilityMonitor_1000===data succeed.");
expect(true).assertTrue();
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1000CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
Subscriber.unsubscribe(subscriber, UnSubscribeCallback);
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
}).catch(() => {
console.info("===ACTS_AddAbilityMonitor_1000===data succeed.");
expect(false).assertTrue();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册