未验证 提交 9254cff6 编写于 作者: O openharmony_ci 提交者: Gitee

!9203 修复ActsAbilityMonitorTest偶现事件订阅对象被回收造成失败

Merge pull request !9203 from songjindian/change_monitor
...@@ -115,36 +115,35 @@ export default function abilityTest() { ...@@ -115,36 +115,35 @@ export default function abilityTest() {
} }
}, (async (err) => { }, (async (err) => {
console.debug("====>ACTS_AddAbilityMonitor_0200 success====>" + err.code); console.debug("====>ACTS_AddAbilityMonitor_0200 success====>" + err.code);
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0200===createSubscriber" + JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0200CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
console.debug("====>0200startAbility success====>"); console.debug("====>0200startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0200===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0200CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
})) }))
}) })
...@@ -268,36 +267,35 @@ export default function abilityTest() { ...@@ -268,36 +267,35 @@ export default function abilityTest() {
onAbilityDestroy: onAbilityDestroy onAbilityDestroy: onAbilityDestroy
}, (async (err) => { }, (async (err) => {
console.debug("====>ACTS_AddAbilityMonitor_0400 success====>" + err.code); console.debug("====>ACTS_AddAbilityMonitor_0400 success====>" + err.code);
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0400===createSubscriber" + JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0400CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility4' abilityName: 'MainAbility4'
}).then(async () => { }).then(async () => {
console.debug("====>0400startAbility success====>"); console.debug("====>0400startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0400===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0400CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
})) }))
}) })
...@@ -332,36 +330,36 @@ export default function abilityTest() { ...@@ -332,36 +330,36 @@ export default function abilityTest() {
onWindowStageCreate: onWindowStageCreate onWindowStageCreate: onWindowStageCreate
}, (async (err) => { }, (async (err) => {
console.debug("====>ACTS_AddAbilityMonitor_0500 success====>" + err.code); console.debug("====>ACTS_AddAbilityMonitor_0500 success====>" + err.code);
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0500===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0500CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBacke===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
console.debug("====>0500startAbility success====>"); console.debug("====>0500startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0500===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0500CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBacke===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
})) }))
}) })
...@@ -396,36 +394,36 @@ export default function abilityTest() { ...@@ -396,36 +394,36 @@ export default function abilityTest() {
onWindowStageDestroy: onWindowStageDestroy onWindowStageDestroy: onWindowStageDestroy
}, (async (err) => { }, (async (err) => {
console.debug("====>ACTS_AddAbilityMonitor_0600 success====>" + err.code); console.debug("====>ACTS_AddAbilityMonitor_0600 success====>" + err.code);
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0600===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0600CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBackf===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility4' abilityName: 'MainAbility4'
}).then(async () => { }).then(async () => {
console.debug("====>0600startAbility success====>"); console.debug("====>0600startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0600===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0600CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBackf===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
})) }))
}) })
...@@ -468,36 +466,36 @@ export default function abilityTest() { ...@@ -468,36 +466,36 @@ export default function abilityTest() {
onAbilityCreate: onAbilityCreate onAbilityCreate: onAbilityCreate
}, (async (err) => { }, (async (err) => {
console.debug("====>ACTS_AddAbilityMonitor_0700 addAbilityMonitorsec====>" + err.code); console.debug("====>ACTS_AddAbilityMonitor_0700 addAbilityMonitorsec====>" + err.code);
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0700===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0700CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBacka===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
console.debug("====>0700startAbility success====>"); console.debug("====>0700startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0700===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0700CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBacka===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
})) }))
})) }))
...@@ -533,36 +531,36 @@ export default function abilityTest() { ...@@ -533,36 +531,36 @@ export default function abilityTest() {
onAbilityCreate: onAbilityCreatePromise onAbilityCreate: onAbilityCreatePromise
}).then(() => { }).then(() => {
console.debug("====>ACTS_AddAbilityMonitor_0800 success====>"); console.debug("====>ACTS_AddAbilityMonitor_0800 success====>");
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0800===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0800CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
globalThis.abilitydelegator.startAbility( globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
console.debug("====>0800startAbility success====>"); console.debug("====>0800startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0800===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0800CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
}) })
...@@ -597,36 +595,36 @@ export default function abilityTest() { ...@@ -597,36 +595,36 @@ export default function abilityTest() {
onAbilityForeground: onAbilityForegroundPromise onAbilityForeground: onAbilityForegroundPromise
}).then(async () => { }).then(async () => {
console.debug("====>ACTS_AddAbilityMonitor_0900 success====>"); console.debug("====>ACTS_AddAbilityMonitor_0900 success====>");
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0900===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0900CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
console.debug("====>0900startAbility success====>"); console.debug("====>0900startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0900===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0900CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
}) })
...@@ -751,36 +749,36 @@ export default function abilityTest() { ...@@ -751,36 +749,36 @@ export default function abilityTest() {
onAbilityDestroy: onAbilityDestroyPromise onAbilityDestroy: onAbilityDestroyPromise
}).then(async () => { }).then(async () => {
console.debug("====>ACTS_AddAbilityMonitor_1100 success====>"); console.debug("====>ACTS_AddAbilityMonitor_1100 success====>");
await globalThis.abilitydelegator.startAbility( Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
{ console.info("===ACTS_AddAbilityMonitor_1100===createSubscriber"
bundleName: 'com.example.abilitymonitortest', + JSON.stringify(data));
abilityName: 'MainAbility4' var AddAbility = data
}).then(async () => { Subscriber.subscribe(data, (err, data) => {
console.debug("====>1100startAbility success====>"); console.log('===ACTS_AddAbilityMonitor_1100CallBack==='
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { + err.code + JSON.stringify(data))
console.info("===ACTS_AddAbilityMonitor_1100===createSubscriber" Subscriber.unsubscribe(AddAbility, (err, data) => {
+ JSON.stringify(data)); console.log('===UnSubscribeCallBack===' + err.code)
var AddAbility = data
await Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1100CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
}) })
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility(
{
bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility4'
}).then(async () => {
console.debug("====>1100startAbility success====>");
}) })
}) })
}) })
...@@ -815,36 +813,36 @@ export default function abilityTest() { ...@@ -815,36 +813,36 @@ export default function abilityTest() {
onWindowStageCreate: onWindowStageCreatePromise onWindowStageCreate: onWindowStageCreatePromise
}).then(async () => { }).then(async () => {
console.debug("====>ACTS_AddAbilityMonitor_1200 success====>"); console.debug("====>ACTS_AddAbilityMonitor_1200 success====>");
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_1200===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1200CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
console.debug("====>1200startAbility success====>"); console.debug("====>1200startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_1200===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1200CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
}) })
...@@ -879,36 +877,36 @@ export default function abilityTest() { ...@@ -879,36 +877,36 @@ export default function abilityTest() {
onWindowStageDestroy: onWindowStageDestroyPromsie onWindowStageDestroy: onWindowStageDestroyPromsie
}).then(async () => { }).then(async () => {
console.debug("====>ACTS_AddAbilityMonitor_1300 success====>"); console.debug("====>ACTS_AddAbilityMonitor_1300 success====>");
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_1300===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1300CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility4' abilityName: 'MainAbility4'
}).then(async () => { }).then(async () => {
console.debug("====>1300startAbility success====>"); console.debug("====>1300startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_1300===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(data, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1300CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
}) })
...@@ -948,36 +946,36 @@ export default function abilityTest() { ...@@ -948,36 +946,36 @@ export default function abilityTest() {
abilityName: 'MainAbility2', abilityName: 'MainAbility2',
onAbilityCreate: onAbilityCreate onAbilityCreate: onAbilityCreate
}).then(async () => { }).then(async () => {
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_1400===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1400CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
console.debug("====>1400startAbility success====>"); console.debug("====>1400startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_1400===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1400CallBack==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, (err, data) => {
console.log('===UnSubscribeCallBack===' + err.code)
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
}) })
...@@ -1600,33 +1598,34 @@ export default function abilityTest() { ...@@ -1600,33 +1598,34 @@ export default function abilityTest() {
expect(err.code).assertEqual(0) expect(err.code).assertEqual(0)
console.debug("====>ACTS_WaitAbilityMonitor_Callback_0100 success====>"); console.debug("====>ACTS_WaitAbilityMonitor_Callback_0100 success====>");
}) })
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_WaitAbilityMonitor_Callback_0100===createSubscriber" + JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Callback_0100===' + err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { console.debug("====>ACTS_WaitAbilityMonitor_Callback_0100 startAbility success====>");
console.info("===ACTS_WaitAbilityMonitor_Callback_0100===createSubscriber" + JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Callback_0100===' + err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
...@@ -1704,35 +1703,36 @@ export default function abilityTest() { ...@@ -1704,35 +1703,36 @@ export default function abilityTest() {
expect(err.code).assertEqual(0) expect(err.code).assertEqual(0)
console.debug("====>ACTS_WaitAbilityMonitor_Callback_0300 success====>"); console.debug("====>ACTS_WaitAbilityMonitor_Callback_0300 success====>");
}) })
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_WaitAbilityMonitor_Callback_0300===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Callback_0300==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { console.debug("====>ACTS_WaitAbilityMonitor_Callback_0300 startAbility success====>");
console.info("===ACTS_WaitAbilityMonitor_Callback_0300===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Callback_0300==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
...@@ -1810,35 +1810,36 @@ export default function abilityTest() { ...@@ -1810,35 +1810,36 @@ export default function abilityTest() {
expect(err.code).assertEqual(0) expect(err.code).assertEqual(0)
console.debug("====>ACTS_WaitAbilityMonitor_Callback_0500 success====>"); console.debug("====>ACTS_WaitAbilityMonitor_Callback_0500 success====>");
}) })
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_WaitAbilityMonitor_Callback_0500===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Callback_0500===' + err.code
+ JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBackU===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { console.debug("====>ACTS_WaitAbilityMonitor_Callback_0500 startAbility success====>");
console.info("===ACTS_WaitAbilityMonitor_Callback_0500===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Callback_0500===' + err.code
+ JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBackU===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
...@@ -1876,35 +1877,36 @@ export default function abilityTest() { ...@@ -1876,35 +1877,36 @@ export default function abilityTest() {
expect(err.code).assertEqual(0) expect(err.code).assertEqual(0)
console.debug("====>ACTS_WaitAbilityMonitor_Callback_0600 success====>"); console.debug("====>ACTS_WaitAbilityMonitor_Callback_0600 success====>");
}) })
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_WaitAbilityMonitor_Callback_0600===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Callback_0600==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBackU===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { console.debug("====>ACTS_WaitAbilityMonitor_Callback_0600 startAbility success====>");
console.info("===ACTS_WaitAbilityMonitor_Callback_0600===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Callback_0600==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBackU===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
...@@ -1939,35 +1941,36 @@ export default function abilityTest() { ...@@ -1939,35 +1941,36 @@ export default function abilityTest() {
data.waitAbilityMonitor(monitor).then(async (data) => { data.waitAbilityMonitor(monitor).then(async (data) => {
console.debug("====>ACTS_WaitAbilityMonitor_Promise_0100 success====>"); console.debug("====>ACTS_WaitAbilityMonitor_Promise_0100 success====>");
}) })
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_WaitAbilityMonitor_Promise_0100===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Promise_0100==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { console.debug("====>ACTS_WaitAbilityMonitor_Promise_0100 startAbility success====>");
console.info("===ACTS_WaitAbilityMonitor_Promise_0100===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Promise_0100==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
...@@ -2040,35 +2043,36 @@ export default function abilityTest() { ...@@ -2040,35 +2043,36 @@ export default function abilityTest() {
data.waitAbilityMonitor(monitor, 1000).then(async (data) => { data.waitAbilityMonitor(monitor, 1000).then(async (data) => {
console.debug("====>ACTS_WaitAbilityMonitor_Promise_0300 success====>"); console.debug("====>ACTS_WaitAbilityMonitor_Promise_0300 success====>");
}) })
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_WaitAbilityMonitor_Promise_0300===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Promise_0300==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBackM===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { console.debug("====>ACTS_WaitAbilityMonitor_Promise_0300 startAbility success====>");
console.info("===ACTS_WaitAbilityMonitor_Promise_0300===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Promise_0300==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBackM===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
...@@ -2142,35 +2146,36 @@ export default function abilityTest() { ...@@ -2142,35 +2146,36 @@ export default function abilityTest() {
data.waitAbilityMonitor(monitor, 100).then(async (data) => { data.waitAbilityMonitor(monitor, 100).then(async (data) => {
console.debug("====>ACTS_WaitAbilityMonitor_Promise_0500 success====>"); console.debug("====>ACTS_WaitAbilityMonitor_Promise_0500 success====>");
}) })
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_WaitAbilityMonitor_Promise_0500===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Promise_0500==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { console.debug("====>ACTS_WaitAbilityMonitor_Promise_0500 startAbility success====>");
console.info("===ACTS_WaitAbilityMonitor_Promise_0500===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Promise_0500==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
...@@ -2206,35 +2211,36 @@ export default function abilityTest() { ...@@ -2206,35 +2211,36 @@ export default function abilityTest() {
data.waitAbilityMonitor(monitor, -1).then(async (data) => { data.waitAbilityMonitor(monitor, -1).then(async (data) => {
console.debug("====>ACTS_WaitAbilityMonitor_Promise_0600 success====>"); console.debug("====>ACTS_WaitAbilityMonitor_Promise_0600 success====>");
}) })
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_WaitAbilityMonitor_Promise_0600===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Promise_0600==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
await globalThis.abilitydelegator.startAbility( await globalThis.abilitydelegator.startAbility(
{ {
bundleName: 'com.example.abilitymonitortest', bundleName: 'com.example.abilitymonitortest',
abilityName: 'MainAbility2' abilityName: 'MainAbility2'
}).then(async () => { }).then(async () => {
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => { console.debug("====>ACTS_WaitAbilityMonitor_Promise_0600 startAbility success====>");
console.info("===ACTS_WaitAbilityMonitor_Promise_0600===createSubscriber"
+ JSON.stringify(data));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_WaitAbilityMonitor_Promise_0600==='
+ err.code + JSON.stringify(data))
Subscriber.unsubscribe(AddAbility, () => {
console.log('===UnSubscribeCallBack===')
})
if (data.code == 1) {
expect(data.code).assertEqual(1);
setTimeout(() => {
done();
}, 2500)
}
else {
expect().assertFail();
setTimeout(() => {
done();
}, 2500)
}
})
})
}) })
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册