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

!3225 新增测试用例+修改拼写错误

Merge pull request !3225 from ry/master
......@@ -22,6 +22,8 @@ const INVALID_CODE = 1;
const LAUNCHER_BUNDLE_NAME = "com.ohos.launcher";
const SELF_BUNDLENAME = "com.example.actsbmsetsunpermissiontest";
const SELF_ABILITYNAME = "com.example.actsbmsetsunpermissiontest.MainAbility";
const BUNDLE_SETTINGS = "com.ohos.settings";
const ABILITIY_SETTINGS = "com.ohos.settings.MainAbility";
export default function actsBmsJsUnPermissionTest() {
describe('actsBmsJsUnPermissionTest', function () {
......@@ -34,10 +36,8 @@ export default function actsBmsJsUnPermissionTest() {
it('getApplicationInfos_1300', 0, async function (done) {
await bundle.getAllApplicationInfo(DEFAULT_FLAG).then(data => {
expect().assertFail();
done();
}).catch(err => {
expect(err).assertEqual(INVALID_CODE);
done();
});
bundle.getAllApplicationInfo(DEFAULT_FLAG, (err, data) => {
expect(err).assertEqual(INVALID_CODE);
......@@ -54,10 +54,8 @@ export default function actsBmsJsUnPermissionTest() {
it('getBundleInfo_2000', 0, async function (done) {
await bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, { userId: 100 }).then(data => {
expect().assertFail();
done();
}).catch(err => {
expect(err).assertEqual(INVALID_CODE);
done();
});
bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, { userId: 100 }, (err, data) => {
expect(err).assertEqual(INVALID_CODE);
......@@ -74,10 +72,8 @@ export default function actsBmsJsUnPermissionTest() {
it('getApplicationInfo_1800', 0, async function (done) {
await bundle.getApplicationInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG).then(data => {
expect().assertFail();
done();
}).catch(err => {
expect(err).assertEqual(INVALID_CODE);
done();
});
bundle.getApplicationInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, (err, data) => {
expect(err).assertEqual(INVALID_CODE);
......@@ -138,6 +134,23 @@ export default function actsBmsJsUnPermissionTest() {
})
});
/*
* @tc.number: SUB_BMS_APPINFO_GETABILITYICON_0006
* @tc.name: test getAbilityIcon
* @tc.desc: test getAbilityIcon without permission
*/
it('SUB_BMS_APPINFO_GETABILITYICON_0006', 0, async function (done) {
await bundle.getAbilityIcon(BUNDLE_SETTINGS, ABILITIY_SETTINGS).then(pixelmap => {
expect(pixelmap).assertFail();
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.getAbilityIcon(BUNDLE_SETTINGS, ABILITIY_SETTINGS, (err, pixelmap) => {
expect(err).assertEqual(1);
done();
});
});
/*
* @tc.number: getAbilityInfo_100
* @tc.name: test getAbilityInfo
......@@ -191,15 +204,15 @@ export default function actsBmsJsUnPermissionTest() {
expect(data.descriptionId).assertLarger(0);
expect(data.formEnabled).assertEqual(false);
expect(data.iconId).assertLarger(0);
except(data.labelId).assertLarger(0);
expect(data.labelId).assertLarger(0);
expect(data.subType).assertEqual(0);
except(data.enabled).assertEqual(true);
expect(data.enabled).assertEqual(true);
expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual("");
expect(data.targetAbility).assertEqual("");
expect(data.theme).assertEqual("");
expect(data.metaData).assertEqual([]);
expect(data.metadata).assertEqual([]);
expect(data.metaData.length).assertEqual(0);
expect(data.metadata.length).assertEqual(0);
checkApplicationInfo(data.applicationInfo);
console.log("---checkAbilityInfo_other End--- ");
}
......@@ -220,10 +233,10 @@ export default function actsBmsJsUnPermissionTest() {
expect(info.supportedModes).assertEqual(0);
expect(info.process).assertEqual("");
expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/com.example.actsbmsetsunpermissiontest/com.example.actsbmsetsunpermissiontest");
expect(info.metaData).expect({});
expect(info.metadata).expect({});
expect(info.enabled).expect(true);
expect(info.flags).expect(0);
expect(JSON.stringify(info.metadata)).assertEqual("{}");
expect(JSON.stringify(info.metadata)).assertEqual("{}");
expect(info.enabled).assertEqual(true);
expect(info.flags).assertEqual(0);
expect(info.uid).assertLarger(0);
expect(info.entityType).assertEqual("unspecified");
expect(info.removable).assertEqual(true);
......
......@@ -27,24 +27,31 @@
"type": "PushKit",
"push": [
"bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap",
"bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap",
"bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap",
"bmsSystemBundleTest1.hap->/data/test/bmsSystemBundleTest1.hap",
"bmsVendorBundleTest1.hap->/data/test/bmsVendorBundleTest1.hap"
"bmsVendorBundleTest1.hap->/data/test/bmsVendorBundleTest1.hap",
"first_right.hap->/data/test/first_right.hap",
"second_right.hap->/data/test/second_right.hap"
]
},
{
"type": "ShellKit",
"run-command": [
"bm install -p /data/test/bmsThirdBundleTest1.hap",
"bm install -p /data/test/bmsThirdBundleTestA1.hap",
"bm install -p /data/test/bmsSystemBundleTest1.hap",
"bm install -p /data/test/bmsVendorBundleTest1.hap",
"bm install -p /data/test/bmsThirdBundleTest5.hap"
"bm install -p /data/test/bmsThirdBundleTest5.hap",
"bm install -p /data/test/first_right.hap",
"bm install -p /data/test/second_right.hap"
],
"teardown-command":[
"bm uninstall -n com.example.third1",
"bm uninstall -n com.example.system1",
"bm uninstall -n com.example.vendor1",
"bm uninstall -n com.example.third5",
"bm uninstall -n com.example.l3jsdemo",
"rm -rf /data/test/"
]
}
......
......@@ -21,11 +21,13 @@ const BUNDLE_NAME2 = 'com.example.third5';
const BUNDLE_NAME3 = 'com.example.noexist';
const BUNDLE_NAME4 = 'com.example.system1';
const BUNDLE_NAME5 = 'com.example.vendor1';
const BUNDLE_NAME6 = 'com.example.l3jsdemo';
const ABILITY_NAME1 = 'com.example.third1.MainAbility';
const ABILITY_NAME3 = 'com.example.third5.AMainAbility';
const ABILITY_NAME4 = 'com.example.noexist.MainAbility';
const ABILITY_NAME5 = 'com.example.system1.MainAbility';
const ABILITY_NAME6 = 'com.example.vendor1.MainAbility';
const ABILITY_NAME2 = 'com.example.third5.AMainAbility';
const ABILITY_NAME3 = 'com.example.noexist.MainAbility';
const ABILITY_NAME4 = 'com.example.system1.MainAbility';
const ABILITY_NAME5 = 'com.example.vendor1.MainAbility';
const ABILITY_NAME6 = 'com.example.l3jsdemo.MainAbility';
const USERID = 100;
describe('ActsBmsMetaDataTest', function () {
......@@ -33,7 +35,7 @@ describe('ActsBmsMetaDataTest', function () {
/*
* @tc.number: bms_getMetaData_0100
* @tc.name: test to get meta data for an application.
* @tc.desc: get an application's meta data which contains two HAP packages.
* @tc.desc: get an ability's meta data when update.
*/
it('bms_getMetaData_0100', 0, async function (done) {
await bundle.queryAbilityByWant(
......@@ -41,105 +43,173 @@ describe('ActsBmsMetaDataTest', function () {
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data1");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
}).catch(err => {
expect(err).assertFail();
done();
});
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("DataA1");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
}).catch(err => {
expect(err).assertFail();
});
bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME1,
"abilityName": ABILITY_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => {
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("DataA1");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
});
});
/*
* @tc.number: bms_getMetaData_0200
* @tc.name: test to get meta data for an application.
* @tc.desc: get an ability's meta data which contains two HAP packages.
*/
it('bms_getMetaData_0200', 0, async function (done) {
await bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME6,
"abilityName": ABILITY_NAME6
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
let metaDataInfo = dataInfos[0].metaData;
expect(metaDataInfo[0].name).assertEqual("Data3");
expect(metaDataInfo[0].value).assertEqual("float");
expect(metaDataInfo[0].extra).assertEqual("$string:mainability_description");
}).catch(err => {
expect(err).assertFail();
});
bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME6,
"abilityName": ABILITY_NAME6
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => {
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data3");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
});
});
/*
* @tc.number: bms_getMetaData_0400
* @tc.name: test to get meta data for an application.
* @tc.desc: get an application's meta data which has one ability.
* @tc.desc: get an ability's meta data which has two ability.
*/
it('bms_getMetaData_0400', 0, async function (done) {
await bundle.queryAbilityByWant(
{
bundleName: BUNDLE_NAME2,
abilityName: ABILITY_NAME3,
abilityName: ABILITY_NAME2,
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data5A");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
}).catch(err => {
expect(err).assertFail();
done();
});
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data5A");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
}).catch(err => {
expect(err).assertFail();
});
bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME2,
"abilityName": ABILITY_NAME2
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => {
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data5A");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
});
});
/*
* @tc.number: bms_getMetaData_0500
* @tc.name: test to get meta data for an application that does not exist.
* @tc.desc: get an application's meta data which does not exist.
* @tc.desc: get an ability's meta data which does not exist.
*/
it('bms_getMetaData_0500', 0, async function (done) {
await bundle.queryAbilityByWant(
{
bundleName: BUNDLE_NAME3,
abilityName: ABILITY_NAME4,
abilityName: ABILITY_NAME3,
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
expect(dataInfos.length).assertEqual(0);
done();
}).catch(err => {
console.info("err====: " + err);
expect(err).assertEqual(1);
done();
});
expect(dataInfos).assertFail();
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME3,
"abilityName": ABILITY_NAME3
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => {
expect(err).assertEqual(1);
expect(dataInfos).assertEqual("QueryAbilityInfos failed");
done();
});
});
/*
* @tc.number: bms_getMetaData_0600
* @tc.name: test to get meta data for a system application.
* @tc.desc: get a system application's meta data.
* @tc.desc: get a system ability's meta data.
*/
it('bms_getMetaData_0600', 0, async function (done) {
await bundle.queryAbilityByWant(
{
bundleName: BUNDLE_NAME4,
abilityName: ABILITY_NAME5,
abilityName: ABILITY_NAME4,
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data1S");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
}).catch(err => {
expect(err).assertFail();
done();
});
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data1S");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
}).catch(err => {
expect(err).assertFail();
});
bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME4,
"abilityName": ABILITY_NAME4
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => {
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("Data1S");
expect(metaData[0].value).assertEqual("float");
expect(metaData[0].extra).assertEqual("$string:mainability_description");
done();
});
});
/*
* @tc.number: bms_getMetaData_0700
* @tc.name: test to get meta data for a vendor application.
* @tc.desc: get a vendor application's meta data.
* @tc.desc: get a vendor ability's meta data.
*/
it('bms_getMetaData_0700', 0, async function (done) {
await bundle.queryAbilityByWant(
{
bundleName: BUNDLE_NAME5,
abilityName: ABILITY_NAME6,
abilityName: ABILITY_NAME5,
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => {
console.info("dataInfos[0].metaData" + JSON.stringify(dataInfos[0].metaData));
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("");
expect(metaData[0].value).assertEqual("");
expect(metaData[0].extra).assertEqual("");
done();
}).catch(err => {
expect(err).assertFail();
done();
});
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("vendorName");
expect(metaData[0].value).assertEqual("vendorValue");
expect(metaData[0].extra).assertEqual("vendorcustomizeData");
}).catch(err => {
expect(err).assertFail();
});
bundle.queryAbilityByWant(
{
"bundleName": BUNDLE_NAME5,
"abilityName": ABILITY_NAME5
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => {
let metaData = dataInfos[0].metaData;
expect(metaData[0].name).assertEqual("vendorName");
expect(metaData[0].value).assertEqual("vendorValue");
expect(metaData[0].extra).assertEqual("vendorcustomizeData");
done();
});
});
})
\ No newline at end of file
......@@ -298,15 +298,15 @@ export default function GetabilityInfo() {
expect(data.descriptionId).assertLarger(0);
expect(data.formEnabled).assertEqual(false);
expect(data.iconId).assertLarger(0);
except(data.labelId).assertLarger(0);
expect(data.labelId).assertLarger(0);
expect(data.subType).assertEqual(0);
except(data.enabled).assertEqual(true);
expect(data.enabled).assertEqual(true);
expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual("");
expect(data.targetAbility).assertEqual("");
expect(data.theme).assertEqual("");
expect(data.metaData).assertEqual([]);
expect(data.metadata).assertEqual([]);
expect(data.metaData.length).assertEqual(0);
expect(data.metadata.length).assertEqual(0);
checkApplicationInfo_other(data.applicationInfo);
console.log("---checkAbilityInfo_other End--- ");
}
......@@ -321,15 +321,15 @@ export default function GetabilityInfo() {
expect(info.iconId > 0).assertTrue();
expect(info.label).assertEqual("$string:app_name");
expect(info.labelId > 0).assertTrue();
expect(info.systemApp).assertEqual(true);
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/com.ohos.acecollaboration/com.ohos.acecollaboration");
expect(info.systemApp).assertEqual(false);
expect(info.entryDir).assertEqual("/data/app/el1/bundle/public/com.example.third1/com.example.third1.entry");
expect(info.supportedModes).assertEqual(0);
expect(info.process).assertEqual("");
expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/com.ohos.acecollaboration/com.ohos.acecollaboration");
expect(info.metaData).expect({});
expect(info.metadata).expect({});
expect(info.enabled).expect(true);
expect(info.flags).expect(0);
expect(info.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/com.example.third1/com.example.third1.entry");
expect(JSON.stringify(info.metaData)).assertEqual("{}");
expect(JSON.stringify(info.metadata)).assertEqual("{}");
expect(info.enabled).assertEqual(true);
expect(info.flags).assertEqual(0);
expect(info.uid).assertLarger(0);
expect(info.entityType).assertEqual("unspecified");
expect(info.removable).assertEqual(true);
......
......@@ -39,7 +39,16 @@
"label": "$string:app_name",
"type": "page",
"homeAbility": true,
"launchType": "standard"
"launchType": "standard",
"metaData": {
"customizeData": [
{
"name": "Data3",
"value": "float",
"extra": "$string:mainability_description"
}
]
}
}
],
"deviceType": [
......
......@@ -18,7 +18,7 @@
"module": {
"package": "com.example.third1.entry",
"name": "com.example.third1.BmsThirdBundle1",
"mainAbility": "com.example.third1.AMainAbility",
"mainAbility": "com.example.third1.MainAbility",
"colorMode": "dark",
"deviceType": [
"phone"
......@@ -40,7 +40,7 @@
]
}
],
"name": "com.example.third1.AMainAbility",
"name": "com.example.third1.MainAbility",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
......@@ -128,7 +128,7 @@
"voip",
"taskKeeping"
],
"name": "com.example.third1.AMainAbilityA",
"name": "com.example.third1.MainAbilityA",
"icon": "$media:icon",
"description": "$string:mainability_description",
"label": "$string:app_name",
......@@ -144,7 +144,7 @@
"label": "$string:shortcut",
"intents": [
{
"targetClass": "com.example.third1.AMainAbility",
"targetClass": "com.example.third1.MainAbility",
"targetBundle": "com.example.third1"
}
]
......
......@@ -106,8 +106,13 @@
"type": "float",
"description": "$string:mainability_description"
}],
"customizeData": [{
}]
"customizeData": [
{
"name": "vendorName",
"value": "vendorValue",
"extra": "vendorcustomizeData"
}
]
}
}
],
......
......@@ -34,7 +34,16 @@
"label": "$string:app_name",
"type": "page",
"homeAbility": false,
"launchType": "standard"
"launchType": "standard",
"metaData": {
"customizeData": [
{
"name": "Data2",
"value": "float",
"extra": "$string:mainability_description"
}
]
}
}
],
"deviceType": [
......
......@@ -122,7 +122,7 @@ it('ACTS_ZipFile_0300', 0, async function (done) {
/*
* @tc.number: ACTS_ZipFile_0400
* @tc.name: zipFile
* @tc.desc: The ouput file is a directory that does not exist
* @tc.desc: The output file is a directory that does not exist
*/
it('ACTS_ZipFile_0400', 0, async function (done) {
console.log("==================ACTS_ZipFile_0400 start==================");
......
......@@ -455,7 +455,7 @@ HWTEST_F(ActsZlibTest, ActsZlibTestSync, Function | MediumTest | Level2)
inflateSync(&d_stream);
inflate(&d_stream, Z_FINISH);
inflateEnd(&d_stream);
printf("after inflateSync: hel%s\n", reinterpret_cast<char *>(uncompr));
printf("after inflateSync: help%s\n", reinterpret_cast<char *>(uncompr));
free(compr);
free(uncompr);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册