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

!9962 xts用例获取当前ability需要增加延时

Merge pull request !9962 from kirl75/master
......@@ -43,11 +43,12 @@ export default function abilityTest() {
var Subscriber;
var AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
function SubscribeCallBack(err, data) {
async function SubscribeCallBack(err, data) {
console.debug("ACTS_GetCurrentTopAbility_0100====>Subscribe CallBack data:====>"
+ JSON.stringify(data));
expect(data.event == 'GetCurrentTopAbilityB').assertTrue();
if (data.event == 'GetCurrentTopAbilityB') {
await sleep(1000);
AbilityDelegator.getCurrentTopAbility((err, data) => {
console.log("ACTS_GetCurrentTopAbility_0100 and");
console.debug("====>thisTopAbility_0100====>" + JSON.stringify(data));
......
......@@ -45,10 +45,11 @@ export default function abilityTest() {
var Subscriber;
var AbilityDelegator=await abilityDelegatorRegistry.getAbilityDelegator();
function SubscribeCallBack(err, data) {
async function SubscribeCallBack(err, data) {
console.debug("ACTS_GetCurrentTopAbility_0200====>Subscribe CallBack data:====>" + JSON.stringify(data));
expect(data.event == 'GetCurrentTopAbility').assertTrue();
if (data.event == 'GetCurrentTopAbility') {
await sleep(1000);
AbilityDelegator.getCurrentTopAbility((err,data) => {
console.debug("====>thisTopAbility====>"+JSON.stringify(data.lastRequestWant))
console.debug("====>start startAbility====>");
......
......@@ -44,12 +44,14 @@ export default class MainAbility3 extends Ability {
onForeground() {
// Ability has brought to foreground
console.log("[Demo] MainAbility3 onForeground")
globalThis.abilitydelegator.getCurrentTopAbility().then((data)=>{
console.log("[Demo] MainAbility3 onForeground");
setTimeout(() => {
globalThis.abilitydelegator.getCurrentTopAbility().then((data)=>{
globalThis.ability3 = data
console.debug("====>MainAbility getCurrentTopAbility:====>" + JSON.stringify(globalThis.ability3));
commonEvent.publish("ACTS_DoAbility_Event", PublishCallBackOne);
})
}, 1000);
}
onBackground() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册