From aa2223841001df737c49d91ec1860af1fe0919e2 Mon Sep 17 00:00:00 2001 From: inter515 Date: Fri, 14 Oct 2022 21:06:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Exts=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: inter515 --- .../test/ActsBmsEtsUnPermissionTest.test.ets | 2 +- .../actsbmsstageetstest/Test.json | 2 +- .../ets/test/GetProfileByAbility.test.ets | 2 +- .../GetProfileByExtensionAbility.test.ets | 2 +- .../entry/src/main/module.json | 2 +- .../test/getAllApplicationInfoJsunit.test.ets | 69 ++++++++++++++++ .../test/getApplicationInfoJsunit.test.ets | 79 ++++++++++++++++++- .../src/main/config.json | 2 +- 8 files changed, 153 insertions(+), 7 deletions(-) diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets index cea7e5de7..c7c42a6e2 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets @@ -170,7 +170,7 @@ export default function actsBmsJsUnPermissionTest() { * @tc.name: getAbilityInfoUnPermissionSelf * @tc.desc: test getAbilityInfo */ - it('getAbilityInfo_200', 0, async function (done) { + it('getAbilityInfoUnPermissionSelf', 0, async function (done) { await bundle.getAbilityInfo(SELF_BUNDLENAME, SELF_ABILITYNAME).then(res => { console.info('actwsBundleManager getAbilityInfo promise success res:' + JSON.stringify(res)); for (const item in res) { diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json index f123b79ba..e0b4844ea 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/Test.json @@ -4,7 +4,7 @@ "type": "OHJSUnitTest", "test-timeout": "180000", "bundle-name": "ohos.acts.bundle.stage.test", - "module-name": "phone", + "module-name": "entry", "shell-timeout": "600000", "testcase-timeout": 70000 }, diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets index b77df7d8e..141a77d1a 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByAbility.test.ets @@ -16,7 +16,7 @@ import bundle from '@ohos.bundle'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" -const MODULE_NAME = "phone" +const MODULE_NAME = "entry" const MODULE_NAME_TEST = "phone1" const ABILITY_NAME = "ohos.acts.bundle.stage.test.MainAbility" const ABILITY_NAME1 = "ohos.acts.bundle.stage.test.MainAbility1" diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets index 0b543cb17..30407d2b9 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/ets/test/GetProfileByExtensionAbility.test.ets @@ -16,7 +16,7 @@ import bundle from '@ohos.bundle'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" -const MODULE_NAME = "phone" +const MODULE_NAME = "entry" const MODULE_NAME_TEST = "phone1" const ABILITY_NAME = "Form" const ABILITY_NAME1 = "Form1" diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json index 69858ac37..c92572cda 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json +++ b/bundlemanager/bundle_standard/bundlemanager/actsbmsstageetstest/entry/src/main/module.json @@ -1,6 +1,6 @@ { "module": { - "name": "phone", + "name": "entry", "type": "entry", "srcEntrance": "./ets/Application/AbilityStage.ts", "description": "$string:phone_entry_dsc", diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets index 5a9d7944d..ebd585fb8 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets @@ -288,6 +288,42 @@ export default function getAllApplicationBundleTest() { }); }); + /** + * @tc.number: SUB_BMS_APPINFO_QUERY_0060 + * @tc.name: getAllApplicationInfoNoMetaData + * @tc.desc: Check the return value of the interface + */ + it('getAllApplicationInfoNoMetaData', 0, async function (done) { + await Bundle.getAllApplicationInfo(DEFAULT_FLAG,userId).then((data) => { + expect(data.length).assertLarger(10); + let flag = 0; + for(let i in data){ + if (data[i].name == BUNDLE_OTHER){ + flag = 1; + getAllApplicationInfoSuccessOther(data[i]); + expect(JSON.stringify(data[i].metaData)).assertEqual("{}"); + } + } + expect(flag).assertEqual(1); + }).catch((error) => { + expect(error).assertFail(); + }); + Bundle.getAllApplicationInfo(DEFAULT_FLAG,userId, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.length).assertLarger(10); + let flag = 0; + for(let i in data){ + if (data[i].name == BUNDLE_OTHER){ + flag = 1; + getAllApplicationInfoSuccessOther(data[i]); + expect(JSON.stringify(data[i].metaData)).assertEqual("{}"); + } + } + expect(flag).assertEqual(1); + done(); + }); + }); + function expectData(msg, data) { console.info(msg + 'commonTest data length [' + data.length + ']'); for (let i = 0; i < data.length; i++) { @@ -393,6 +429,39 @@ export default function getAllApplicationBundleTest() { console.info('check end'); } + function getAllApplicationInfoSuccessOther(data) { + expect(data.name).assertEqual(BUNDLE_OTHER); + expect(data.codePath).assertEqual(PATH + '/' + BUNDLE_OTHER); + expect(data.accessTokenId).assertLarger(0); + expect(data.description).assertEqual('$string:entry_description'); + expect(data.descriptionId).assertLarger(0); + expect(data.icon).assertEqual('$media:icon'); + expect(data.iconId).assertLarger(0); + expect(data.iconIndex).assertLarger(0); + expect(data.iconIndex).assertEqual(data.iconId); + expect(data.label).assertEqual('$string:app_name'); + expect(data.labelId).assertLarger(0); + expect(data.labelIndex).assertLarger(0); + expect(data.labelIndex).assertEqual(data.labelId); + expect(data.systemApp).assertFalse(); + expect(data.supportedModes).assertEqual(0); + expect(data.process).assertEqual(BUNDLE_OTHER); + expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry'); + expect(data.permissions.length).assertEqual(0); + expect(data.moduleSourceDirs.length).assertEqual(1); + expect(data.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry'); + expect(data.moduleInfos.length).assertEqual(1); + expect(data.moduleInfos[0].moduleName).assertEqual('entry'); + expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' + + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry'); + expect(data.enabled).assertTrue(); + expect(data.uid).assertLarger(0); + expect(data.entityType).assertEqual('unspecified'); + expect(data.removable).assertTrue(); + expect(data.fingerprint).assertEqual(""); + console.info('check end'); + } + }); } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets index 00d7bba43..437828a58 100644 --- a/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets +++ b/bundlemanager/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets @@ -422,6 +422,51 @@ export default function applicationBundleJsunit() { }); }) + /** + * @tc.number: SUB_BMS_APPINFO_QUERY_0059 + * @tc.name: getApplicationInfoNoMetaData + * @tc.desc: Check the return value of the interface + */ + it('getApplicationInfoNoMetaData', 0, async function (done) { + await Bundle.getApplicationInfo(BUNDLE_OTHER, FLAG_DEFAULT ,userId).then((data) => { + console.info('noUserId promise data is: ' + data); + for (let item in data) { + console.info(item + ":" + JSON.stringify(data[item])); + } + getApplicationInfoSuccessOther_METADATA(data); + expect(JSON.stringify(data.metaData)).assertEqual("{}"); + expect(JSON.stringify(data.metadata)).assertEqual("{}"); + }).catch((error) => { + expect(error).assertFail(); + }); + Bundle.getApplicationInfo(BUNDLE_OTHER, FLAG_DEFAULT,userId, (err, data) => { + console.info('noUserId promise data is: ' + data); + expect(err.code).assertEqual(0); + getApplicationInfoSuccessOther_METADATA(data); + expect(JSON.stringify(data.metaData)).assertEqual("{}"); + expect(JSON.stringify(data.metadata)).assertEqual("{}"); + done(); + }); + }); + + /** + * @tc.number: SUB_BMS_APPINFO_QUERY_0005 + * @tc.name: getApplicationInfoNotExistBundleName + * @tc.desc: Check the return value of the interface + */ + it('getApplicationInfoNotExistBundleName', 0, async function (done) { + await Bundle.getApplicationInfo(BUNDLE_NOTEXIST, FLAG_DEFAULT, userId).then((data) => { + expect(data).assertFail(); + }).catch((error) => { + expect(error.code).assertEqual(1); + }); + await Bundle.getApplicationInfo(BUNDLE_NOTEXIST, FLAG_DEFAULT, userId, (err, data) => { + expect(err.code).assertEqual(1); + expect(JSON.stringify(data)).assertEqual(undefined); + done(); + }); + }); + function expectData(msg, data) { expect(typeof (data)).assertEqual('object'); expect(typeof (data.name)).assertEqual('string'); @@ -554,6 +599,38 @@ export default function applicationBundleJsunit() { console.info('check end'); } - }); + function getApplicationInfoSuccessOther_METADATA(data) { + expect(data.name).assertEqual(BUNDLE_OTHER); + expect(data.codePath).assertEqual(PATH + '/' + BUNDLE_OTHER); + expect(data.accessTokenId).assertLarger(0); + expect(data.description).assertEqual('$string:entry_description'); + expect(data.descriptionId).assertLarger(0); + expect(data.icon).assertEqual('$media:icon'); + expect(data.iconId).assertLarger(0); + expect(data.iconIndex).assertLarger(0); + expect(data.iconIndex).assertEqual(data.iconId); + expect(data.label).assertEqual('$string:app_name'); + expect(data.labelId).assertLarger(0); + expect(data.labelIndex).assertLarger(0); + expect(data.labelIndex).assertEqual(data.labelId); + expect(data.systemApp).assertFalse(); + expect(data.supportedModes).assertEqual(0); + expect(data.process).assertEqual(BUNDLE_OTHER); + expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry'); + expect(data.permissions.length).assertEqual(0); + expect(data.moduleSourceDirs.length).assertEqual(1); + expect(data.moduleSourceDirs[0]).assertEqual(PATH + '/' + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry'); + expect(data.moduleInfos.length).assertEqual(1); + expect(data.moduleInfos[0].moduleName).assertEqual('entry'); + expect(data.moduleInfos[0].moduleSourceDir).assertEqual(PATH + '/' + + BUNDLE_OTHER + '/' + BUNDLE_OTHER + '.entry'); + expect(data.enabled).assertTrue(); + expect(data.uid).assertLarger(0); + expect(data.entityType).assertEqual('unspecified'); + expect(data.removable).assertTrue(); + expect(data.fingerprint).assertEqual(""); + console.info('check end'); + } + }); } \ No newline at end of file diff --git a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosseventhscene/src/main/config.json b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosseventhscene/src/main/config.json index c2010ccee..483e5435d 100644 --- a/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosseventhscene/src/main/config.json +++ b/bundlemanager/bundle_standard/bundlemanager/sceneProject/bmsgetinfosseventhscene/src/main/config.json @@ -909,7 +909,7 @@ "type": "pageAbility" }, "pages": [ - "pages/index" + "pages/index/index" ], "name": ".MainAbility", "window": { -- GitLab