Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e095c39f
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
接近 2 年 前同步成功
通知
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看板
提交
e095c39f
编写于
6月 28, 2022
作者:
I
inter515
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增构造abilityInfo对象的方法
Signed-off-by:
N
inter515
<
ry.renyi@huawei.com
>
上级
bb6c7de3
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
353 addition
and
248 deletion
+353
-248
appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets
...entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets
+275
-222
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsAbilityEnabledETSUnit.ets
...stest/entry/src/main/ets/test/IsAbilityEnabledETSUnit.ets
+78
-26
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/test/ActsBmsEtsModuleNameTest.test.ets
浏览文件 @
e095c39f
此差异已折叠。
点击以展开。
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/IsAbilityEnabledETSUnit.ets
浏览文件 @
e095c39f
...
...
@@ -22,14 +22,6 @@ const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error';
const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility';
const ABILITY_NAME_OTHER = 'com.example.l3jsdemo.MainAbility';
const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility';
const ABILITY = {
bundleName: BUNDLE_NAME,
name: ABILITY_NAME
};
const OTHER_ABILITY = {
bundleName: BUNDLE_NAME_OTHER,
name: ABILITY_NAME_OTHER
};
const ABILITY_ERROR1 = {
bundleName: BUNDLE_NAME_ERROR,
name: ABILITY_NAME_ERROR
...
...
@@ -59,6 +51,7 @@ const ABILITY_ERROR7 = {
name: ""
};
export default function isAbilityEnabledETSUnit() {
describe('isAbilityEnabled_test', function () {
...
...
@@ -70,7 +63,8 @@ export default function isAbilityEnabledETSUnit() {
*/
it('isAbilityEnabled_test_0100', 0, async function (done) {
let timeOldStamp = await Utils.getNowTime();
await Bundle.isAbilityEnabled(ABILITY).then((data) => {
let abilityInfo = getAbilityInfoOne(BUNDLE_NAME,ABILITY_NAME);
await Bundle.isAbilityEnabled(abilityInfo).then((data) => {
let timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp);
expect(data).assertTrue();
...
...
@@ -78,7 +72,7 @@ export default function isAbilityEnabledETSUnit() {
expect(error).assertFail();
});
timeOldStamp = await Utils.getNowTime();
Bundle.isAbilityEnabled(
ABILITY
, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
, (error, data) => {
if (error) {
expect(error).assertFail();
}
...
...
@@ -95,36 +89,40 @@ export default function isAbilityEnabledETSUnit() {
* @tc.desc: Check the return value of the interface when bundleName and ability error
*/
it('isAbilityEnabled_test_0200', 0, async function (done) {
await Bundle.isAbilityEnabled(ABILITY_ERROR1).then((data) => {
let abilityInfo1 = getAbilityInfoOne(ABILITY_ERROR1.bundleName,ABILITY_ERROR1.name);
let abilityInfo2 = getAbilityInfoOne(ABILITY_ERROR2.bundleName,ABILITY_ERROR2.name);
let abilityInfo3 = getAbilityInfoOne(ABILITY_ERROR3.bundleName,ABILITY_ERROR3.name);
let abilityInfo7 = getAbilityInfoOne(ABILITY_ERROR7.bundleName,ABILITY_ERROR7.name);
Bundle.isAbilityEnabled(abilityInfo1).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
await Bundle.isAbilityEnabled(ABILITY_ERROR
2).then((data) => {
Bundle.isAbilityEnabled(abilityInfo
2).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
await Bundle.isAbilityEnabled(ABILITY_ERROR
3).then((data) => {
Bundle.isAbilityEnabled(abilityInfo
3).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
await Bundle.isAbilityEnabled(ABILITY_ERROR
7).then((data) => {
Bundle.isAbilityEnabled(abilityInfo
7).then((data) => {
expect(data).assertFalse();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(
ABILITY_ERROR
1, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
1, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(
ABILITY_ERROR
2, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
2, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(
ABILITY_ERROR
3, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
3, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertFalse();
Bundle.isAbilityEnabled(
ABILITY_ERROR
7, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
7, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertFalse();
done();
...
...
@@ -140,28 +138,31 @@ export default function isAbilityEnabledETSUnit() {
* @tc.desc: Check the return value of the interface when bundleName and ability error
*/
it('isAbilityEnabled_test_0300', 0, async function (done) {
await Bundle.isAbilityEnabled(ABILITY_ERROR4).then((data) => {
let abilityInfo4 = getAbilityInfoOne(ABILITY_ERROR4.bundleName,ABILITY_ERROR4.name);
let abilityInfo5 = getAbilityInfoOne(ABILITY_ERROR5.bundleName,ABILITY_ERROR5.name);
let abilityInfo6 = getAbilityInfoOne(ABILITY_ERROR6.bundleName,ABILITY_ERROR6.name);
Bundle.isAbilityEnabled(abilityInfo4).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
await Bundle.isAbilityEnabled(ABILITY_ERROR
5).then((data) => {
Bundle.isAbilityEnabled(abilityInfo
5).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
await Bundle.isAbilityEnabled(ABILITY_ERROR
6).then((data) => {
Bundle.isAbilityEnabled(abilityInfo
6).then((data) => {
expect(data).assertFail();
}).catch((error) => {
expect(error).assertEqual(2);
});
Bundle.isAbilityEnabled(
ABILITY_ERROR
4, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
4, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.isAbilityEnabled(
ABILITY_ERROR
5, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
5, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
Bundle.isAbilityEnabled(
ABILITY_ERROR
6, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
6, (error, data) => {
expect(error).assertEqual(2);
expect(data).assertEqual(undefined);
done();
...
...
@@ -176,16 +177,67 @@ export default function isAbilityEnabledETSUnit() {
* @tc.desc: Check the return value of the interface
*/
it('isAbilityEnabled_test_0400', 0, async function (done) {
await Bundle.isAbilityEnabled(OTHER_ABILITY).then((data) => {
let abilityInfo = getAbilityInfoOne(BUNDLE_NAME_OTHER,ABILITY_NAME_OTHER);
await Bundle.isAbilityEnabled(abilityInfo).then((data) => {
expect(data).assertTrue();
}).catch((error) => {
expect(error).assertFail();
});
Bundle.isAbilityEnabled(
OTHER_ABILITY
, (error, data) => {
Bundle.isAbilityEnabled(
abilityInfo
, (error, data) => {
expect(error).assertEqual(0);
expect(data).assertTrue();
done();
});
});
function getAbilityInfoOne(bundleName, name) {
let map1 = new Map([
["", [{
"name": "", "value": "", "extra": ""
}]]
]);
let map2 = new Map([
["", [{
"name": "", "value": "", "resource": ""
}]]
]);
let abilityInfo = {
bundleName: bundleName,
name: name,
label: "",
description: "",
icon: "",
labelId: 0,
descriptionId: 0,
iconId: 0,
moduleName: "",
process: "",
targetAbility: "",
backgroundModes: 0,
isVisible: true,
formEnabled: true,
type: 0,
subType: 0,
orientation: 0,
launchMode: 0,
permissions: [],
deviceTypes: [],
deviceCapabilities: [],
readPermission: "",
writePermission: "",
applicationInfo: {
name: "", description: "", descriptionId: 0, systemApp: true, enabled: true, label: "",
labelId: "", icon: "", iconId: "", process: "", supportedModes: 0, moduleSourceDirs: [],
permissions: [], moduleInfos: [], entryDir: "", codePath: "", metaData: map1, metadata: map2,
removable: true, accessTokenId: 0, uid: 0, entityType: "", fingerprint: ""
},
uri: "", metaData: [], metadata: [], enabled: true, supportWindowMode: [],
maxWindowRatio: 0, minWindowRatio: 0, maxWindowWidth: 0, minWindowWidth: 0, maxWindowHeight: 0, minWindowHeight: 0
};
return abilityInfo;
}
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录