diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets index cfcacb040f991085b3919c55c0de15e12d05eed3..77ff56e233edd5785a1a5d4d9be3c0d7b57369f4 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets @@ -23,6 +23,7 @@ const BUNDLE_NAME3 = 'com.example.third1'; const ABILITY_NAME1 = "ExtensionAbility1"; const ABILITY_NAME2 = "noexitAbility"; const ABILITY_NAME3 = "ServiceAbility"; +const ABILITY_NAME4 = "EnterpriseAdminAbility"; let userId = 0; export default function QueryExtensionAbilityInfos() { @@ -782,14 +783,15 @@ export default function QueryExtensionAbilityInfos() { */ it('SUB_BMS_APPINFO_EXTENSION_0020', 0, async function (done) { await bundle.getBundleInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_WITH_EXTENSION_ABILITY).then(data => { - expect(data.extensionAbilityInfo.length).assertEqual(7); + expect(data.extensionAbilityInfo.length).assertEqual(8); expect(data.extensionAbilityInfo[0].name).assertEqual("ExtensionAbilityA"); expect(data.extensionAbilityInfo[1].name).assertEqual("ExtensionAbilityB"); expect(data.extensionAbilityInfo[2].name).assertEqual("ExtensionAbilityQ"); expect(data.extensionAbilityInfo[3].name).assertEqual("ExtensionAbilityW"); - expect(data.extensionAbilityInfo[4].name).assertEqual("ExtensionAbility1"); - expect(data.extensionAbilityInfo[5].name).assertEqual("FormAbility"); - expect(data.extensionAbilityInfo[6].name).assertEqual("ServiceAbility"); + expect(data.extensionAbilityInfo[4].name).assertEqual("EnterpriseAdminAbility"); + expect(data.extensionAbilityInfo[5].name).assertEqual("ExtensionAbility1"); + expect(data.extensionAbilityInfo[6].name).assertEqual("FormAbility"); + expect(data.extensionAbilityInfo[7].name).assertEqual("ServiceAbility"); }).catch(err => { expect(err).assertFail(); }); @@ -799,14 +801,15 @@ export default function QueryExtensionAbilityInfos() { done(); return; } - expect(data.extensionAbilityInfo.length).assertEqual(7); + expect(data.extensionAbilityInfo.length).assertEqual(8); expect(data.extensionAbilityInfo[0].name).assertEqual("ExtensionAbilityA"); expect(data.extensionAbilityInfo[1].name).assertEqual("ExtensionAbilityB"); expect(data.extensionAbilityInfo[2].name).assertEqual("ExtensionAbilityQ"); expect(data.extensionAbilityInfo[3].name).assertEqual("ExtensionAbilityW"); - expect(data.extensionAbilityInfo[4].name).assertEqual("ExtensionAbility1"); - expect(data.extensionAbilityInfo[5].name).assertEqual("FormAbility"); - expect(data.extensionAbilityInfo[6].name).assertEqual("ServiceAbility"); + expect(data.extensionAbilityInfo[4].name).assertEqual("EnterpriseAdminAbility"); + expect(data.extensionAbilityInfo[5].name).assertEqual("ExtensionAbility1"); + expect(data.extensionAbilityInfo[6].name).assertEqual("FormAbility"); + expect(data.extensionAbilityInfo[7].name).assertEqual("ServiceAbility"); done(); }) }) @@ -833,6 +836,62 @@ export default function QueryExtensionAbilityInfos() { }) }) + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0022 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos get enterpriseAdmin extensionAbility + */ + it('SUB_BMS_APPINFO_EXTENSION_0022', 0, async function (done) { + await bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME4 + }, bundle.ExtensionAbilityType.ENTERPRISE_ADMIN, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, + userId).then(data => { + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual(ABILITY_NAME4); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(11); + expect(data[0].permissions.length).assertEqual(0); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata.length).assertEqual(0); + }).catch(err => { + expect(err).assertEqual(1); + }); + bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME4 + }, bundle.ExtensionAbilityType.ENTERPRISE_ADMIN, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, + userId, (err, data) => { + if (err) { + expect(err).assertEqual(1); + done(); + return; + } + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual(ABILITY_NAME4); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(11); + expect(data[0].permissions.length).assertEqual(0); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata.length).assertEqual(0); + done(); + }) + }) + function checkApplication(data) { expect(data[0].applicationInfo.name).assertEqual("ohos.acts.bundle.stage"); expect(data[0].applicationInfo.codePath).assertEqual("/data/app/el1/bundle/public/ohos.acts.bundle.stage"); diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json index fe4626c0129b56bceff147c54f378c500d4acf85..e2a475674d04dba82e1b2dfed9e090982e4773de 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json @@ -219,6 +219,19 @@ "resource": "$profile:form_config" } ] + }, + { + "name": "EnterpriseAdminAbility", + "srcEntrance": "./ets/ServiceAbility/FormAbility.ts", + "label": "$string:form_FormAbility_label", + "description": "$string:form_FormAbility_desc", + "type": "enterpriseAdmin", + "metadata": [ + { + "name": "ohos.extension.form", + "resource": "$profile:form_config" + } + ] } ] }