Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
fcc05b90
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
大约 1 年 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
fcc05b90
编写于
1月 09, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 09, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7122 doAbilityBackground&doAbilityForeground错误码整改
Merge pull request !7122 from yangliang36/yl0105
上级
7cfa2fe4
5bc60fa2
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
103 addition
and
97 deletion
+103
-97
ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets
...e/abilitymontior/entry/src/main/ets/test/Ability.test.ets
+43
-37
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets
...tystatestagetest/entry/src/main/ets/test/Ability.test.ets
+6
-6
ability/ability_runtime/apitest/entry/src/main/ets/test/Ability.test.ets
..._runtime/apitest/entry/src/main/ets/test/Ability.test.ets
+48
-48
ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/ets/test/StartAbilityTest.ets
...itystagetest/entry/src/main/ets/test/StartAbilityTest.ets
+4
-4
ability/ability_runtime/freeinstalltest/startabilitystagetest/actsstartabilitynotargetbundleliststagetest/entry/src/main/ets/test/StartAbilityTest.ets
...iststagetest/entry/src/main/ets/test/StartAbilityTest.ets
+2
-2
未找到文件。
ability/ability_runtime/abilitymontior/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
fcc05b90
...
@@ -37,12 +37,35 @@ export default function abilityTest() {
...
@@ -37,12 +37,35 @@ export default function abilityTest() {
Subscriber.publish("ACTS_AddAbilityMonitor_0100", AddAbilityData, publishCallback);
Subscriber.publish("ACTS_AddAbilityMonitor_0100", AddAbilityData, publishCallback);
}
}
console.debug("====>ACTS_AddAbilityMonitor_0100 start====>");
console.debug("====>ACTS_AddAbilityMonitor_0100 start====>");
var AddAbilityData
var AddAbilityData
;
var commonEventSubscribeInfo = {
var commonEventSubscribeInfo = {
events: ["ACTS_AddAbilityMonitor_0100"]
events: ["ACTS_AddAbilityMonitor_0100"]
};
};
var data = abilityDelegatorRegistry.getAbilityDelegator()
var data = abilityDelegatorRegistry.getAbilityDelegator();
console.log("0100getAbilityDelegator data is" + JSON.stringify(data))
console.log("0100getAbilityDelegator data is" + JSON.stringify(data));
Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
console.info("===ACTS_AddAbilityMonitor_0100===createSubscriber" + JSON.stringify(data));
var AddAbility = data;
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0100CallBack==='
+ 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);
}
});
});
data.addAbilityMonitor(
data.addAbilityMonitor(
{
{
abilityName: 'MainAbility2',
abilityName: 'MainAbility2',
...
@@ -55,31 +78,8 @@ export default function abilityTest() {
...
@@ -55,31 +78,8 @@ export default function abilityTest() {
abilityName: 'MainAbility2'
abilityName: 'MainAbility2'
}).then(async () => {
}).then(async () => {
console.debug("====>0100startAbility success====>");
console.debug("====>0100startAbility success====>");
await Subscriber.createSubscriber(commonEventSubscribeInfo, async (err, data) => {
});
console.info("===ACTS_AddAbilityMonitor_0100===createSubscriber" + JSON.stringify(data));
}));
var AddAbility = data
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0100CallBack==='
+ 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)
}
})
})
})
}))
})
})
/**
/**
...
@@ -176,7 +176,7 @@ export default function abilityTest() {
...
@@ -176,7 +176,7 @@ export default function abilityTest() {
console.info("===ACTS_AddAbilityMonitor_0300===createSubscriber" + JSON.stringify(data));
console.info("===ACTS_AddAbilityMonitor_0300===createSubscriber" + JSON.stringify(data));
var AddAbility = data
var AddAbility = data
Delegator.getCurrentTopAbility().then((ability) => {
Delegator.getCurrentTopAbility().then((ability) => {
console.info("===ACTS_AddAbilityMonitor_0300===ability
" + JSON.stringify(ability)
);
console.info("===ACTS_AddAbilityMonitor_0300===ability
" + JSON.stringify(ability).length
);
Subscriber.subscribe(AddAbility, (err, data) => {
Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_0300CallBack==='
console.log('===ACTS_AddAbilityMonitor_0300CallBack==='
+ err.code + JSON.stringify(data))
+ err.code + JSON.stringify(data))
...
@@ -198,9 +198,12 @@ export default function abilityTest() {
...
@@ -198,9 +198,12 @@ export default function abilityTest() {
}
}
})
})
Delegator.doAbilityBackground(ability).then(async (data) => {
Delegator.doAbilityBackground(ability).then(async (data) => {
console.info("===ACTS_AddAbilityMonitor_0300===data" + JSON.stringify(data));
console.info("===ACTS_AddAbilityMonitor_0300===data succeed.");
expect(data).assertEqual(true)
expect(true).assertTrue();
})
}).catch((err: any) => {
console.info("===ACTS_AddAbilityMonitor_0300===data failed.");
expect(false).assertTrue();
});
})
})
})
})
}
}
...
@@ -655,10 +658,10 @@ export default function abilityTest() {
...
@@ -655,10 +658,10 @@ export default function abilityTest() {
console.info("===ACTS_AddAbilityMonitor_1000===createSubscriber" + JSON.stringify(data));
console.info("===ACTS_AddAbilityMonitor_1000===createSubscriber" + JSON.stringify(data));
var AddAbility = data
var AddAbility = data
Delegator.getCurrentTopAbility().then((ability) => {
Delegator.getCurrentTopAbility().then((ability) => {
console.info("===ACTS_AddAbilityMonitor_1000===ability" + JSON.stringify(ability));
console.info("===ACTS_AddAbilityMonitor_1000===ability" + JSON.stringify(ability)
.length
);
Delegator.doAbilityBackground(ability).then(async (
data
) => {
Delegator.doAbilityBackground(ability).then(async () => {
console.info("===ACTS_AddAbilityMonitor_1000===data
" + JSON.stringify(data)
);
console.info("===ACTS_AddAbilityMonitor_1000===data
succeed."
);
expect(
data).assertEqual(true)
expect(
true).assertTrue();
await Subscriber.subscribe(AddAbility, (err, data) => {
await Subscriber.subscribe(AddAbility, (err, data) => {
console.log('===ACTS_AddAbilityMonitor_1000CallBack==='
console.log('===ACTS_AddAbilityMonitor_1000CallBack==='
+ err.code + JSON.stringify(data))
+ err.code + JSON.stringify(data))
...
@@ -679,7 +682,10 @@ export default function abilityTest() {
...
@@ -679,7 +682,10 @@ export default function abilityTest() {
}, 2500)
}, 2500)
}
}
})
})
})
}).catch(() => {
console.info("===ACTS_AddAbilityMonitor_1000===data succeed.");
expect(false).assertTrue();
});
})
})
})
})
}
}
...
...
ability/ability_runtime/actsqueryfunctiontest/actsgetabilitystatestagetest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
fcc05b90
...
@@ -35,9 +35,9 @@ export default function abilityTest() {
...
@@ -35,9 +35,9 @@ export default function abilityTest() {
abilityDelegator.getCurrentTopAbility((err, data)=>{
abilityDelegator.getCurrentTopAbility((err, data)=>{
console.debug("====>getCurrentTopAbility_0200 err:" + JSON.stringify(err) + " data:" + JSON.stringify(data));
console.debug("====>getCurrentTopAbility_0200 err:" + JSON.stringify(err) + " data:" + JSON.stringify(data));
ability = data;
ability = data;
abilityDelegator.doAbilityBackground(ability, (err
, isBackground
)=>{
abilityDelegator.doAbilityBackground(ability, (err)=>{
console.debug("====>doAbilityBackground_0200 data:" + JSON.stringify(
isBackground
));
console.debug("====>doAbilityBackground_0200 data:" + JSON.stringify(
err
));
expect(
isBackground).assertTrue(
);
expect(
err.code).assertEqual(0
);
})
})
})
})
}
}
...
@@ -98,9 +98,9 @@ export default function abilityTest() {
...
@@ -98,9 +98,9 @@ export default function abilityTest() {
expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.FOREGROUND);
expect(state).assertEqual(AbilityDelegatorRegistry.AbilityLifecycleState.FOREGROUND);
expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.CREATE).assertTrue()
expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.CREATE).assertTrue()
expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.DESTROY).assertTrue()
expect(state != AbilityDelegatorRegistry.AbilityLifecycleState.DESTROY).assertTrue()
abilityDelegator.doAbilityBackground(ability, (err
, isBackground
)=>{
abilityDelegator.doAbilityBackground(ability, (err)=>{
console.debug("====>doAbilityBackground_0300 data:" + JSON.stringify(
isBackground
));
console.debug("====>doAbilityBackground_0300 data:" + JSON.stringify(
err
));
expect(
isBackground).assertTrue(
);
expect(
err.code).assertEqual(0
);
console.debug("====>ACTS_GetAbilityState_0300 end====");
console.debug("====>ACTS_GetAbilityState_0300 end====");
flag=false;
flag=false;
done();
done();
...
...
ability/ability_runtime/apitest/entry/src/main/ets/test/Ability.test.ets
浏览文件 @
fcc05b90
...
@@ -54,9 +54,9 @@ export default function abilityTest() {
...
@@ -54,9 +54,9 @@ export default function abilityTest() {
function SubscribeCallBack(err, data) {
function SubscribeCallBack(err, data) {
expect(data.event == "ACTS_DoAbility_Event").assertTrue();
expect(data.event == "ACTS_DoAbility_Event").assertTrue();
console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data));
console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data));
globalThis.abilitydelegator.doAbilityForeground(ability, (err
, data
) => {
globalThis.abilitydelegator.doAbilityForeground(ability, (err) => {
console.log("====>ACTS_DoAbilityForeground_0100 data:====>" + JSON.stringify(
data
));
console.log("====>ACTS_DoAbilityForeground_0100 data:====>" + JSON.stringify(
err
));
expect(
data).assertEqual(true
);
expect(
err.code).assertEqual(0
);
setTimeout(() => {
setTimeout(() => {
var num = globalThis.abilitydelegator.getAbilityState(ability)
var num = globalThis.abilitydelegator.getAbilityState(ability)
console.log("====>ACTS_DoAbilityForeground_0100 getAbilityState:====>" + JSON.stringify(num));
console.log("====>ACTS_DoAbilityForeground_0100 getAbilityState:====>" + JSON.stringify(num));
...
@@ -108,9 +108,9 @@ export default function abilityTest() {
...
@@ -108,9 +108,9 @@ export default function abilityTest() {
ability = data
ability = data
expect(JSON.stringify(data) == JSON.stringify(mainability)).assertTrue();
expect(JSON.stringify(data) == JSON.stringify(mainability)).assertTrue();
console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability));
console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability));
globalThis.abilitydelegator.doAbilityForeground(ability, (err
, data
) => {
globalThis.abilitydelegator.doAbilityForeground(ability, (err) => {
console.log("====>ACTS_DoAbilityForeground_0200 data:====>" + JSON.stringify(
data
));
console.log("====>ACTS_DoAbilityForeground_0200 data:====>" + JSON.stringify(
err
));
expect(
data).assertEqual(true
);
expect(
err.code).assertEqual(0
);
setTimeout(() => {
setTimeout(() => {
var num = globalThis.abilitydelegator.getAbilityState(ability)
var num = globalThis.abilitydelegator.getAbilityState(ability)
console.log("====>ACTS_DoAbilityForeground_0200 getAbilityState:====>" + JSON.stringify(num));
console.log("====>ACTS_DoAbilityForeground_0200 getAbilityState:====>" + JSON.stringify(num));
...
@@ -143,9 +143,9 @@ export default function abilityTest() {
...
@@ -143,9 +143,9 @@ export default function abilityTest() {
function SubscribeCallBack(err, data) {
function SubscribeCallBack(err, data) {
expect(data.event == "ACTS_DoAbility_Event").assertTrue();
expect(data.event == "ACTS_DoAbility_Event").assertTrue();
console.log("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data));
console.log("====>0400 Subscribe CallBack data:====>" + JSON.stringify(data));
globalThis.abilitydelegator.doAbilityForeground(ability).then((
data
) => {
globalThis.abilitydelegator.doAbilityForeground(ability).then(() => {
console.log("====>ACTS_DoAbilityForeground_0400 data:====>"
+ JSON.stringify(data)
);
console.log("====>ACTS_DoAbilityForeground_0400 data:====>");
expect(
data).assertEqual(true
);
expect(
true).assertTrue(
);
setTimeout(() => {
setTimeout(() => {
var num = globalThis.abilitydelegator.getAbilityState(ability)
var num = globalThis.abilitydelegator.getAbilityState(ability)
console.log("====>ACTS_DoAbilityForeground_0400 getAbilityState:====>" + JSON.stringify(num));
console.log("====>ACTS_DoAbilityForeground_0400 getAbilityState:====>" + JSON.stringify(num));
...
@@ -198,9 +198,9 @@ export default function abilityTest() {
...
@@ -198,9 +198,9 @@ export default function abilityTest() {
console.log("====>getCurrentTopAbility mainability:====>" + JSON.stringify(mainability));
console.log("====>getCurrentTopAbility mainability:====>" + JSON.stringify(mainability));
expect(JSON.stringify(data) == JSON.stringify(mainability)).assertTrue();
expect(JSON.stringify(data) == JSON.stringify(mainability)).assertTrue();
console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability));
console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability));
globalThis.abilitydelegator.doAbilityForeground(ability).then((
data
) => {
globalThis.abilitydelegator.doAbilityForeground(ability).then(() => {
console.log("====>ACTS_DoAbilityForeground_0500 data:====>"
+ JSON.stringify(data)
);
console.log("====>ACTS_DoAbilityForeground_0500 data:====>");
expect(
data).assertEqual(true
);
expect(
true).assertTrue(
);
setTimeout(() => {
setTimeout(() => {
var num = globalThis.abilitydelegator.getAbilityState(ability)
var num = globalThis.abilitydelegator.getAbilityState(ability)
console.log("====>ACTS_DoAbilityForeground_0500 getAbilityState:====>" + JSON.stringify(num));
console.log("====>ACTS_DoAbilityForeground_0500 getAbilityState:====>" + JSON.stringify(num));
...
@@ -235,9 +235,9 @@ export default function abilityTest() {
...
@@ -235,9 +235,9 @@ export default function abilityTest() {
console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data));
console.log("====>0100 Subscribe CallBack data:====>" + JSON.stringify(data));
globalThis.abilitydelegator.getCurrentTopAbility().then((ability) => {
globalThis.abilitydelegator.getCurrentTopAbility().then((ability) => {
console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability));
console.log("====>getCurrentTopAbility ability data:====>" + JSON.stringify(ability));
globalThis.abilitydelegator.doAbilityBackground(ability, (err
, data1
) => {
globalThis.abilitydelegator.doAbilityBackground(ability, (err) => {
console.log("====>ACTS_DoAbilityBackground_0100 data:====>"
+ JSON.stringify(data1)
);
console.log("====>ACTS_DoAbilityBackground_0100 data:====>");
expect(
data1).assertEqual(true
);
expect(
err.code).assertEqual(0
);
setTimeout(() => {
setTimeout(() => {
var num = globalThis.abilitydelegator.getAbilityState(ability)
var num = globalThis.abilitydelegator.getAbilityState(ability)
console.log("====>ACTS_DoAbilityBackground_0100 getAbilityState:====>" + JSON.stringify(num));
console.log("====>ACTS_DoAbilityBackground_0100 getAbilityState:====>" + JSON.stringify(num));
...
@@ -296,9 +296,9 @@ export default function abilityTest() {
...
@@ -296,9 +296,9 @@ export default function abilityTest() {
console.log("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data));
console.log("====>0500 Subscribe CallBack data:====>" + JSON.stringify(data));
globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => {
globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => {
console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2));
console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2));
globalThis.abilitydelegator.doAbilityBackground(ability2).then((
data1
) => {
globalThis.abilitydelegator.doAbilityBackground(ability2).then(() => {
console.log("====>ACTS_DoAbilityBackground_0500 data:====>"
+ JSON.stringify(data1)
);
console.log("====>ACTS_DoAbilityBackground_0500 data:====>");
expect(
data1).assertEqual(true
);
expect(
true).assertTrue(
);
setTimeout(() => {
setTimeout(() => {
var num = globalThis.abilitydelegator.getAbilityState(ability2)
var num = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0500 getAbilityState:====>" + JSON.stringify(num));
console.log("====>ACTS_DoAbilityBackground_0500 getAbilityState:====>" + JSON.stringify(num));
...
@@ -357,32 +357,32 @@ export default function abilityTest() {
...
@@ -357,32 +357,32 @@ export default function abilityTest() {
globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => {
globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => {
console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2));
console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2));
console.log("====>0700newabilityname:====>" + JSON.stringify(ability2.context.abilityInfo.name));
console.log("====>0700newabilityname:====>" + JSON.stringify(ability2.context.abilityInfo.name));
globalThis.abilitydelegator.doAbilityBackground(ability2).then((
data1
) => {
globalThis.abilitydelegator.doAbilityBackground(ability2).then(() => {
console.log("====>doAbilityBackground data1:====>"
+ JSON.stringify(data1)
);
console.log("====>doAbilityBackground data1:====>");
expect(
data1).assertEqual(true
);
expect(
true).assertTrue(
);
setTimeout(() => {
setTimeout(() => {
num1 = globalThis.abilitydelegator.getAbilityState(ability2)
num1 = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState1:====>" + " " + JSON.stringify(num1));
console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState1:====>" + " " + JSON.stringify(num1));
expect(num1).assertEqual(3);
expect(num1).assertEqual(3);
globalThis.abilitydelegator.doAbilityForeground(ability2, (err
, data
) => {
globalThis.abilitydelegator.doAbilityForeground(ability2, (err) => {
console.log("====>doAbilityForeground data:====>" + JSON.stringify(
data
));
console.log("====>doAbilityForeground data:====>" + JSON.stringify(
err
));
expect(
data).assertEqual(true
);
expect(
err.code).assertEqual(0
);
setTimeout(() => {
setTimeout(() => {
num2 = globalThis.abilitydelegator.getAbilityState(ability2)
num2 = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState2:====>" +
console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState2:====>" +
" " + JSON.stringify(num2));
" " + JSON.stringify(num2));
expect(num2).assertEqual(2);
expect(num2).assertEqual(2);
globalThis.abilitydelegator.doAbilityBackground(ability2).then((
data1
) => {
globalThis.abilitydelegator.doAbilityBackground(ability2).then(() => {
console.log("====>doAbilityBackground data1:====>"
+ JSON.stringify(data1)
);
console.log("====>doAbilityBackground data1:====>");
expect(
data1).assertEqual(true
);
expect(
true).assertTrue(
);
setTimeout(() => {
setTimeout(() => {
num1 = globalThis.abilitydelegator.getAbilityState(ability2)
num1 = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState1:====>" +
console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState1:====>" +
" " + JSON.stringify(num1));
" " + JSON.stringify(num1));
expect(num1).assertEqual(3);
expect(num1).assertEqual(3);
globalThis.abilitydelegator.doAbilityForeground(ability2, (err
, data
) => {
globalThis.abilitydelegator.doAbilityForeground(ability2, (err) => {
console.log("====>doAbilityForeground data:====>"
+ JSON.stringify(data)
);
console.log("====>doAbilityForeground data:====>");
expect(
data).assertEqual(true
);
expect(
err.code).assertEqual(0
);
setTimeout(() => {
setTimeout(() => {
num2 = globalThis.abilitydelegator.getAbilityState(ability2)
num2 = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState2:====>" +
console.log("====>ACTS_DoAbilityBackground_0700 getAbilityState2:====>" +
...
@@ -448,32 +448,32 @@ export default function abilityTest() {
...
@@ -448,32 +448,32 @@ export default function abilityTest() {
globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => {
globalThis.abilitydelegator.getCurrentTopAbility().then((ability2) => {
console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2));
console.log("====>getCurrentTopAbility ability2 data:====>" + JSON.stringify(ability2));
console.log("====>0800newabilityname:====>" + JSON.stringify(ability2.context.abilityInfo.name));
console.log("====>0800newabilityname:====>" + JSON.stringify(ability2.context.abilityInfo.name));
globalThis.abilitydelegator.doAbilityBackground(ability2, (err
, data1
) => {
globalThis.abilitydelegator.doAbilityBackground(ability2, (err) => {
console.log("====>doAbilityBackground data1:====>" + JSON.stringify(
data1
));
console.log("====>doAbilityBackground data1:====>" + JSON.stringify(
err
));
expect(
data1).assertEqual(true
);
expect(
err.code).assertEqual(0
);
setTimeout(() => {
setTimeout(() => {
num1 = globalThis.abilitydelegator.getAbilityState(ability2)
num1 = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState1:====>" + " " + JSON.stringify(num1));
console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState1:====>" + " " + JSON.stringify(num1));
expect(num1).assertEqual(3);
expect(num1).assertEqual(3);
globalThis.abilitydelegator.doAbilityForeground(ability2).then((
data
) => {
globalThis.abilitydelegator.doAbilityForeground(ability2).then(() => {
console.log("====>doAbilityForeground data:====>"
+ JSON.stringify(data)
);
console.log("====>doAbilityForeground data:====>");
expect(
data).assertEqual(true
);
expect(
true).assertTrue(
);
setTimeout(() => {
setTimeout(() => {
num2 = globalThis.abilitydelegator.getAbilityState(ability2)
num2 = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState2:====>" +
console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState2:====>" +
" " + JSON.stringify(num2));
" " + JSON.stringify(num2));
expect(num2).assertEqual(2);
expect(num2).assertEqual(2);
globalThis.abilitydelegator.doAbilityBackground(ability2, (err
, data1
) => {
globalThis.abilitydelegator.doAbilityBackground(ability2, (err) => {
console.log("====>doAbilityBackground data1:====>" + JSON.stringify(
data1
));
console.log("====>doAbilityBackground data1:====>" + JSON.stringify(
err
));
expect(
data1).assertEqual(true
);
expect(
err.code).assertEqual(0
);
setTimeout(() => {
setTimeout(() => {
num1 = globalThis.abilitydelegator.getAbilityState(ability2)
num1 = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState1:====>" +
console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState1:====>" +
" " + JSON.stringify(num1));
" " + JSON.stringify(num1));
expect(num1).assertEqual(3);
expect(num1).assertEqual(3);
globalThis.abilitydelegator.doAbilityForeground(ability2).then((
data
) => {
globalThis.abilitydelegator.doAbilityForeground(ability2).then(() => {
console.log("====>doAbilityForeground data:====>"
+ JSON.stringify(data)
);
console.log("====>doAbilityForeground data:====>");
expect(
data).assertEqual(true
);
expect(
true).assertTrue(
);
setTimeout(() => {
setTimeout(() => {
num2 = globalThis.abilitydelegator.getAbilityState(ability2)
num2 = globalThis.abilitydelegator.getAbilityState(ability2)
console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState2:====>" +
console.log("====>ACTS_DoAbilityBackground_0800 getAbilityState2:====>" +
...
@@ -538,9 +538,9 @@ export default function abilityTest() {
...
@@ -538,9 +538,9 @@ export default function abilityTest() {
console.log("====>0300 Subscribe CallBack globalThis.ability3:====>" + JSON.stringify(globalThis.ability3));
console.log("====>0300 Subscribe CallBack globalThis.ability3:====>" + JSON.stringify(globalThis.ability3));
console.log("====>0300 ability3 name:====>" + JSON.stringify(globalThis.ability3.context.abilityInfo.name));
console.log("====>0300 ability3 name:====>" + JSON.stringify(globalThis.ability3.context.abilityInfo.name));
setTimeout(() => {
setTimeout(() => {
result = globalThis.abilitydelegator.doAbilityForeground(globalThis.ability3, (err
, data
) => {
result = globalThis.abilitydelegator.doAbilityForeground(globalThis.ability3, (err) => {
console.log("====>ACTS_DoAbilityForeground_0300 data:====>" + JSON.stringify(
data
));
console.log("====>ACTS_DoAbilityForeground_0300 data:====>" + JSON.stringify(
err
));
expect(
).assertFail(
);
expect(
err.code).assertEqual(0
);
})
})
console.log("====>0300 result:====>" + JSON.stringify(result));
console.log("====>0300 result:====>" + JSON.stringify(result));
expect(result).assertEqual(undefined);
expect(result).assertEqual(undefined);
...
@@ -645,9 +645,9 @@ export default function abilityTest() {
...
@@ -645,9 +645,9 @@ export default function abilityTest() {
expect(data.event == "ACTS_DoAbility_Event").assertTrue();
expect(data.event == "ACTS_DoAbility_Event").assertTrue();
console.log("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data));
console.log("====>0300 Subscribe CallBack data:====>" + JSON.stringify(data));
setTimeout(() => {
setTimeout(() => {
result = globalThis.abilitydelegator.doAbilityBackground(globalThis.ability3, (err
, data
) => {
result = globalThis.abilitydelegator.doAbilityBackground(globalThis.ability3, (err) => {
console.log("====>ACTS_DoAbilityBackground_0300 data:====>" + JSON.stringify(
data
));
console.log("====>ACTS_DoAbilityBackground_0300 data:====>" + JSON.stringify(
err
));
expect(
).assertFail(
);
expect(
err.code).assertEqual(0
);
})
})
console.log("====>DoAbilityBackground0300 result:====>" + JSON.stringify(result));
console.log("====>DoAbilityBackground0300 result:====>" + JSON.stringify(result));
expect(result).assertEqual(undefined);
expect(result).assertEqual(undefined);
...
...
ability/ability_runtime/freeinstalltest/startabilitystagetest/actsfreeinstallstartabilitystagetest/entry/src/main/ets/test/StartAbilityTest.ets
浏览文件 @
fcc05b90
...
@@ -132,14 +132,14 @@ export default function startAbilityTest(abilityContext) {
...
@@ -132,14 +132,14 @@ export default function startAbilityTest(abilityContext) {
});
});
async
function
abilityForeground
(
tag
)
{
async
function
abilityForeground
(
tag
)
{
globalThis
.
delegator
.
doAbilityForeground
(
globalThis
.
ability
,
(
err
:
any
,
data
:
any
)
=>
{
globalThis
.
delegator
.
doAbilityForeground
(
globalThis
.
ability
,
(
err
:
any
)
=>
{
console
.
info
(
tag
+
"doAbilityForeground err: "
+
JSON
.
stringify
(
err
)
+
", data: "
+
JSON
.
stringify
(
data
)
);
console
.
info
(
tag
+
"doAbilityForeground err: "
+
JSON
.
stringify
(
err
));
});
});
}
}
async
function
abilityBackground
(
tag
)
{
async
function
abilityBackground
(
tag
)
{
globalThis
.
delegator
.
doAbilityBackground
(
globalThis
.
ability
,
(
err
:
any
,
data
:
any
)
=>
{
globalThis
.
delegator
.
doAbilityBackground
(
globalThis
.
ability
,
(
err
:
any
)
=>
{
console
.
info
(
tag
+
"abilityBackground err: "
+
JSON
.
stringify
(
err
)
+
", data: "
+
JSON
.
stringify
(
data
)
);
console
.
info
(
tag
+
"abilityBackground err: "
+
JSON
.
stringify
(
err
));
});
});
}
}
...
...
ability/ability_runtime/freeinstalltest/startabilitystagetest/actsstartabilitynotargetbundleliststagetest/entry/src/main/ets/test/StartAbilityTest.ets
浏览文件 @
fcc05b90
...
@@ -87,8 +87,8 @@ export default function startAbilityTest(abilityContext) {
...
@@ -87,8 +87,8 @@ export default function startAbilityTest(abilityContext) {
});
});
async
function
abilityForeground
(
tag
)
{
async
function
abilityForeground
(
tag
)
{
globalThis
.
delegator
.
doAbilityForeground
(
globalThis
.
ability
,
(
err
:
any
,
data
:
any
)
=>
{
globalThis
.
delegator
.
doAbilityForeground
(
globalThis
.
ability
,
(
err
:
any
)
=>
{
console
.
info
(
tag
+
"doAbilityForeground err:"
+
JSON
.
stringify
(
err
)
+
", data:"
+
JSON
.
stringify
(
data
)
);
console
.
info
(
tag
+
"doAbilityForeground err:"
+
JSON
.
stringify
(
err
));
});
});
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录