提交 d3f27379 编写于 作者: S songjindian

修改时序问题导致abilitymonitor测试套大概率失败

Signed-off-by: Nsongjindian <songjindian1@huawei.com>
上级 ac99f3f9
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
import Ability from '@ohos.app.ability.UIAbility' import Ability from '@ohos.app.ability.UIAbility'
import commonEvent from '@ohos.commonEvent' import commonEvent from '@ohos.commonEvent'
let TERMINATE_SELF_TIME = 2500;
let EVENT_TIME = 500;
function PublishCallBack() { function PublishCallBack() {
console.debug("====>Publish CallBack ====>"); console.debug("====>Publish CallBack ====>");
} }
...@@ -38,7 +41,7 @@ export default class MainAbility3 extends Ability { ...@@ -38,7 +41,7 @@ export default class MainAbility3 extends Ability {
globalThis.abilityContext.terminateSelf().then(()=>{ globalThis.abilityContext.terminateSelf().then(()=>{
console.log("====>in terminateSelf====>"); console.log("====>in terminateSelf====>");
}) })
},2000) }, TERMINATE_SELF_TIME);
} }
onWindowStageDestroy() { onWindowStageDestroy() {
...@@ -49,7 +52,9 @@ export default class MainAbility3 extends Ability { ...@@ -49,7 +52,9 @@ export default class MainAbility3 extends Ability {
onForeground() { onForeground() {
// Ability has brought to foreground // Ability has brought to foreground
console.log("[Demo] MainAbility3 onForeground") console.log("[Demo] MainAbility3 onForeground")
setTimeout(()=>{
commonEvent.publish("commonEvent_foreground", PublishCallBack); commonEvent.publish("commonEvent_foreground", PublishCallBack);
}, EVENT_TIME);
} }
onBackground() { onBackground() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册