Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e4c913bd
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,发现更多精彩内容 >>
提交
e4c913bd
编写于
3月 02, 2022
作者:
D
dingyao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add api7 and api8 ets tests
Signed-off-by:
N
dingyao
<
dingyao5@huawei.com
>
上级
923a0952
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
253 addition
and
104 deletion
+253
-104
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
.../main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
+24
-12
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetBundleGidsJsUnit.test.ets
...rc/main/ets/MainAbility/test/GetBundleGidsJsUnit.test.ets
+22
-10
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
...try/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
+184
-52
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets
...src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets
+8
-8
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets
...main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets
+6
-13
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
...ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
+3
-3
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
...in/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
+6
-6
未找到文件。
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets
浏览文件 @
e4c913bd
...
...
@@ -59,7 +59,7 @@ export default function getAbilityLabelJsUnit() {
console.info('[context_getAbilityLabel_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_getAbilityLabel_test_0100] promise error is: ' + error
.code
);
console.info('[context_getAbilityLabel_test_0100] promise error is: ' + error);
});
getAbilityLabelSuccess('[context_getAbilityLabel_test_0100]', mData);
done();
...
...
@@ -81,7 +81,7 @@ export default function getAbilityLabelJsUnit() {
Utils.getDurationTime('[context_getAbilityLabel_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_getAbilityLabel_test_0200] callBack in');
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error
.code
);
console.info('[context_getAbilityLabel_test_0200] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -107,13 +107,12 @@ export default function getAbilityLabelJsUnit() {
console.info('[context_getAbilityLabel_test_0300] promise in ');
console.info('[context_getAbilityLabel_test_0300] promise data is: ' + JSON.stringify(data));
getAbilityLabelSuccess('[context_getAbilityLabel_test_0300]', data);
})
.catch((error) => {
var timeNewStamp = Utils.getNowTime();
mError = error
.code
;
mError = error;
Utils.getDurationTime('[context_getAbilityLabel_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_getAbilityLabel_test_0300] promise error is: ' + error
.code
);
console.info('[context_getAbilityLabel_test_0300] promise error is: ' + error);
});
await Utils.sleep(2000);
getAbilityLabelFailure('[context_getAbilityLabel_test_0300]', mError);
...
...
@@ -134,9 +133,9 @@ export default function getAbilityLabelJsUnit() {
Bundle.getAbilityLabel(BUNDLE_NAME_ERROR, ABILITY_NAME_ERROR, (error, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0400]', timeOldStamp, timeNewStamp);
mError = error
.code
;
mError = error;
console.info('[context_getAbilityLabel_test_0400] callBack in');
console.info('[context_getAbilityLabel_test_0400] callBack error: ' + error
.code
);
console.info('[context_getAbilityLabel_test_0400] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0400] callBack data is:' + JSON.stringify(data));
});
...
...
@@ -155,6 +154,7 @@ export default function getAbilityLabelJsUnit() {
console.info('[context_getAbilityLabel_test_0500] promise START');
await Utils.sleep(1000);
let mData;
let mError = null;
var timeOldStamp = await Utils.getNowTime();
await Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME)
.then((data) => {
...
...
@@ -165,9 +165,14 @@ export default function getAbilityLabelJsUnit() {
console.info('[context_getAbilityLabel_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error.code);
mError = error;
console.info('[context_getAbilityLabel_test_0500] promise error is: ' + error);
});
if (mError != null) {
getAbilityLabelFailure('[context_getAbilityLabel_test_0500]', mError);
} else {
getAbilityLabelSuccess('[context_getAbilityLabel_test_0500]', mData);
}
done();
});
...
...
@@ -182,16 +187,22 @@ export default function getAbilityLabelJsUnit() {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
let mError = null;
Bundle.getAbilityLabel(OTHER_BUNDLE_NAME, OTHER_ABILITY_NAME, (error, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getAbilityLabel_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
mError = error;
console.info('[context_getAbilityLabel_test_0600] callBack in');
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error
.code
);
console.info('[context_getAbilityLabel_test_0600] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0600] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
if (mError != null) {
getAbilityLabelFailure('[context_getAbilityLabel_test_0600]', mError);
} else {
getAbilityLabelSuccess('[context_getAbilityLabel_test_0600]', mData);
}
done();
});
...
...
@@ -212,7 +223,7 @@ export default function getAbilityLabelJsUnit() {
Utils.getDurationTime('[context_getAbilityLabel_test_0700]', timeOldStamp, timeNewStamp);
mError = error;
console.info('[context_getAbilityLabel_test_0700] callBack in');
console.info('[context_getAbilityLabel_test_0700] callBack error: ' + error
.code
);
console.info('[context_getAbilityLabel_test_0700] callBack error: ' + error);
console.info('[context_getAbilityLabel_test_0700] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -228,6 +239,7 @@ export default function getAbilityLabelJsUnit() {
function getAbilityLabelFailure(msg, error) {
console.log(msg + ' Failure ');
console.log(msg + ' error ' + JSON.stringify(error));
expect(typeof (error)).assertEqual('number');
}
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetBundleGidsJsUnit.test.ets
浏览文件 @
e4c913bd
...
...
@@ -51,7 +51,7 @@ export default function bundleGidsJsUnit() {
console.info('[context_getBundleGids_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_getBundleGids_test_0100] promise error is: ' + error
.code
);
console.info('[context_getBundleGids_test_0100] promise error is: ' + error);
});
getGidsSuccess('[context_getBundleGids_test_0100]', mData);
done();
...
...
@@ -73,7 +73,7 @@ export default function bundleGidsJsUnit() {
Utils.getDurationTime('[context_getBundleGids_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_getBundleGids_test_0200] callBack in');
console.info('[context_getBundleGids_test_0200] callBack error: ' + error
.code
);
console.info('[context_getBundleGids_test_0200] callBack error: ' + error);
console.info('[context_getBundleGids_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -100,9 +100,9 @@ export default function bundleGidsJsUnit() {
})
.catch((error) => {
var timeNewStamp = Utils.getNowTime();
mError = error
.code
;
mError = error;
Utils.getDurationTime('[context_getBundleGids_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_getBundleGids_test_0300] promise error is: ' + error
.code
);
console.info('[context_getBundleGids_test_0300] promise error is: ' + error);
});
getGidsFailure('[context_getBundleGids_test_0300]', mError);
done();
...
...
@@ -123,9 +123,9 @@ export default function bundleGidsJsUnit() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getBundleGids_test_0400]', timeOldStamp, timeNewStamp);
mError = error
.code
;
mError = error;
console.info('[context_getBundleGids_test_0400] callBack in');
console.info('[context_getBundleGids_test_0400] callBack error: ' + error
.code
);
console.info('[context_getBundleGids_test_0400] callBack error: ' + error);
console.info('[context_getBundleGids_test_0400] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -144,6 +144,7 @@ export default function bundleGidsJsUnit() {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
let mError;
await Bundle.getBundleGids(OTHER_BUNDLE_NAME)
.then((data) => {
var timeNewStamp = Utils.getNowTime();
...
...
@@ -152,9 +153,14 @@ export default function bundleGidsJsUnit() {
console.info('[context_getBundleGids_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_getBundleGids_test_0500] promise error is: ' + error.code);
mError = error;
console.info('[context_getBundleGids_test_0500] promise error is: ' + error);
});
if (mError != null) {
getGidsFailure('[context_getBundleGids_test_0500]', mError);
} else {
getGidsSuccess('[context_getBundleGids_test_0500]', mData);
}
done();
});
...
...
@@ -169,16 +175,22 @@ export default function bundleGidsJsUnit() {
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
let mData;
let mError = null;
Bundle.getBundleGids(OTHER_BUNDLE_NAME, (error, data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_getBundleGids_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
mError = error;
console.info('[context_getBundleGids_test_0600] callBack in');
console.info('[context_getBundleGids_test_0600] callBack error: ' + error
.code
);
console.info('[context_getBundleGids_test_0600] callBack error: ' + error);
console.info('[context_getBundleGids_test_0600] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
if (mError != null) {
getGidsFailure('[context_getBundleGids_test_0600]', mError);
} else {
getGidsSuccess('[context_getBundleGids_test_0600]', mData);
}
done();
});
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets
浏览文件 @
e4c913bd
...
...
@@ -23,6 +23,8 @@ export default function GetabilityInfo() {
let abilityName = "com.open.harmony.packagemag.MainAbility";
let bundleName_other = "com.ohos.acecollaboration";
let abilityName_other = "com.ohos.acecollaboration.MainAbility";
let bundleName1 = "com.harmony.packagemag";
let abilityName1 = "com.harmony.packagemag1.MainAbility";
beforeEach(async function (done) {
console.info('GetabilityInfo before each called');
...
...
@@ -35,7 +37,7 @@ export default function GetabilityInfo() {
});
/*
* @tc.number: bundle_
Getability
Info_test_0100
* @tc.number: bundle_
getAllApplication
Info_test_0100
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
...
...
@@ -49,10 +51,8 @@ export default function GetabilityInfo() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0100', timeOldStamp, timeNewStamp)
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo data is: ' + JSON.stringify(data));
console.info('[bundle_GetabilityInfo_test_0100] getApplicationInfo
promise
data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
expect(data.bundleName).assertEqual("com.open.harmony.packagemag")
expect(data.name).assertEqual("com.open.harmony.packagemag.MainAbility");
}).catch((error) => {
console.error('[bundle_GetabilityInfo_test_0100]Operation failed. Cause: ' + JSON.stringify(error));
})
...
...
@@ -62,7 +62,7 @@ export default function GetabilityInfo() {
});
/*
* @tc.number: bundle_
Getability
Info_test_0200
* @tc.number: bundle_
getAllApplication
Info_test_0200
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
...
...
@@ -76,21 +76,17 @@ export default function GetabilityInfo() {
Utils.getDurationTime('bundle_GetabilityInfo_test_0200', timeOldStamp, timeNewStamp)
if (err) {
console.error('[bundle_GetabilityInfo_test_0200]Operation failed. Cause: ' + JSON.stringify(err));
expect(data.bundleName).assertEqual("com.open.harmony.packagemag")
return;
}
console.info('[bundle_GetabilityInfo_test_0200]Operation successful. Data:' + JSON.stringify(data));
expect(data.bundleName).assertEqual("com.open.harmony.packagemag")
expect(data.name).assertEqual("com.open.harmony.packagemag.MainAbility");
console.info('[bundle_GetabilityInfo_test_0200] getApplicationInfo callback data is: ' + JSON.stringify(data));
})
var callback = await bundleManager.getAbilityInfo(bundleName, abilityName);
checkAbilityInfo(callback)
checkAbilityInfo(callback);
done();
});
/*
* @tc.number: bundle_
Getability
Info_test_0300
* @tc.number: bundle_
getAllApplication
Info_test_0300
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
...
...
@@ -99,31 +95,35 @@ export default function GetabilityInfo() {
console.info('[bundle_GetabilityInfo_test_0300] START');
await Utils.sleep(1000);
var timeOldStamp = await Utils.getNowTime();
bundleManager.getAbilityInfo(bundleName_other, abilityName_other)
var mData;
var mError = null;
await bundleManager.getAbilityInfo(bundleName_other, abilityName_other)
.then((data) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0300',timeOldStamp,timeNewStamp)
Utils.getDurationTime('bundle_GetabilityInfo_test_0300', timeOldStamp, timeNewStamp);
mData = data;
console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo data is: ' + JSON.stringify(data));
console.info('[bundle_GetabilityInfo_test_0300] getApplicationInfo
promise
data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility");
}).catch((error) => {
mError = error;
console.error('[bundle_GetabilityInfo_test_0300]Operation failed. Cause: ' + JSON.stringify(error));
})
var promise = await bundleManager.getAbilityInfo(bundleName_other, abilityName_other);
checkAbilityInfo(promise);
if (mError != null) {
await expect(mError).assertEqual(1);
} else {
checkAbilityInfo_other(mData);
}
done();
});
/*
* @tc.number: bundle_
Getability
Info_test_0400
* @tc.number: bundle_
getAllApplication
Info_test_0400
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
*/
let bundleName1 = "com.harmony.packagemag";
it('bundle_GetabilityInfo_test_0400', 0, async function (done) {
console.info('[bundle_GetabilityInfo_test_0400] START');
let error1;
...
...
@@ -136,8 +136,6 @@ export default function GetabilityInfo() {
console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0400] getApplicationInfo data is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
expect(data.bundleName).assertEqual("com.open.harmony.packagemag")
expect(data.name).assertEqual("com.open.harmony.packagemag.MainAbility");
}).catch((error) => {
console.error('[bundle_GetabilityInfo_test_0400]Operation failed. Cause: ' + JSON.stringify(error));
error1 = error;
...
...
@@ -148,31 +146,27 @@ export default function GetabilityInfo() {
});
/*
* @tc.number: bundle_
Getability
Info_test_0500
* @tc.number: bundle_
getAllApplication
Info_test_0500
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by callback)
* @tc.level 0
*/
let abilityName1 = "com.harmony.packagemag1.MainAbility";
it('bundle_GetabilityInfo_test_0500', 0, async function (done) {
console.info('[bundle_GetabilityInfo_test_0500] START');
let error;
let datas;
bundleManager.getAbilityInfo(bundleName, abilityName1, (err, data) => {
let error
await bundleManager.getAbilityInfo(bundleName, abilityName1).then((data) => {
console.info('[bundle_GetabilityInfo_test_0500] START' + JSON.stringify(data));
}).catch((err) => {
console.info('[bundle_GetabilityInfo_test_0500] err = ' + JSON.stringify(err));
console.info('[bundle_GetabilityInfo_test_0500] data = ' + JSON.stringify(data));
datas = data;
error = err
});
await Utils.sleep(2000);
console.info('[bundle_GetabilityInfo_test_0500] error = ' + error);
console.info('[bundle_GetabilityInfo_test_0500] datas = ' + JSON.stringify(datas));
console.info('[bundle_GetabilityInfo_test_0500] END');
})
expect(error).assertEqual(1);
done();
console.info('[bundle_GetabilityInfo_test_0500] END');
});
/*
* @tc.number: bundle_
Getability
Info_test_0600
* @tc.number: bundle_
getAllApplication
Info_test_0600
* @tc.name: getAbilityInfo : The basic ability is enhanced to obtain the specified Ability information
* @tc.desc: Check the return value of the interface (by promise)
* @tc.level 0
...
...
@@ -188,7 +182,7 @@ export default function GetabilityInfo() {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('bundle_GetabilityInfo_test_0600', timeOldStamp, timeNewStamp)
console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo in ');
console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo data is: ' + JSON.stringify(data));
console.info('[bundle_GetabilityInfo_test_0600] getApplicationInfo data
promise
is: ' + JSON.stringify(data));
expect(typeof (data)).assertEqual("object");
}).catch((error) => {
console.error('[bundle_GetabilityInfo_test_0600]Operation failed. Cause: ' + JSON.stringify(error));
...
...
@@ -199,6 +193,7 @@ export default function GetabilityInfo() {
done();
});
/**
* 打印AbilityInfo属性信息
* @param data
...
...
@@ -235,10 +230,6 @@ export default function GetabilityInfo() {
}
console.log("checkAbilityInfo readPermission : " + data.readPermission);
console.log("checkAbilityInfo writePermission : " + data.writePermission);
console.log("checkAbilityInfo formEntity : " + data.formEntity);
console.log("checkAbilityInfo minFormHeight : " + data.minFormHeight);
console.log("checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight);
console.log("checkAbilityInfo minFormWidth : " + data.minFormWidth);
console.log("checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
console.log("checkAbilityInfo uri : " + data.uri);
console.log("checkAbilityInfo labelId : " + data.labelId);
...
...
@@ -251,7 +242,6 @@ export default function GetabilityInfo() {
expect(typeof (data.description)).assertEqual("string");
expect(data.icon).assertEqual("$media:icon");
expect(typeof (data.icon)).assertEqual("string");
expect(data.srcPath).assertEqual("default");
expect(typeof (data.srcPath)).assertEqual("string");
expect(data.srcLanguage).assertEqual("ets");
expect(typeof (data.srcLanguage)).assertEqual("string");
...
...
@@ -266,6 +256,8 @@ export default function GetabilityInfo() {
expect(data.moduleName).assertEqual("entry");
expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.applicationInfo)).assertEqual("object");
expect(data.bundleName).assertEqual("com.open.harmony.packagemag")
expect(data.name).assertEqual("com.open.harmony.packagemag.MainAbility");
checkApplicationInfo(data.applicationInfo);
console.log("---checkAbilityInfo End--- ");
}
...
...
@@ -286,7 +278,142 @@ export default function GetabilityInfo() {
console.log("checkApplicationInfo icon : " + info.icon);
console.log("checkApplicationInfo process : " + info.process);
console.log("checkApplicationInfo supportedModes : " + info.supportedModes);
console.log("checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
for (var j = 0; j < info.moduleSourceDirs.length; j++) {
console.log("checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
}
console.log("checkApplicationInfo permissions length : " + info.permissions.length);
for (var j = 0; j < info.permissions.length; j++) {
console.log("checkApplicationInfo info.permissions[" + j + "] : " + info.permissions[j]);
}
console.log("checkApplicationInfo moduleInfos length : " + info.moduleInfos.length);
for (var j = 0; j < info.moduleInfos.length; j++) {
console.log("checkApplicationInfo info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName);
console.log("checkApplicationInfo info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir);
}
console.log("checkApplicationInfo entryDir : " + info.entryDir);
expect(typeof (info)).assertEqual("object")
expect(typeof (info.name)).assertEqual("string")
expect(typeof (info.codePath)).assertEqual("string")
expect(info.accessTokenId > 0).assertTrue()
expect(typeof (info.accessTokenId)).assertEqual("number")
expect(typeof (info.description)).assertEqual("string")
expect(info.description).assertEqual("$string:mainability_description")
expect(info.descriptionId > 0).assertTrue()
expect(typeof (info.descriptionId)).assertEqual("number")
expect(typeof (info.icon)).assertEqual("string")
expect(info.icon).assertEqual("$media:icon")
expect(info.iconId > 0).assertTrue()
expect(typeof (info.iconId)).assertEqual("number")
expect(typeof (info.label)).assertEqual("string")
expect(info.label).assertEqual("$string:entry_MainAbility")
expect(info.labelId > 0).assertTrue()
expect(typeof (info.labelId)).assertEqual("number")
expect(info.systemApp).assertEqual(true)
expect(typeof (info.entryDir)).assertEqual("string")
expect(info.supportedModes).assertEqual(0)
expect(typeof (info.supportedModes)).assertEqual("number")
expect(typeof (info.process)).assertEqual("string")
expect(info.process).assertEqual("")
expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
expect(info.entryDir)
.assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag/com.open.harmony.packagemag");
expect(Array.isArray(info.permissions)).assertEqual(true);
expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag");
expect(info.moduleSourceDirs[0])
.assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag/com.open.harmony.packagemag");
expect(info.enabled).assertEqual(true);
expect(info.flags).assertEqual(0);
expect(info.uid > 0).assertTrue()
expect(info.entityType).assertEqual("unspecified");
expect(info.removable).assertEqual(true);
expect(info.accessTokenId > 0).assertTrue()
}
/**
* 打印ApplicationInfo属性信息
* @param data
*/
function checkAbilityInfo_other(data) {
console.log("checkAbilityInfo start " + JSON.stringify(data));
console.log("checkAbilityInfo bundleName : " + data.bundleName);
console.log("checkAbilityInfo name : " + data.name);
console.log("checkAbilityInfo label : " + data.label);
console.log("checkAbilityInfo description : " + data.description);
console.log("checkAbilityInfo icon : " + data.icon);
console.log("checkAbilityInfo descriptionId : " + data.descriptionId);
console.log("checkAbilityInfo iconId : " + data.iconId);
console.log("checkAbilityInfo moduleName : " + data.moduleName);
console.log("checkAbilityInfo process : " + data.process);
console.log("checkAbilityInfo targetAbility : " + data.targetAbility);
console.log("checkAbilityInfo backgroundModes : " + data.backgroundModes);
console.log("checkAbilityInfo isVisible : " + data.isVisible);
console.log("checkAbilityInfo formEnabled : " + data.formEnabled);
console.log("checkAbilityInfo type : " + data.type)
console.log("checkAbilityInfo orientation : " + data.orientation);
console.log("checkAbilityInfo launchMode : " + data.launchMode);
console.log("checkAbilityInfo permissions length : " + data.permissions.length);
for (var j = 0; j < data.permissions.length; j++) {
console.log("getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]);
}
console.log("checkAbilityInfo deviceTypes length : " + data.deviceTypes.length);
for (var k = 0; k < data.deviceTypes.length; k++) {
console.log("getAbilityInfo data.deviceTypes[" + k + "] : " + data.deviceTypes[k]);
}
console.log("checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length);
for (var i = 0; i < data.deviceCapabilities.length; i++) {
console.log("getAbilityInfo data.deviceCapabilities[" + i + "] : " + data.deviceCapabilities[i]);
}
console.log("checkAbilityInfo readPermission : " + data.readPermission);
console.log("checkAbilityInfo writePermission : " + data.writePermission);
console.log("checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth);
console.log("checkAbilityInfo uri : " + data.uri);
console.log("checkAbilityInfo labelId : " + data.labelId);
console.log("checkAbilityInfo subType : " + data.subType);
expect(typeof (data.bundleName)).assertEqual("string");
expect(typeof (data.name)).assertEqual("string");
expect(data.label).assertEqual("$string:entry_MainAbility");
expect(typeof (data.label)).assertEqual("string");
expect(data.description).assertEqual("$string:mainability_description");
expect(typeof (data.description)).assertEqual("string");
expect(data.icon).assertEqual("$media:icon");
expect(typeof (data.icon)).assertEqual("string");
expect(typeof (data.srcPath)).assertEqual("string");
expect(data.srcLanguage).assertEqual("ets");
expect(typeof (data.srcLanguage)).assertEqual("string");
expect(data.isVisible).assertEqual(true);
expect(Array.isArray(data.permissions)).assertEqual(true);
expect(Array.isArray(data.deviceCapabilities)).assertEqual(true);
expect(data.deviceTypes[0]).assertEqual("phone");
expect(typeof (data.process)).assertEqual("string");
expect(typeof (data.uri)).assertEqual("string");
expect(data.uri).assertEqual("");
expect(typeof (data.uri)).assertEqual("string");
expect(data.moduleName).assertEqual("entry");
expect(typeof (data.moduleName)).assertEqual("string");
expect(typeof (data.applicationInfo)).assertEqual("object");
expect(data.bundleName).assertEqual("com.ohos.acecollaboration");
expect(data.name).assertEqual("com.ohos.acecollaboration.MainAbility");
checkApplicationInfo_other(data.applicationInfo);
console.log("---checkAbilityInfo End--- ");
}
/**
* 打印ApplicationInfo属性信息
* @param data
*/
function checkApplicationInfo_other(info) {
console.log("checkApplicationInfo getApplicationInfo : " + JSON.stringify(info));
console.log("checkApplicationInfo name : " + info.name);
console.log("checkApplicationInfo description : " + info.description);
console.log("checkApplicationInfo descriptionId : " + info.descriptionId);
console.log("checkApplicationInfo systemApp : " + info.systemApp);
console.log("checkApplicationInfo enabled : " + info.enabled);
console.log("checkApplicationInfo label : " + info.label);
console.log("checkApplicationInfo labelId : " + info.labelId);
console.log("checkApplicationInfo icon : " + info.icon);
console.log("checkApplicationInfo process : " + info.process);
console.log("checkApplicationInfo supportedModes : " + info.supportedModes);
console.log("checkApplicationInfo moduleSourceDirs length : " + info.moduleSourceDirs.length);
for (var j = 0; j < info.moduleSourceDirs.length; j++) {
console.log("checkApplicationInfo info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]);
...
...
@@ -301,14 +428,9 @@ export default function GetabilityInfo() {
console.log("checkApplicationInfo info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir);
}
console.log("checkApplicationInfo entryDir : " + info.entryDir);
//
//
//断研 callback
expect(typeof (info)).assertEqual("object")
expect(info.name).assertEqual("com.open.harmony.packagemag")
expect(typeof (info.name)).assertEqual("string")
expect(typeof (info.codePath)).assertEqual("string")
expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag")
expect(info.accessTokenId > 0).assertTrue()
expect(typeof (info.accessTokenId)).assertEqual("number")
expect(typeof (info.description)).assertEqual("string")
...
...
@@ -325,13 +447,23 @@ export default function GetabilityInfo() {
expect(typeof (info.labelId)).assertEqual("number")
expect(info.systemApp).assertEqual(true)
expect(typeof (info.entryDir)).assertEqual("string")
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag/com.open.harmony.packagemag")
expect(info.supportedModes).assertEqual(0)
expect(typeof (info.supportedModes)).assertEqual("number")
expect(typeof (info.process)).assertEqual("string")
expect(info.process).assertEqual("")
expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true);
expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/com.open.harmony.packagemag/com.open.harmony.packagemag");
expect(info.entryDir)
.assertEqual("/data/app/el1/bundle/public/com.ohos.acecollaboration/com.ohos.acecollaboration");
expect(Array.isArray(info.permissions)).assertEqual(true);
expect(info.codePath).assertEqual("/data/app/el1/bundle/public/com.ohos.acecollaboration");
expect(info.moduleSourceDirs[0])
.assertEqual("/data/app/el1/bundle/public/com.ohos.acecollaboration/com.ohos.acecollaboration");
expect(info.enabled).assertEqual(true);
expect(info.flags).assertEqual(0);
expect(info.uid > 0).assertTrue()
expect(info.entityType).assertEqual("unspecified");
expect(info.removable).assertEqual(true);
expect(info.accessTokenId > 0).assertTrue()
}
});
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets
浏览文件 @
e4c913bd
...
...
@@ -64,7 +64,7 @@ export default function isAbilityEnabledETSUnit() {
console.info('[context_isAbilityEnabled_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isAbilityEnabled_test_0100] promise error is: ' + error
.code
);
console.info('[context_isAbilityEnabled_test_0100] promise error is: ' + error);
});
getAbilityEnabledSuccess('[context_isAbilityEnabled_test_0100]', mData);
done();
...
...
@@ -86,7 +86,7 @@ export default function isAbilityEnabledETSUnit() {
Utils.getDurationTime('[context_isAbilityEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0200] callBack in');
console.info('[context_isAbilityEnabled_test_0200] callBack error: ' + error
.code
);
console.info('[context_isAbilityEnabled_test_0200] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -116,7 +116,7 @@ export default function isAbilityEnabledETSUnit() {
.catch((error) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isAbilityEnabled_test_0300] promise error is: ' + error
.code
);
console.info('[context_isAbilityEnabled_test_0300] promise error is: ' + error);
});
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0300]', mData);
done();
...
...
@@ -139,7 +139,7 @@ export default function isAbilityEnabledETSUnit() {
Utils.getDurationTime('[context_isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isAbilityEnabled_test_0400] callBack in');
mData = data;
console.info('[context_isAbilityEnabled_test_0400] callBack error: ' + error
.code
);
console.info('[context_isAbilityEnabled_test_0400] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
console.info('[context_isAbilityEnabled_test_0400] end c++ callBack ');
...
...
@@ -179,7 +179,7 @@ export default function isAbilityEnabledETSUnit() {
console.info('[context_isAbilityEnabled_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isAbilityEnabled_test_0500] promise error is: ' + error
.code
);
console.info('[context_isAbilityEnabled_test_0500] promise error is: ' + error);
});
getAbilityEnabledTrue('[context_isAbilityEnabled_test_0500]', mData);
done();
...
...
@@ -214,7 +214,7 @@ export default function isAbilityEnabledETSUnit() {
console.info('[context_isAbilityEnabled_test_0600] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isAbilityEnabled_test_0600] promise error is: ' + error
.code
);
console.info('[context_isAbilityEnabled_test_0600] promise error is: ' + error);
});
getAbilityEnabledFalse('[context_isAbilityEnabled_test_0600]', mData);
done();
...
...
@@ -245,7 +245,7 @@ export default function isAbilityEnabledETSUnit() {
Utils.getDurationTime('[context_isAbilityEnabled_test_0700]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0700] callBack in');
console.info('[context_isAbilityEnabled_test_0700] callBack error: ' + error
.code
);
console.info('[context_isAbilityEnabled_test_0700] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0700] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -278,7 +278,7 @@ export default function isAbilityEnabledETSUnit() {
Utils.getDurationTime('[context_isAbilityEnabled_test_0800]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isAbilityEnabled_test_0800] callBack in');
console.info('[context_isAbilityEnabled_test_0800] callBack error: ' + error
.code
);
console.info('[context_isAbilityEnabled_test_0800] callBack error: ' + error);
console.info('[context_isAbilityEnabled_test_0800] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets
浏览文件 @
e4c913bd
...
...
@@ -52,7 +52,7 @@ export default function IsApplicationEnabledETSUnit() {
console.info('[context_isApplicationEnabled_test_0100] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isApplicationEnabled_test_0100] promise error is: ' + error
.code
);
console.info('[context_isApplicationEnabled_test_0100] promise error is: ' + error);
});
getApplicationEnabledSuccess('[context_isApplicationEnabled_test_0100]', mData);
done();
...
...
@@ -74,7 +74,7 @@ export default function IsApplicationEnabledETSUnit() {
Utils.getDurationTime('[context_isApplicationEnabled_test_0200]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0200] callBack in');
console.info('[context_isApplicationEnabled_test_0200] callBack error: ' + error
.code
);
console.info('[context_isApplicationEnabled_test_0200] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0200] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -104,7 +104,7 @@ export default function IsApplicationEnabledETSUnit() {
.catch((error) => {
var timeNewStamp = Utils.getNowTime();
Utils.getDurationTime('[context_isApplicationEnabled_test_0300]', timeOldStamp, timeNewStamp);
console.info('[context_isApplicationEnabled_test_0300] promise error is: ' + error
.code
);
console.info('[context_isApplicationEnabled_test_0300] promise error is: ' + error);
});
getApplicationEnabledFalse('[context_isApplicationEnabled_test_0300]', mData);
done();
...
...
@@ -126,7 +126,7 @@ export default function IsApplicationEnabledETSUnit() {
Utils.getDurationTime('[context_isApplicationEnabled_test_0400]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0400] callBack in');
console.info('[context_isApplicationEnabled_test_0400] callBack error: ' + error
.code
);
console.info('[context_isApplicationEnabled_test_0400] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0400] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -163,7 +163,7 @@ export default function IsApplicationEnabledETSUnit() {
console.info('[context_isApplicationEnabled_test_0500] promise data is: ' + JSON.stringify(data));
})
.catch((error) => {
console.info('[context_isApplicationEnabled_test_0500] promise error is: ' + error
.code
);
console.info('[context_isApplicationEnabled_test_0500] promise error is: ' + error);
});
getApplicationEnabledTrue('[context_isApplicationEnabled_test_0500]', mData);
done();
...
...
@@ -194,7 +194,7 @@ export default function IsApplicationEnabledETSUnit() {
Utils.getDurationTime('[context_isApplicationEnabled_test_0600]', timeOldStamp, timeNewStamp);
mData = data;
console.info('[context_isApplicationEnabled_test_0600] callBack in');
console.info('[context_isApplicationEnabled_test_0600] callBack error: ' + error
.code
);
console.info('[context_isApplicationEnabled_test_0600] callBack error: ' + error);
console.info('[context_isApplicationEnabled_test_0600] callBack data is:' + JSON.stringify(data));
});
await Utils.sleep(2000);
...
...
@@ -217,12 +217,5 @@ export default function IsApplicationEnabledETSUnit() {
getApplicationEnabledSuccess(msg, data);
expect(data).assertEqual(false);
}
function getApplicationEnabledFailure(msg, error) {
console.log(msg + ' Failure ');
console.log(msg + ' error : ' + error);
expect(typeof (error)).assertEqual('number')
}
})
}
\ No newline at end of file
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets
浏览文件 @
e4c913bd
...
...
@@ -377,13 +377,13 @@ export default function applicationBundleJsunit() {
expect(data[i].codePath).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag');
expect(data[i].description).assertEqual('$string:mainability_description');
if (data[i].descriptionId !== 0) {
expect(data[i].descriptionId
).assertEqual(16777217
);
expect(data[i].descriptionId
> 0).assertEqual(true
);
}
expect(data[i].icon).assertEqual('$media:icon');
expect(data[i].iconId
).assertEqual(16777218
);
expect(data[i].iconId
> 0).assertEqual(true
);
expect(data[i].label).assertEqual('$string:entry_MainAbility');
if (data[i].label !== 0) {
expect(data[i].labelId
).assertEqual(16777216
);
expect(data[i].labelId
> 0).assertEqual(true
);
}
expect(data[i].systemApp).assertEqual(true);
expect(data[i].supportedModes).assertEqual(0);
...
...
appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets
浏览文件 @
e4c913bd
...
...
@@ -519,11 +519,11 @@ export default function applicationBundleJsunit() {
expect(data.name).assertEqual('com.open.harmony.packagemag');
expect(data.codePath).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag');
expect(data.description).assertEqual('$string:mainability_description');
expect(data.descriptionId).assertEqual(16777217);
//
expect(data.descriptionId).assertEqual(16777217);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId).assertEqual(16777218);
//
expect(data.iconId).assertEqual(16777218);
expect(data.label).assertEqual('$string:entry_MainAbility');
expect(data.labelId).assertEqual(16777216);
//
expect(data.labelId).assertEqual(16777216);
expect(data.systemApp).assertEqual(true);
expect(data.supportedModes).assertEqual(0);
expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' +
...
...
@@ -572,11 +572,11 @@ export default function applicationBundleJsunit() {
expect(data.name).assertEqual('com.ohos.acepackage');
expect(data.codePath).assertEqual('/data/app/el1/bundle/public/com.ohos.acepackage');
expect(data.description).assertEqual('$string:description_mainability');
expect(data.descriptionId
).assertEqual(16777216
);
expect(data.descriptionId
> 0).assertEqual(true
);
expect(data.icon).assertEqual('$media:icon');
expect(data.iconId
).assertEqual(16777218
);
expect(data.iconId
> 0).assertEqual(true
);
expect(data.label).assertEqual('$string:entry_MainAbility');
expect(data.labelId
).assertEqual(16777217
);
expect(data.labelId
> 0).assertEqual(true
);
expect(data.systemApp).assertEqual(true);
expect(data.supportedModes).assertEqual(0);
expect(data.entryDir).assertEqual('/data/app/el1/bundle/public/com.ohos.acepackage' +
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录