提交 cd6afaca 编写于 作者: I inter515

代码规范修改-移除getBundleArchiveInfo接口

Signed-off-by: Ninter515 <ry.renyi@huawei.com>
上级 4bbc855c
......@@ -38,17 +38,25 @@ describe('ActsBmsQueryAbilityByWant', function () {
it('bms_queryAbilityByWant_0100', 0, async function (done) {
await bundle.getBundleInstaller().then(installer => {
installer.install(BUNDLE_PATH1, installParam, onReceiveinstallEvent);
function onReceiveinstallEvent(err, data) {
async function onReceiveinstallEvent(err, data) {
checkInstallOrUninstall(err, data);
await bundle.queryAbilityByWant({
action: ['action.system.home'],
entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, USERID).then(data => {
expect(data).assertEqual("QueryAbilityInfos failed");
}).catch(err => {
expect(err).assertEqual(1);
});
bundle.queryAbilityByWant({
action: ['action.system.home'],
entities: ['entity.system.home'],
bundleName: BUNDLE_NAME1
}, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID, (err, data) => {
if (err) {
expect(err).assertEqual(1);
}
expect(err).assertEqual(1);
expect(data).assertEqual("QueryAbilityInfos failed");
installer.uninstall(BUNDLE_NAME1, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
......@@ -72,13 +80,28 @@ describe('ActsBmsQueryAbilityByWant', function () {
},
bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID).then(data => {
expect(data.length).assertLarger(0);
for (let i = 0; i < data.length; ++i) {
expect(data[i].applicationInfo.systemApp).assertEqual(true);
}
done();
}
).catch(err => {
expect(err).assertFail();
});
bundle.queryAbilityByWant(
{
action: ['action.system.home'],
entities: ['entity.system.home']
},
bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY,
USERID, (err, data) => {
if (err) {
expect(err).assertFail();
}
expect(data.length).assertLarger(0);
for (let i = 0; i < data.length; ++i) {
expect(data[i].applicationInfo.systemApp).assertEqual(true);
}
done();
});
});
......@@ -109,45 +132,28 @@ describe('ActsBmsQueryAbilityByWant', function () {
abilityName: '',
},
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID);
for(let i = 0; i < dataInfos.length ; i ++){
console.info ('dataInfos============='+ i);
for (const item in dataInfos[0]) {
const a = dataInfos[0][item];
console.info(item+":"+ JSON.stringify(a));
};
};
expect(dataInfos.length).assertEqual(1);
expect(dataInfos[0].name).assertEqual(ABILITIY_NAME8);
expect(dataInfos[0].label).assertEqual('$string:app_name');
expect(dataInfos[0].description).assertEqual('$string:mainability_description');
expect(dataInfos[0].icon).assertEqual("$media:icon");
expect(dataInfos[0].srcPath).assertEqual("");
expect(dataInfos[0].srcLanguage).assertEqual("js");
expect(dataInfos[0].isVisible).assertEqual(false);
expect(dataInfos[0].permissions.length).assertEqual(0);
expect(dataInfos[0].deviceCapabilities.length).assertEqual(0);
expect(dataInfos[0].deviceTypes[0]).assertEqual('phone');
expect(dataInfos[0].process).assertEqual('');
expect(dataInfos[0].uri).assertEqual('');
expect(dataInfos[0].bundleName).assertEqual(SYSTEM_NAME);
expect(dataInfos[0].moduleName).assertEqual("entry");
expect(Object.keys(dataInfos[0].applicationInfo).length).assertLarger(0);
expect(dataInfos[0].type).assertEqual(1);
expect(dataInfos[0].orientation).assertEqual(0);
expect(dataInfos[0].launchMode).assertEqual(1);
expect(dataInfos[0].backgroundModes).assertEqual(0);
expect(dataInfos[0].descriptionId).assertLarger(0);
expect(dataInfos[0].formEnabled).assertEqual(false);
expect(dataInfos[0].iconId).assertLarger(0);
expect(dataInfos[0].labelId).assertLarger(0);
expect(dataInfos[0].subType).assertEqual(0);
expect(dataInfos[0].readPermission).assertEqual("");
expect(dataInfos[0].writePermission).assertEqual("");
expect(dataInfos[0].targetAbility).assertEqual("");
expect(dataInfos[0].theme).assertEqual("");
expect(dataInfos[0].metaData.length).assertEqual(0);
expect(dataInfos[0].metadata.length).assertEqual(0);
expect(dataInfos[0].enabled).assertEqual(true);
cheackAbilityInfos(dataInfos[0]);
bundle.queryAbilityByWant({
action: 'action.system.home',
entities: ["entity.app.music",
"entity.app.email",
"entity.app.contacts",
"entity.app.maps",
"entity.app.browser",
"entity.app.calendar",
"entity.app.messaging",
"entity.app.files",
"entity.app.gallery"],
elementName: {
deviceId: '0',
bundleName: '',
abilityName: '',
},
}, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (err, data) => {
expect(data.length).assertEqual(1);
cheackAbilityInfos(data[0]);
});
installer.uninstall(SYSTEM_NAME, installParam, (err, data) => {
checkInstallOrUninstall(err, data);
done();
......@@ -155,6 +161,40 @@ describe('ActsBmsQueryAbilityByWant', function () {
});
});
async function cheackAbilityInfos(data) {
expect(data.name).assertEqual(ABILITIY_NAME8);
expect(data.label).assertEqual('$string:app_name');
expect(data.description).assertEqual('$string:mainability_description');
expect(data.icon).assertEqual("$media:icon");
expect(data.srcPath).assertEqual("");
expect(data.srcLanguage).assertEqual("js");
expect(data.isVisible).assertEqual(false);
expect(data.permissions.length).assertEqual(0);
expect(data.deviceCapabilities.length).assertEqual(0);
expect(data.deviceTypes[0]).assertEqual('phone');
expect(data.process).assertEqual('');
expect(data.uri).assertEqual('');
expect(data.bundleName).assertEqual(SYSTEM_NAME);
expect(data.moduleName).assertEqual("entry");
expect(Object.keys(data.applicationInfo).length).assertLarger(0);
expect(data.type).assertEqual(1);
expect(data.orientation).assertEqual(0);
expect(data.launchMode).assertEqual(1);
expect(data.backgroundModes).assertEqual(0);
expect(data.descriptionId).assertLarger(0);
expect(data.formEnabled).assertEqual(false);
expect(data.iconId).assertLarger(0);
expect(data.labelId).assertLarger(0);
expect(data.subType).assertEqual(0);
expect(data.readPermission).assertEqual("");
expect(data.writePermission).assertEqual("");
expect(data.targetAbility).assertEqual("");
expect(data.theme).assertEqual("");
expect(data.metaData.length).assertEqual(0);
expect(data.metadata.length).assertEqual(0);
expect(data.enabled).assertEqual(true);
}
function checkInstallOrUninstall(err, data) {
expect(err.code).assertEqual(0);
expect(data.status).assertEqual(0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册