提交 cd6afaca 编写于 作者: I inter515

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

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