diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js index 2bbbc3185b76c7d784ea423127d41b7de2883d26..8aa5e553224b134a358d9d57153d869b2ec11aac 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsaccesstokentest/entry/src/main/js/test/ActsBmsAccessTokenTest.test.js @@ -14,22 +14,34 @@ */ import bundle from '@ohos.bundle' -import { describe, it, expect } from 'deccjsunit/index' +import account from '@ohos.account.osAccount' +import { describe,beforeAll, it, expect } from 'deccjsunit/index' const BUNDLE_NAME1 = 'com.example.bmsaccesstoken1'; const BUNDLE_NAME2 = 'com.example.bmsaccesstoken2'; const BUNDLE_NAME3 = 'com.example.bmsaccesstoken3'; -const USERID = 100; +let userId = 0; describe('ActsBmsAccessTokenTest', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /* * @tc.number: bms_AccessTokenId_0100 * @tc.name: test accessTokenId * @tc.desc: get the accessTokenId */ it('bms_AccessTokenId_0100', 0, async function (done) { - await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID) + await bundle.getApplicationInfo(BUNDLE_NAME1, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId) .then(applicationInfo => { console.info('accessTokenId: ' + applicationInfo.accessTokenId); expect(applicationInfo.name).assertEqual(BUNDLE_NAME1); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/MainAbility/test/ActsBmsEtsModuleNameTest.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/MainAbility/test/ActsBmsEtsModuleNameTest.test.ets index 0518e70eab75801ce4270dcd227fd501fbffcf8c..566c262534245e91cda8f9ebcfd0e494d2c2109b 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/MainAbility/test/ActsBmsEtsModuleNameTest.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsetsmodulenametest/entry/src/main/ets/MainAbility/test/ActsBmsEtsModuleNameTest.test.ets @@ -15,6 +15,7 @@ import bundle from '@ohos.bundle' import image from '@ohos.multimedia.image' +import account from '@ohos.account.osAccount' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' const ABILITY_NAME = 'com.example.bmsmodulename.MainAbility'; @@ -24,7 +25,6 @@ const MODULE_NAME2 = 'noModule'; const MODULE_NAME3 = 'entry'; const MODULE_NAME4 = undefined; const DEFAULT_FLAG = bundle.BundleFlag.GET_BUNDLE_DEFAULT; -const DEFAULT_USER_ID = 100; const SUCCESS_CODE = 0; const INVALID_CODE = 1; const INVALID_PARAM = 2; @@ -48,10 +48,22 @@ const ABILITY_INFO_FOUR = { moduleName: MODULE_NAME4, name: ABILITY_NAME }; +let userId = 0; export default function actsBmsJsModuleNameTest() { describe('actsBmsJsModuleNameTest', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /* * @tc.number: GetabilityInfo_0100 * @tc.name: test getAbilityInfo @@ -374,7 +386,7 @@ export default function actsBmsJsModuleNameTest() { bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, moduleName: MODULE_NAME1 - }, DEFAULT_FLAG, DEFAULT_USER_ID).then(data => { + }, DEFAULT_FLAG, userId).then(data => { checkDataInfo(data[0]); console.info("'[QueryAbilityByWant_0100]Return data : " + JSON.stringify(data)); }).catch(err => { @@ -385,7 +397,7 @@ export default function actsBmsJsModuleNameTest() { bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, moduleName: MODULE_NAME1 - }, DEFAULT_FLAG, DEFAULT_USER_ID, (err, data) => { + }, DEFAULT_FLAG, userId, (err, data) => { expect(err).assertEqual(SUCCESS_CODE); if (err) { console.error('[QueryAbilityByWant_0100]Operation failed. Err: ' + JSON.stringify(err)); @@ -406,7 +418,7 @@ export default function actsBmsJsModuleNameTest() { bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, moduleName: MODULE_NAME2 - }, DEFAULT_FLAG, DEFAULT_USER_ID).then(data => { + }, DEFAULT_FLAG, userId).then(data => { expect(data).assertFail(); }).catch(err => { console.error('[QueryAbilityByWant_0200]Operation failed. Err: ' + JSON.stringify(err)); @@ -416,7 +428,7 @@ export default function actsBmsJsModuleNameTest() { bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, moduleName: MODULE_NAME2 - }, DEFAULT_FLAG, DEFAULT_USER_ID, (err, data) => { + }, DEFAULT_FLAG, userId, (err, data) => { console.info("'[QueryAbilityByWant_0200]Return data " + JSON.stringify(data)); expect(data).assertEqual("QueryAbilityInfos failed"); console.error('[QueryAbilityByWant_0200]Operation failed. Err: ' + JSON.stringify(err)); @@ -435,7 +447,7 @@ export default function actsBmsJsModuleNameTest() { bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, moduleName: MODULE_NAME3 - }, DEFAULT_FLAG, DEFAULT_USER_ID).then(data => { + }, DEFAULT_FLAG, userId).then(data => { checkDataInfo(data[0]); console.info("'[QueryAbilityByWant_0300]Return data : " + JSON.stringify(data)); }).catch(err => { @@ -446,7 +458,7 @@ export default function actsBmsJsModuleNameTest() { bundleName: BUNDLE_NAME, abilityName: ABILITY_NAME, moduleName: MODULE_NAME3 - }, DEFAULT_FLAG, DEFAULT_USER_ID, (err, data) => { + }, DEFAULT_FLAG, userId, (err, data) => { expect(err).assertEqual(SUCCESS_CODE); if (err) { console.error('[QueryAbilityByWant_0300]Operation failed. Err: ' + JSON.stringify(err)); @@ -468,10 +480,6 @@ export default function actsBmsJsModuleNameTest() { expect(typeof (data.description)).assertEqual("string"); expect(data.icon).assertEqual("$media:icon"); expect(typeof (data.icon)).assertEqual("string"); - expect(data.srcPath).assertEqual(""); - expect(typeof (data.srcPath)).assertEqual("string"); - expect(data.srcLanguage).assertEqual("js"); - expect(typeof (data.srcLanguage)).assertEqual("string"); expect(data.isVisible).assertEqual(false); expect(data.deviceTypes[0]).assertEqual("phone"); expect(typeof (data.process)).assertEqual("string"); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets index ba83901b4f389b26e0f525545ddf01fb334bc0fd..067acf0140536cf929ccd2c53db3c7f14386d0c6 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsetsunpermissiontest/entry/src/main/ets/test/ActsBmsEtsUnPermissionTest.test.ets @@ -16,6 +16,7 @@ import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "hypium/index" import bundle from '@ohos.bundle' import pkg from '@system.package' +import account from '@ohos.account.osAccount' const DEFAULT_FLAG = bundle.BundleFlag.GET_BUNDLE_DEFAULT; const INVALID_CODE = 1; @@ -26,10 +27,22 @@ const BUNDLE_SETTINGS = "com.ohos.settings"; const ABILITIY_SETTINGS = "com.ohos.settings.MainAbility"; const BUNDLE_NAME1 = "ohos.acts.bundle.stage"; const ABILITY_NAME1 = "ExtensionAbility1"; +let userId = 0; export default function actsBmsJsUnPermissionTest() { describe('actsBmsJsUnPermissionTest', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /** * @tc.number getApplicationInfos_1300 * @tc.name getApplicationInfos_1300 @@ -54,12 +67,12 @@ export default function actsBmsJsUnPermissionTest() { * @tc.desc test getBundleInfo */ it('getBundleInfo_2000', 0, async function (done) { - await bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, { userId: 100 }).then(data => { + await bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, { userId: userId }).then(data => { expect().assertFail(); }).catch(err => { expect(err).assertEqual(INVALID_CODE); }); - bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, { userId: 100 }, (err, data) => { + bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, { userId: userId }, (err, data) => { expect(err).assertEqual(INVALID_CODE); expect(data).assertEqual(undefined); done(); @@ -196,7 +209,7 @@ export default function actsBmsJsUnPermissionTest() { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100).then(data => { + userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -206,7 +219,7 @@ export default function actsBmsJsUnPermissionTest() { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertEqual(1); done(); @@ -224,8 +237,6 @@ export default function actsBmsJsUnPermissionTest() { expect(data.label).assertEqual("$string:entry_MainAbility"); expect(data.description).assertEqual("$string:description_mainability"); expect(data.icon).assertEqual("$media:icon"); - expect(data.srcPath).assertEqual("MainAbility"); - expect(data.srcLanguage).assertEqual("ets"); expect(data.isVisible).assertEqual(true); expect(data.deviceTypes[0]).assertEqual("phone"); expect(data.process).assertEqual(""); @@ -244,7 +255,6 @@ export default function actsBmsJsUnPermissionTest() { 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); checkApplicationInfo(data.applicationInfo); @@ -270,7 +280,6 @@ export default function actsBmsJsUnPermissionTest() { 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); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js index bf85eb643b687f6419abfd75955d8151f4ac7ff3..53d8d7e8a93f73aaffe18bd8d596804f584035f6 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js @@ -14,6 +14,7 @@ */ import bundle from '@ohos.bundle' +import account from '@ohos.account.osAccount' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' const BUNDLE_NAME1 = 'com.example.third1'; @@ -31,7 +32,6 @@ const NUM_TWO = 2; const NUM_THREE = 3; const NUM_FOUR = 4; const NUM_NINE = 9; -const USERID = 100; const DATATRANSFER = 1; const AUDIOPLAYBACK = 2; const AUDIORECORDING = 4; @@ -41,9 +41,21 @@ const MULTIDEVICECONNECTION = 32; const WIFIINTERACTION = 64; const VOIP = 128; const TASKKEEPING = 256; +let userId = 0; describe('ActsBmsGetBackGroundModes', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err => { + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /* * @tc.number: bms_backGroundModes_0100 * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant @@ -58,7 +70,7 @@ describe('ActsBmsGetBackGroundModes', function () { bundleName: BUNDLE_NAME5, abilityName: '', }, - }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID); + }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId); expect(dataInfos.length).assertEqual(NUM_FOUR); if (dataInfos.length == NUM_FOUR) { expect(dataInfos[NUM_TWO].name).assertEqual(ABILITIY_NAME1); @@ -67,7 +79,7 @@ describe('ActsBmsGetBackGroundModes', function () { expect(dataInfos[NUM_THREE].name).assertEqual(ABILITIY_NAME2); expect(dataInfos[NUM_THREE].backgroundModes).assertEqual(DATATRANSFER | VOIP); } - let bundleInfos = await bundle.getAllBundleInfo(bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, USERID); + let bundleInfos = await bundle.getAllBundleInfo(bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, userId); for (let i = 0; i < bundleInfos.length; i++) { if (bundleInfos[i].name == BUNDLE_NAME5) { for (let j = 0; j < bundleInfos[i].abilityInfos.length; j++) { @@ -103,7 +115,7 @@ describe('ActsBmsGetBackGroundModes', function () { bundleName: BUNDLE_NAME6, abilityName: '', }, - }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID); + }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId); expect(dataInfos.length).assertEqual(NUM_NINE); for (let i = 0, len = dataInfos.length; i < len; i++) { expect(dataInfos[i].backgroundModes).assertEqual(1 << i); @@ -125,14 +137,14 @@ describe('ActsBmsGetBackGroundModes', function () { bundleName: BUNDLE_NAME2, abilityName: '', }, - }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID); + }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId); expect(dataInfos.length).assertEqual(NUM_TWO); if (dataInfos.length == NUM_TWO) { expect(dataInfos[1].name).assertEqual(ABILITIY_NAME3) expect(dataInfos[1].backgroundModes).assertEqual(AUDIOPLAYBACK | AUDIORECORDING | LOCATION | BLUETOOTHINTERACTION | MULTIDEVICECONNECTION | WIFIINTERACTION | VOIP | TASKKEEPING) } - bundle.getAllBundleInfo(bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, USERID, (err, bundleInfos) => { + bundle.getAllBundleInfo(bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, userId, (err, bundleInfos) => { for (let i = 0; i < bundleInfos.length; i++) { if (bundleInfos[i].name == BUNDLE_NAME2) { for (let j = 0; j < bundleInfos[i].abilityInfos.length; j++) { @@ -144,12 +156,12 @@ describe('ActsBmsGetBackGroundModes', function () { } } } + bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, (err, data3) => { + expect(data3.abilityInfos[1].backgroundModes).assertEqual(AUDIOPLAYBACK | AUDIORECORDING | LOCATION + | BLUETOOTHINTERACTION | MULTIDEVICECONNECTION | WIFIINTERACTION | VOIP | TASKKEEPING); + done(); + }); }); - bundle.getBundleInfo(BUNDLE_NAME2, bundle.BundleFlag.GET_BUNDLE_WITH_ABILITIES, (err, data3) => { - expect(data3.abilityInfos[1].backgroundModes).assertEqual(AUDIOPLAYBACK | AUDIORECORDING | LOCATION - | BLUETOOTHINTERACTION | MULTIDEVICECONNECTION | WIFIINTERACTION | VOIP | TASKKEEPING) - }); - done(); }); /* @@ -166,7 +178,7 @@ describe('ActsBmsGetBackGroundModes', function () { bundleName: BUNDLE_NAME4, abilityName: '', }, - }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID); + }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId); expect(dataInfos.length).assertEqual(1); if (dataInfos.length == 1) { expect(dataInfos[0].name).assertEqual(ABILITIY_NAME4) @@ -189,7 +201,7 @@ describe('ActsBmsGetBackGroundModes', function () { bundleName: BUNDLE_NAME1, abilityName: '', }, - }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID); + }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId); expect(dataInfos.length).assertEqual(NUM_FOUR); if (dataInfos.length == NUM_FOUR) { expect(dataInfos[1].name).assertEqual(ABILITIY_NAME5) diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js index a65db539dfa3e374435d504d752a2987c3a195cb..544e742e2ea41a557fc414ea22020b723b0dde8d 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsQueryAbilityByWant.test.js @@ -13,17 +13,29 @@ * limitations under the License. */ import bundle from '@ohos.bundle' +import account from '@ohos.account.osAccount' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' const BUNDLE_NAME1 = 'com.example.third1'; const SYSTEM_NAME = 'com.example.system2'; const ABILITIY_NAME8 = 'com.example.system2.MainAbility'; -const USERID = 100; const ACTION_NAME = 'action.system.home'; const ENTITY_NAME = 'entity.system.home'; +let userId = 0; describe('ActsBmsQueryAbilityByWant', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /* * @tc.number: bms_queryAbilityByWant_0100 * @tc.name: queryAbilityByWant callback by other callback @@ -36,7 +48,7 @@ describe('ActsBmsQueryAbilityByWant', function () { entities: [ENTITY_NAME], bundleName: BUNDLE_NAME1 }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, - USERID).then(data => { + userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -46,7 +58,7 @@ describe('ActsBmsQueryAbilityByWant', function () { entities: [ENTITY_NAME], bundleName: BUNDLE_NAME1 }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, - USERID, (err, data) => { + userId, (err, data) => { expect(err).assertEqual(1); expect(data).assertEqual("QueryAbilityInfos failed"); done(); @@ -66,7 +78,7 @@ describe('ActsBmsQueryAbilityByWant', function () { entities: [ENTITY_NAME] }, 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) { expect(data[i].applicationInfo.systemApp).assertEqual(true); @@ -81,7 +93,7 @@ describe('ActsBmsQueryAbilityByWant', function () { entities: [ENTITY_NAME] }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, - USERID, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertFail(); } @@ -115,7 +127,7 @@ describe('ActsBmsQueryAbilityByWant', function () { bundleName: '', abilityName: '', }, - }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID); + }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId); expect(dataInfos.length).assertEqual(1); cheackAbilityInfos(dataInfos[0]); bundle.queryAbilityByWant({ @@ -134,7 +146,7 @@ describe('ActsBmsQueryAbilityByWant', function () { bundleName: '', abilityName: '', }, - }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (err, data) => { + }, bundle.BundleFlag.GET_BUNDLE_DEFAULT, userId, (err, data) => { expect(data.length).assertEqual(1); cheackAbilityInfos(data[0]); done(); @@ -146,8 +158,6 @@ describe('ActsBmsQueryAbilityByWant', function () { 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); @@ -169,7 +179,6 @@ describe('ActsBmsQueryAbilityByWant', function () { 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); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js index 1502384a51bb25092b53ab9e3c9032821a449874..8006be06b0eaafa2c4cb79af8742ad71f05516ad 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmshapmoduletest/entry/src/main/js/test/ActsBmsHapModuleTest.test.js @@ -24,7 +24,6 @@ const BUNDLE_NAME6 = "com.example.bmsmainabilitysecondscene"; const FIRSTMAINABILITY = 'com.example.bmsmainabilityfirstscene.MainAbility'; const SECONDMAINABILITY = 'com.example.bmsmainabilitysecondscene.MainAbility'; const MODULE_NAME = 'entry'; -const ICON_PATH = "$media:icon"; const LABEL = '$string:app_name'; const DEVICE_TYPES = 'phone'; @@ -47,7 +46,6 @@ describe('ActsBmsHapModuleTest', function () { expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.descriptionId).assertEqual(0); - expect(hapModuleInfo.iconPath).assertEqual(ICON_PATH); expect(hapModuleInfo.icon).assertEqual(''); expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.labelId).assertEqual(0); @@ -59,7 +57,6 @@ describe('ActsBmsHapModuleTest', function () { expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY); expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY); expect(hapModuleInfo.abilityInfo.length).assertLarger(0); - expect(hapModuleInfo.colorMode).assertEqual(-1); expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0); expect(hapModuleInfo.metadata.length).assertEqual(0); expect(hapModuleInfo.installationFree).assertEqual(false); @@ -113,7 +110,6 @@ describe('ActsBmsHapModuleTest', function () { expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.descriptionId).assertEqual(0); - expect(hapModuleInfo.iconPath).assertEqual(ICON_PATH); expect(hapModuleInfo.icon).assertEqual(''); expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.labelId).assertEqual(0); @@ -125,7 +121,6 @@ describe('ActsBmsHapModuleTest', function () { expect(hapModuleInfo.mainAbilityName).assertEqual(""); expect(hapModuleInfo.mainElementName).assertEqual(""); expect(hapModuleInfo.abilityInfo.length).assertLarger(0); - expect(hapModuleInfo.colorMode).assertEqual(-1); expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0); expect(hapModuleInfo.metadata.length).assertEqual(0); expect(hapModuleInfo.installationFree).assertEqual(false); @@ -150,7 +145,6 @@ describe('ActsBmsHapModuleTest', function () { expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.descriptionId).assertEqual(0); - expect(hapModuleInfo.iconPath).assertEqual(ICON_PATH); expect(hapModuleInfo.icon).assertEqual(''); expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.labelId).assertEqual(0); @@ -162,7 +156,6 @@ describe('ActsBmsHapModuleTest', function () { expect(hapModuleInfo.mainAbilityName).assertEqual("com.example.third5.AMainAbility"); expect(hapModuleInfo.mainElementName).assertEqual("com.example.third5.AMainAbility"); expect(hapModuleInfo.abilityInfo.length).assertLarger(0); - expect(hapModuleInfo.colorMode).assertEqual(-1); expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0); expect(hapModuleInfo.metadata.length).assertEqual(0); expect(hapModuleInfo.installationFree).assertEqual(false); @@ -188,7 +181,6 @@ describe('ActsBmsHapModuleTest', function () { expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.descriptionId).assertEqual(0); - expect(hapModuleInfo.iconPath).assertEqual(ICON_PATH); expect(hapModuleInfo.icon).assertEqual(''); expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.labelId).assertEqual(0); @@ -200,7 +192,6 @@ describe('ActsBmsHapModuleTest', function () { expect(hapModuleInfo.mainAbilityName).assertEqual("com.example.system1.MainAbility"); expect(hapModuleInfo.mainElementName).assertEqual("com.example.system1.MainAbility"); expect(hapModuleInfo.abilityInfo.length).assertLarger(0); - expect(hapModuleInfo.colorMode).assertEqual(-1); expect(hapModuleInfo.extensionAbilityInfo.length).assertEqual(0); expect(hapModuleInfo.metadata.length).assertEqual(0); expect(hapModuleInfo.installationFree).assertEqual(false); @@ -212,7 +203,6 @@ describe('ActsBmsHapModuleTest', function () { function checkHapMoudleInfos(info) { expect(info.description).assertEqual(''); expect(info.descriptionId).assertEqual(0); - expect(info.iconPath).assertEqual(ICON_PATH); expect(info.icon).assertEqual(''); expect(info.labelId).assertEqual(0); expect(info.iconId).assertEqual(0); @@ -221,7 +211,6 @@ describe('ActsBmsHapModuleTest', function () { expect(info.reqCapabilities.length).assertEqual(0); expect(info.deviceTypes[0]).assertEqual(DEVICE_TYPES); expect(info.abilityInfo.length).assertLarger(0); - expect(info.colorMode).assertEqual(-1); expect(info.extensionAbilityInfo.length).assertEqual(0); expect(info.metadata.length).assertEqual(0); expect(info.installationFree).assertEqual(false); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js index 5d2790ce4af11aa5c50e63c56767ffdfeed689d4..eca9b0352fc5411c4bd48de740d47e9811d97acf 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsjstest/entry/src/main/js/test/ActsBmsJsTest.test.js @@ -48,8 +48,6 @@ describe('ActsBmsJsTest', function () { let abilityInfo2 = result.abilityInfos[1]; expect(abilityInfo1.name).assertEqual(ABILITIY_NAME1); expect(abilityInfo2.name).assertEqual(ABILITIY_NAME6); - expect(abilityInfo1.srcLanguage).assertEqual('js'); - expect(abilityInfo1.srcPath).assertEqual(''); expect(abilityInfo1.label).assertEqual("$string:app_name"); expect(abilityInfo1.description).assertEqual("$string:mainability_description"); expect(abilityInfo1.icon).assertEqual("$media:icon"); @@ -75,7 +73,6 @@ describe('ActsBmsJsTest', function () { expect(abilityInfo1.readPermission).assertEqual(""); expect(abilityInfo1.writePermission).assertEqual(""); expect(abilityInfo1.targetAbility).assertEqual(""); - expect(abilityInfo1.theme).assertEqual(""); expect(abilityInfo1.metaData.length).assertEqual(0); expect(abilityInfo1.metadata.length).assertEqual(0); expect(abilityInfo1.enabled).assertEqual(true); @@ -127,8 +124,6 @@ describe('ActsBmsJsTest', function () { console.info("getBundleIno result" + JSON.stringify(result)); let abilityInfo1 = result.abilityInfos[0]; expect(abilityInfo1.name).assertEqual(ABILITIY_NAME4); - expect(abilityInfo1.srcLanguage).assertEqual('js'); - expect(abilityInfo1.srcPath).assertEqual('default'); expect(abilityInfo1.label).assertEqual("$string:app_name"); expect(abilityInfo1.description).assertEqual("$string:mainability_description"); expect(abilityInfo1.icon).assertEqual("$media:icon"); @@ -152,7 +147,6 @@ describe('ActsBmsJsTest', function () { expect(abilityInfo1.readPermission).assertEqual(""); expect(abilityInfo1.writePermission).assertEqual(""); expect(abilityInfo1.targetAbility).assertEqual(""); - expect(abilityInfo1.theme).assertEqual(""); expect(abilityInfo1.metaData.length).assertEqual(0); expect(abilityInfo1.metadata.length).assertEqual(0); expect(abilityInfo1.enabled).assertEqual(true); @@ -173,8 +167,6 @@ describe('ActsBmsJsTest', function () { console.info("getBundleIno result" + JSON.stringify(result)); let abilityInfo1 = result.abilityInfos[0]; expect(abilityInfo1.name).assertEqual(ABILITIY_NAME5); - expect(abilityInfo1.srcLanguage).assertEqual('c++'); - expect(abilityInfo1.srcPath).assertEqual('default/c++/'); expect(abilityInfo1.label).assertEqual("$string:app_name"); expect(abilityInfo1.description).assertEqual("$string:mainability_description"); expect(abilityInfo1.icon).assertEqual("$media:icon"); @@ -198,7 +190,6 @@ describe('ActsBmsJsTest', function () { expect(abilityInfo1.readPermission).assertEqual(""); expect(abilityInfo1.writePermission).assertEqual(""); expect(abilityInfo1.targetAbility).assertEqual(""); - expect(abilityInfo1.theme).assertEqual(""); expect(abilityInfo1.metaData.length).assertEqual(0); expect(abilityInfo1.metadata.length).assertEqual(0); expect(abilityInfo1.enabled).assertEqual(true); @@ -208,8 +199,6 @@ describe('ActsBmsJsTest', function () { function checkAbilityInfos(info) { expect(info.name).assertEqual(ABILITIY_NAME2); - expect(info.srcLanguage).assertEqual('js'); - expect(info.srcPath).assertEqual(''); expect(info.label).assertEqual("$string:app_name"); expect(info.description).assertEqual("$string:mainability_description"); expect(info.icon).assertEqual("$media:icon"); @@ -233,7 +222,6 @@ describe('ActsBmsJsTest', function () { expect(info.readPermission).assertEqual(""); expect(info.writePermission).assertEqual(""); expect(info.targetAbility).assertEqual(""); - expect(info.theme).assertEqual(""); expect(info.metaData.length).assertEqual(1); expect(info.metaData[0].name).assertEqual("Data5A"); expect(info.metaData[0].value).assertEqual("float"); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js index afe1d8b1c27f3816218e18fd5446b42e1334005a..889f57f5bc4e8044595b2baef900673e73528105 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsjsunpermissiontest/entry/src/main/js/test/ActsBmsJsUnPermissionTest.test.js @@ -14,28 +14,40 @@ */ import bundle from '@ohos.bundle' -import { describe, it, expect } from 'deccjsunit/index' +import account from '@ohos.account.osAccount' +import { describe, beforeAll, it, expect } from 'deccjsunit/index' const LAUNCHER_BUNDLE_NAME = 'com.ohos.launcher'; const LAUNCHER_MAIN_ABILITY = 'com.ohos.launcher.MainAbility'; const DEFAULT_FLAG = bundle.BundleFlag.GET_BUNDLE_DEFAULT; -const DEFAULT_USER_ID = 100; const INVALID_CODE = 1; +let userId = 0; describe('ActsBmsJsUnPermissionTest', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /* * @tc.number: getApplicationInfoTest_100 * @tc.name: test getApplicationInfo * @tc.desc: test getApplicationInfo */ it('getApplicationInfoTest_100', 0, async function (done) { - await bundle.getApplicationInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, DEFAULT_USER_ID).then(data => { + await bundle.getApplicationInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, userId).then(data => { expect().assertFail(); }).catch(err => { expect(err).assertEqual(INVALID_CODE); }); - bundle.getApplicationInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, DEFAULT_USER_ID, (err, data) => { + bundle.getApplicationInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_FLAG, userId, (err, data) => { expect(err).assertEqual(INVALID_CODE); expect(data).assertEqual(undefined); done(); @@ -48,12 +60,12 @@ describe('ActsBmsJsUnPermissionTest', function () { * @tc.desc: test getAllApplicationInfo */ it('getAllApplicationInfoTest_100', 0, async function (done) { - await bundle.getAllApplicationInfo(DEFAULT_FLAG, DEFAULT_USER_ID).then(data => { + await bundle.getAllApplicationInfo(DEFAULT_FLAG, userId).then(data => { expect().assertFail(); }).catch(err => { expect(err).assertEqual(INVALID_CODE); }); - bundle.getAllApplicationInfo(DEFAULT_FLAG, DEFAULT_USER_ID, (err, data) => { + bundle.getAllApplicationInfo(DEFAULT_FLAG, userId, (err, data) => { expect(err).assertEqual(INVALID_CODE); expect(data).assertEqual(undefined); done(); @@ -66,12 +78,12 @@ describe('ActsBmsJsUnPermissionTest', function () { * @tc.desc: test getBundleInfo */ it('getBundleInfoTest_100', 0, async function (done) { - await bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_USER_ID).then(data => { + await bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, userId).then(data => { expect().assertFail(); }).catch(err => { expect(err).assertEqual(INVALID_CODE); }); - bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, DEFAULT_USER_ID, (err, data) => { + bundle.getBundleInfo(LAUNCHER_BUNDLE_NAME, userId, (err, data) => { expect(err).assertEqual(INVALID_CODE); expect(data).assertEqual(undefined); done(); @@ -105,7 +117,7 @@ describe('ActsBmsJsUnPermissionTest', function () { await bundle.queryAbilityByWant({ bundleName: LAUNCHER_BUNDLE_NAME, abilityName: LAUNCHER_MAIN_ABILITY - }, DEFAULT_FLAG, DEFAULT_USER_ID).then(data => { + }, DEFAULT_FLAG, userId).then(data => { expect().assertFail(); }).catch(err => { expect(err).assertEqual(INVALID_CODE); @@ -113,7 +125,7 @@ describe('ActsBmsJsUnPermissionTest', function () { bundle.queryAbilityByWant({ bundleName: LAUNCHER_BUNDLE_NAME, abilityName: LAUNCHER_MAIN_ABILITY - }, DEFAULT_FLAG, DEFAULT_USER_ID, (err, data) => { + }, DEFAULT_FLAG, userId, (err, data) => { console.info("data ===================:" + data); expect(err).assertEqual(INVALID_CODE); expect(data).assertEqual("QueryAbilityInfos failed"); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js index 3ce2104840ac0175454e24aed9f366ab82771786..e392edd7ed916cbcbe346a59587acc0292d00f67 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsmetadatatest/entry/src/main/js/test/ActsBmsMetaDataTest.test.js @@ -14,6 +14,7 @@ */ import bundle from '@ohos.bundle' +import account from '@ohos.account.osAccount' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' const BUNDLE_NAME1 = 'com.example.third1'; @@ -28,10 +29,21 @@ 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; +let userId = 0; describe('ActsBmsMetaDataTest', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /* * @tc.number: bms_getMetaData_0100 * @tc.name: test to get meta data for an application. @@ -42,7 +54,7 @@ describe('ActsBmsMetaDataTest', function () { { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => { + }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, userId).then(dataInfos => { let metaData = dataInfos[0].metaData; expect(metaData[0].name).assertEqual("DataA1"); expect(metaData[0].value).assertEqual("float"); @@ -54,7 +66,7 @@ describe('ActsBmsMetaDataTest', function () { { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => { + }, 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"); @@ -73,7 +85,7 @@ describe('ActsBmsMetaDataTest', function () { { "bundleName": BUNDLE_NAME6, "abilityName": ABILITY_NAME6 - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => { + }, 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"); @@ -85,7 +97,7 @@ describe('ActsBmsMetaDataTest', function () { { "bundleName": BUNDLE_NAME6, "abilityName": ABILITY_NAME6 - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => { + }, 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"); @@ -104,7 +116,7 @@ describe('ActsBmsMetaDataTest', function () { { bundleName: BUNDLE_NAME2, abilityName: ABILITY_NAME2, - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => { + }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, userId).then(dataInfos => { let metaData = dataInfos[0].metaData; expect(metaData[0].name).assertEqual("Data5A"); expect(metaData[0].value).assertEqual("float"); @@ -116,7 +128,7 @@ describe('ActsBmsMetaDataTest', function () { { "bundleName": BUNDLE_NAME2, "abilityName": ABILITY_NAME2 - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => { + }, 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"); @@ -135,7 +147,7 @@ describe('ActsBmsMetaDataTest', function () { { bundleName: BUNDLE_NAME3, abilityName: ABILITY_NAME3, - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => { + }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, userId).then(dataInfos => { expect(dataInfos).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -144,7 +156,7 @@ describe('ActsBmsMetaDataTest', function () { { "bundleName": BUNDLE_NAME3, "abilityName": ABILITY_NAME3 - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => { + }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, userId, (err, dataInfos) => { expect(err).assertEqual(1); expect(dataInfos).assertEqual("QueryAbilityInfos failed"); done(); @@ -161,7 +173,7 @@ describe('ActsBmsMetaDataTest', function () { { bundleName: BUNDLE_NAME4, abilityName: ABILITY_NAME4, - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => { + }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, userId).then(dataInfos => { let metaData = dataInfos[0].metaData; expect(metaData[0].name).assertEqual("Data1S"); expect(metaData[0].value).assertEqual("float"); @@ -173,7 +185,7 @@ describe('ActsBmsMetaDataTest', function () { { "bundleName": BUNDLE_NAME4, "abilityName": ABILITY_NAME4 - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => { + }, 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"); @@ -192,7 +204,7 @@ describe('ActsBmsMetaDataTest', function () { { bundleName: BUNDLE_NAME5, abilityName: ABILITY_NAME5, - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID).then(dataInfos => { + }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, userId).then(dataInfos => { let metaData = dataInfos[0].metaData; expect(metaData[0].name).assertEqual("vendorName"); expect(metaData[0].value).assertEqual("vendorValue"); @@ -204,7 +216,7 @@ describe('ActsBmsMetaDataTest', function () { { "bundleName": BUNDLE_NAME5, "abilityName": ABILITY_NAME5 - }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, USERID, (err, dataInfos) => { + }, 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"); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetabilityInfo.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetabilityInfo.test.ets index 9c8e326fa9a65fa95763fc02360d9f4c2574bacb..75a4643039012657cd753fc4de192e3ddffd0efd 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetabilityInfo.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/GetabilityInfo.test.ets @@ -322,7 +322,6 @@ export default function GetabilityInfo() { 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); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets index 2ce98e53f69bd12bb5c15bc39864fc707bd54fc7..e7c5640913fc69928e87a1be65ce58c82c04d253 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets @@ -13,8 +13,9 @@ * limitations under the License. */ -import bundle from '@ohos.bundle' -import { describe, it, expect } from 'hypium/index'; +import bundle from '@ohos.bundle'; +import account from '@ohos.account.osAccount'; +import { describe,beforeAll, it, expect } from 'hypium/index'; const BUNDLE_NAME1 = "ohos.acts.bundle.stage"; const BUNDLE_NAME2 = "com.noexit.com"; @@ -22,11 +23,23 @@ const BUNDLE_NAME3 = 'com.example.third1'; const ABILITY_NAME1 = "ExtensionAbility1"; const ABILITY_NAME2 = "noexitAbility"; const ABILITY_NAME3 = "ServiceAbility"; +let userId = 0; export default function QueryExtensionAbilityInfos() { describe('QueryExtensionAbilityInfos', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /* * @tc.number: SUB_BMS_APPINFO_EXTENSION_0001 * @tc.name: test queryExtensionAbilityInfos api @@ -66,7 +79,7 @@ export default function QueryExtensionAbilityInfos() { await bundle.queryExtensionAbilityInfos({ "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 - }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, 100).then(data => { + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, userId).then(data => { expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); expect(data[0].moduleName).assertEqual("phone"); expect(data[0].name).assertEqual("ExtensionAbility1"); @@ -86,7 +99,7 @@ export default function QueryExtensionAbilityInfos() { bundle.queryExtensionAbilityInfos({ "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 - }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, 100, (err, data) => { + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, userId, (err, data) => { if (err) { expect(err).assertFail(); done(); @@ -120,7 +133,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100).then(data => { + userId).then(data => { expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); expect(data[0].moduleName).assertEqual("phone"); expect(data[0].name).assertEqual("ExtensionAbility1"); @@ -142,7 +155,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertFail(); done(); @@ -175,7 +188,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_APPLICATION, - 100).then(data => { + userId).then(data => { expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); expect(data[0].moduleName).assertEqual("phone"); expect(data[0].name).assertEqual("ExtensionAbility1"); @@ -197,7 +210,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_APPLICATION, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertFail(); done(); @@ -231,7 +244,7 @@ export default function QueryExtensionAbilityInfos() { { "bundleName": BUNDLE_NAME2, "abilityName": ABILITY_NAME1 - }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100).then(data => { + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -240,7 +253,7 @@ export default function QueryExtensionAbilityInfos() { { "bundleName": BUNDLE_NAME2, "abilityName": ABILITY_NAME1 - }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100, (err, data) => { + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, userId, (err, data) => { if (err) { expect(err).assertEqual(1); done(); @@ -261,7 +274,7 @@ export default function QueryExtensionAbilityInfos() { { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME2 - }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100).then(data => { + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -270,7 +283,7 @@ export default function QueryExtensionAbilityInfos() { { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME2 - }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100, (err, data) => { + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, userId, (err, data) => { if (err) { expect(err).assertEqual(1); done(); @@ -291,7 +304,7 @@ export default function QueryExtensionAbilityInfos() { { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 - }, bundle.ExtensionAbilityType.FORM, null, 100).then(data => { + }, bundle.ExtensionAbilityType.FORM, null, userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -309,7 +322,7 @@ export default function QueryExtensionAbilityInfos() { { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME1 - }, bundle.ExtensionAbilityType.FORM, null, 100, (err, data) => { + }, bundle.ExtensionAbilityType.FORM, null, userId, (err, data) => { expect(err).assertEqual(1); expect(data).assertEqual("type mismatch"); done(); @@ -383,7 +396,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME3 }, bundle.ExtensionAbilityType.SERVICE, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100).then(data => { + userId).then(data => { expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); expect(data[0].moduleName).assertEqual("phone"); expect(data[0].name).assertEqual(ABILITY_NAME3); @@ -405,7 +418,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "abilityName": ABILITY_NAME3 }, bundle.ExtensionAbilityType.SERVICE, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertEqual(1); done(); @@ -437,7 +450,7 @@ export default function QueryExtensionAbilityInfos() { await bundle.queryExtensionAbilityInfos( { "bundleName": BUNDLE_NAME2 - }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100).then(data => { + }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -445,7 +458,7 @@ export default function QueryExtensionAbilityInfos() { bundle.queryExtensionAbilityInfos( { "bundleName": BUNDLE_NAME2 - }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100, (err, data) => { + }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, userId, (err, data) => { if (err) { expect(err).assertEqual(1); done(); @@ -467,7 +480,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "action": "actionY" }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, - 100).then(data => { + userId).then(data => { expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); expect(data[0].moduleName).assertEqual("phone"); expect(data[0].name).assertEqual("ExtensionAbility1"); @@ -489,7 +502,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "action": "actionY" }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertFail(); done(); @@ -522,7 +535,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "action": "actionY12", "uri": "https://www.test.com/query/student/name" }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_METADATA, - 100).then(data => { + userId).then(data => { expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); expect(data[0].moduleName).assertEqual("phone"); expect(data[0].name).assertEqual("ExtensionAbility1"); @@ -544,7 +557,7 @@ export default function QueryExtensionAbilityInfos() { "bundleName": BUNDLE_NAME1, "action": "actionY12", "uri": "https://www.test.com/query/student/name" }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_METADATA, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertFail(); done(); @@ -580,7 +593,7 @@ export default function QueryExtensionAbilityInfos() { "action": "actionY12", "uri": "https://www.test.com/query/teacher/name" }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100).then(data => { + userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -591,7 +604,7 @@ export default function QueryExtensionAbilityInfos() { "action": "actionY12", "uri": "https://www.test.com/query/teacher/name" }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertEqual(1); done(); @@ -613,7 +626,7 @@ export default function QueryExtensionAbilityInfos() { "action": "", "entities": ["entitiesCommon"], }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100).then(data => { + userId).then(data => { expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); expect(data[0].moduleName).assertEqual("myfeature"); expect(data[0].name).assertEqual("ExtensionAbilityW"); @@ -635,7 +648,7 @@ export default function QueryExtensionAbilityInfos() { "action": "", "entities": ["entitiesCommon"] }, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertFail(); done(); @@ -665,14 +678,14 @@ export default function QueryExtensionAbilityInfos() { it('SUB_BMS_APPINFO_EXTENSION_0015', 0, async function (done) { await bundle.queryExtensionAbilityInfos( null, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100).then(data => { + userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); }); bundle.queryExtensionAbilityInfos( {}, bundle.ExtensionAbilityType.UNSPECIFIED, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertEqual(1); done(); @@ -694,7 +707,7 @@ export default function QueryExtensionAbilityInfos() { "action": "", "entities": ["entitiesCommon"], }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100).then(data => { + userId).then(data => { expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); expect(data[0].moduleName).assertEqual("phone"); expect(data[0].name).assertEqual("FormAbility"); @@ -716,7 +729,7 @@ export default function QueryExtensionAbilityInfos() { "action": "", "entities": ["entitiesCommon"] }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertFail(); done(); @@ -750,7 +763,7 @@ export default function QueryExtensionAbilityInfos() { "type": "", "uri": "https://www.test.com/abbc" }, bundle.ExtensionAbilityType.WINDOW, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100).then(data => { + userId).then(data => { expect(data).assertFail(); }).catch(err => { expect(err).assertEqual(1); @@ -760,7 +773,7 @@ export default function QueryExtensionAbilityInfos() { "type": "", "uri": "https://www.test.com/abbc" }, bundle.ExtensionAbilityType.WINDOW, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, - 100, (err, data) => { + userId, (err, data) => { if (err) { expect(err).assertEqual(1); done(); @@ -850,7 +863,6 @@ export default function QueryExtensionAbilityInfos() { expect(JSON.stringify(data[0].applicationInfo.metaData)).assertEqual("{}"); expect(JSON.stringify(data[0].applicationInfo.metadata)).assertEqual("{}"); expect(data[0].applicationInfo.enabled).assertTrue(); - expect(data[0].applicationInfo.flags).assertEqual(0); expect(data[0].applicationInfo.uid).assertLarger(0); expect(data[0].applicationInfo.entityType).assertEqual("unspecified"); expect(data[0].applicationInfo.removable).assertTrue(); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets index 579dd64ccfaff31e27ae4879ad51af5bca99afd5..2a3171b20e9799dfc63a957a27938fa316b3fd51 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getAllApplicationInfoJsunit.test.ets @@ -12,9 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, it, expect } from 'hypium/index'; +import { describe,beforeAll, it, expect } from 'hypium/index'; import Utils from './Utils'; import Bundle from '@ohos.bundle'; +import account from '@ohos.account.osAccount'; const TAG_TEST_0100_001 = ' bundle_getAllApplicationInfo_test_0100_001 '; const TAG_TEST_0100_002 = ' bundle_getAllApplicationInfo_test_0100_002 '; @@ -29,12 +30,23 @@ const TAG_TEST_0500_002 = ' bundle_getAllApplicationInfo_test_0500_0010 '; const DEFAULT_FLAG = Bundle.BundleFlag.GET_BUNDLE_DEFAULT; const BUNDLE_OTHER = 'com.example.third1'; const PATH = "/data/app/el1/bundle/public"; -const USER_ID_100 = 100; +let userId = 0; export default function getAllApplicationBundleTest() { describe('appInfoTest', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /** * @tc.number: bundle_getApplicationInfo_test_0100_001 * @tc.name: getApplicationInfo : Obtains based on a given bundle name. @@ -44,7 +56,7 @@ export default function getAllApplicationBundleTest() { it(TAG_TEST_0100_001, 0, async function (done) { let startTime = await Utils.getNowTime(); let data = await Bundle.getAllApplicationInfo( - Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100).catch((error) => { + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId).catch((error) => { console.info(TAG_TEST_0100_001 + 'UserId promise error is: ' + error); expect(error).assertFail(); }); @@ -65,7 +77,7 @@ export default function getAllApplicationBundleTest() { it(TAG_TEST_0100_002, 0, async function (done) { let startTime = await Utils.getNowTime(); let data = await Bundle.getAllApplicationInfo( - Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100).catch((error) => { + Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, userId).catch((error) => { console.info(TAG_TEST_0100_002 + 'UserId promise error is: ' + error); expect(error).assertFail(); }); @@ -86,7 +98,7 @@ export default function getAllApplicationBundleTest() { it(TAG_TEST_0100_003, 0, async function (done) { let startTime = await Utils.getNowTime(); let data = await Bundle.getAllApplicationInfo( - Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, USER_ID_100).catch((error) => { + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, userId).catch((error) => { console.info(TAG_TEST_0100_003 + 'UserId promise error is: ' + error); expect(error).assertFail(); }); @@ -172,7 +184,7 @@ export default function getAllApplicationBundleTest() { let datas; let startTime = await Utils.getNowTime(); Bundle.getAllApplicationInfo( - Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100, (error, data) => { + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, data) => { let endTime = Utils.getNowTime(); Utils.getDurationTime(TAG_TEST_0300_001, startTime, endTime); if (error) { @@ -226,7 +238,7 @@ export default function getAllApplicationBundleTest() { it(TAG_TEST_0500_002, 0, async function (done) { let errors; let startTime = await Utils.getNowTime(); - await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT', USER_ID_100).then((data) => { + await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT', userId).then((data) => { console.info(TAG_TEST_0500_002 + 'noUserId promise data is: ' + data); expect(data).assertFail(); }).catch((error) => { @@ -328,7 +340,6 @@ export default function getAllApplicationBundleTest() { expect(typeof (data[i].metaData)).assertEqual('object'); expect(typeof (data[i].metadata)).assertEqual('object'); expect(typeof (data[i].enabled)).assertEqual('boolean'); - expect(typeof (data[i].flags)).assertEqual('number'); expect(typeof (data[i].uid)).assertEqual('number'); expect(typeof (data[i].entityType)).assertEqual('string'); expect(typeof (data[i].removable)).assertEqual('boolean'); @@ -365,7 +376,6 @@ export default function getAllApplicationBundleTest() { expect(data[i].entryDir).assertEqual('/data/app/el1/bundle/public/com.open.harmony.packagemag' + '/com.open.harmony.packagemag'); expect(data[i].enabled).assertEqual(true); - expect(data[i].flags).assertEqual(0); expect(data[i].entityType).assertEqual('unspecified'); expect(data[i].removable).assertEqual(true); expect(data[i].moduleInfos[0].moduleName).assertEqual('entry'); @@ -401,7 +411,6 @@ export default function getAllApplicationBundleTest() { expect(JSON.stringify(data.metaData)).assertEqual("{}"); expect(JSON.stringify(data.metadata)).assertEqual("{}"); expect(data.enabled).assertTrue(); - expect(data.flags).assertEqual(0); expect(data.uid).assertLarger(0); expect(data.entityType).assertEqual('unspecified'); expect(data.removable).assertTrue(); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets index e054e3f0bb801a68429b4f531189d02325def3be..df4051cf73db31ef0a26bfb9e9c5b572e2e86860 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/getApplicationInfoJsunit.test.ets @@ -12,9 +12,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, it, expect } from 'hypium/index'; +import { describe,beforeAll, it, expect } from 'hypium/index'; import Utils from './Utils'; import Bundle from '@ohos.bundle'; +import account from '@ohos.account.osAccount'; const TAG_TEST_0100_001 = ' bundle_getApplicationInfo_test_0100_001 '; const TAG_TEST_0100_002 = ' bundle_getApplicationInfo_test_0100_002 '; @@ -34,12 +35,23 @@ const BUNDLE_OTHER = 'com.example.third1'; const BUNDLE_NOTEXIST = 'com.ohos.package'; const FLAG_DEFAULT = Bundle.BundleFlag.GET_BUNDLE_DEFAULT; const PATH = "/data/app/el1/bundle/public"; -const USER_ID_100 = 100; +let userId = 0; export default function applicationBundleJsunit() { describe('appInfoTest', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err=>{ + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /** * @tc.number: bundle_getApplicationInfo_test_0100_001 * @tc.name: getApplicationInfo : Obtains based on a given bundle name. @@ -49,7 +61,7 @@ export default function applicationBundleJsunit() { it(TAG_TEST_0100_001, 0, async function (done) { let startTime = await Utils.getNowTime(); let data = await Bundle.getApplicationInfo(BUNDLE_NAME, - Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100).catch((error) => { + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId).catch((error) => { console.info(TAG_TEST_0100_001 + 'UserId promise error is: ' + error); expect(error).assertFail(); }); @@ -70,7 +82,7 @@ export default function applicationBundleJsunit() { it(TAG_TEST_0100_002, 0, async function (done) { let startTime = await Utils.getNowTime(); let data = await Bundle.getApplicationInfo(BUNDLE_NAME, - Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, USER_ID_100).catch((error) => { + Bundle.BundleFlag.GET_ALL_APPLICATION_INFO, userId).catch((error) => { console.info(TAG_TEST_0100_002 + 'UserId promise error is: ' + error); expect(error).assertFail(); }); @@ -91,7 +103,7 @@ export default function applicationBundleJsunit() { it(TAG_TEST_0100_003, 0, async function (done) { let startTime = await Utils.getNowTime(); let data = await Bundle.getApplicationInfo(BUNDLE_NAME, - Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, USER_ID_100).catch((error) => { + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_DISABLE, userId).catch((error) => { console.info(TAG_TEST_0100_003 + 'UserId promise error is: ' + error); expect(error).assertFail(); }); @@ -178,7 +190,7 @@ export default function applicationBundleJsunit() { let datas; let startTime = await Utils.getNowTime(); Bundle.getApplicationInfo(BUNDLE_NAME, - Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100, (error, data) => { + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, data) => { let endTime = Utils.getNowTime(); Utils.getDurationTime(TAG_TEST_0300_001, startTime, endTime); errors = error; @@ -233,7 +245,7 @@ export default function applicationBundleJsunit() { */ it(TAG_TEST_0500_002, 0, async function (done) { let startTime = await Utils.getNowTime(); - await Bundle.getApplicationInfo('', 'Bundle.BundleFlag.GET_BUNDLE_DEFAULT', USER_ID_100).then((data) => { + await Bundle.getApplicationInfo('', 'Bundle.BundleFlag.GET_BUNDLE_DEFAULT', userId).then((data) => { console.info(TAG_TEST_0500_002 + 'UserId promise data is: ' + data); expect(data).assertFail(); }).catch((error) => { @@ -255,7 +267,7 @@ export default function applicationBundleJsunit() { let startTime = await Utils.getNowTime(); let errors await Bundle.getApplicationInfo(BUNDLE_NOTEXIST, - Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USER_ID_100).then((data) => { + Bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId).then((data) => { console.info(TAG_TEST_0600_002 + 'other bundleName UserId promise data is: ' + data); expect(data).assertFail(); }).catch((error) => { @@ -394,7 +406,6 @@ export default function applicationBundleJsunit() { expect(typeof (data.metaData)).assertEqual('object'); expect(typeof (data.metadata)).assertEqual('object'); expect(typeof (data.enabled)).assertEqual('boolean'); - expect(typeof (data.flags)).assertEqual('number'); expect(typeof (data.uid)).assertEqual('number'); expect(typeof (data.entityType)).assertEqual('string'); expect(typeof (data.removable)).assertEqual('boolean'); @@ -416,7 +427,6 @@ export default function applicationBundleJsunit() { expect(data.labelId > 0).assertEqual(true); expect(data.systemApp).assertEqual(true); expect(data.supportedModes).assertEqual(0); - expect(data.flags).assertEqual(0); expect(data.process).assertEqual(""); expect(data.entryDir).assertEqual(PATH + '/' + BUNDLE_NAME + '/' + BUNDLE_NAME); expect(data.enabled).assertEqual(true); @@ -455,7 +465,6 @@ export default function applicationBundleJsunit() { expect(JSON.stringify(data.metaData)).assertEqual("{}"); expect(JSON.stringify(data.metadata)).assertEqual("{}"); expect(data.enabled).assertTrue(); - expect(data.flags).assertEqual(0); expect(data.uid).assertLarger(0); expect(data.entityType).assertEqual('unspecified'); expect(data.removable).assertTrue(); @@ -487,7 +496,6 @@ export default function applicationBundleJsunit() { expect(JSON.stringify(data.metaData)).assertEqual("{}"); expect(JSON.stringify(data.metadata)).assertEqual("{}"); expect(data.enabled).assertTrue(); - expect(data.flags).assertEqual(0); expect(data.uid).assertLarger(0); expect(data.entityType).assertEqual('unspecified'); expect(data.removable).assertTrue(); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js index 12d17fd0a283d5b7cb3c96d3ac394d3ffd6b659e..717ef95be7218559bb1c8169286dd58fee6ce682 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanagertest/entry/src/main/js/test/ExampleJsunit.test.js @@ -16,6 +16,7 @@ import app from '@system.app' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' import demo from '@ohos.bundle' +import account from '@ohos.account.osAccount' const ERROR = "error.hap" const NAME1 = "com.example.myapplication1" @@ -26,13 +27,25 @@ const NAME5 = "com.example.myapplication6" const LAUNCHER = "com.ohos.launcher" const VERSIONCODE1 = 1 const OBJECT = "object" -const DIR1 = "/data/accounts/account_0/applications/com.example.myapplication1/com.example.myapplication1" -const DIR2 = "/data/accounts/account_0/applications/com.example.myapplication2/com.example.myapplication2" +const DIR1 = "/data/app/el1/bundle/public/com.example.myapplication1/com.example.myapplication1" +const DIR2 = "/data/app/el1/bundle/public/com.example.myapplication2/com.example.myapplication2" +const DIR3 = "/data/app/el1/bundle/public/com.example.myapplication2/com.example.myapplication1" const DESCRIPTION = "$string:mainability_description" -const USERID = 100; +let userId = 0; describe('ActsBundleManagerTest', function () { + beforeAll(async function (done) { + await account.getAccountManager().getOsAccountLocalIdFromProcess().then(account => { + console.info("getOsAccountLocalIdFromProcess userid ==========" + account); + userId = account; + done(); + }).catch(err => { + console.info("getOsAccountLocalIdFromProcess err ==========" + JSON.stringify(err)); + done(); + }) + }); + /** * @tc.number getBundleInfo_0100 * @tc.name BUNDLEMGR::getBundleInfo @@ -72,15 +85,15 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.compatibleVersion).assertEqual(5); expect(datainfo.targetVersion).assertEqual(5); expect(datainfo.isCompressNativeLibs).assertEqual(false); - for (let s = 0; s < datainfo.hapModuleInfos; s++) { - expect(datainfo.moduleInfos[s].name).assertEqual("com.example.myapplication1"); - expect(datainfo.moduleInfos[s].moduleName).assertEqual("entry"); + for (let s = 0; s < datainfo.hapModuleInfos.length; s++) { + expect(datainfo.hapModuleInfos[s].name).assertEqual("com.example.myapplication1"); + expect(datainfo.hapModuleInfos[s].moduleName).assertEqual("entry"); } expect(datainfo.entryModuleName).assertEqual("entry"); expect(datainfo.isSilentInstallation.length).assertEqual(0); expect(datainfo.minCompatibleVersionCode).assertEqual(0); expect(datainfo.entryInstallationFree).assertEqual(false); - for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) { expect(datainfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -135,15 +148,15 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.compatibleVersion).assertEqual(5); expect(datainfo.targetVersion).assertEqual(5); expect(datainfo.isCompressNativeLibs).assertEqual(false); - for (let s = 0; s < datainfo.hapModuleInfos; s++) { - expect(datainfo.moduleInfos[s].name).assertEqual("com.example.myapplication1"); - expect(datainfo.moduleInfos[s].moduleName).assertEqual("entry"); + for (let s = 0; s < datainfo.hapModuleInfos.length; s++) { + expect(datainfo.hapModuleInfos[s].name).assertEqual("com.example.myapplication1"); + expect(datainfo.hapModuleInfos[s].moduleName).assertEqual("entry"); } expect(datainfo.entryModuleName).assertEqual("entry"); expect(datainfo.isSilentInstallation.length).assertEqual(0); expect(datainfo.minCompatibleVersionCode).assertEqual(0); expect(datainfo.entryInstallationFree).assertEqual(false); - for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) { expect(datainfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -235,7 +248,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.appInfo.labelId >= 0).assertTrue(); expect(datainfo.appInfo.systemApp).assertEqual(true); expect(datainfo.appInfo.supportedModes).assertEqual(0); - for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) { expect(datainfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -279,7 +292,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.appInfo.labelId >= 0).assertTrue(); expect(datainfo.appInfo.systemApp).assertEqual(true); expect(datainfo.appInfo.supportedModes).assertEqual(0); - for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) { expect(datainfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -411,7 +424,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.appInfo.labelId >= 0).assertTrue(); expect(datainfo.appInfo.systemApp).assertEqual(true); expect(datainfo.appInfo.supportedModes).assertEqual(0); - for (let j = 0; j < datainfo.appInfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.appInfo.moduleInfos.length; j++) { expect(datainfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -426,27 +439,30 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getBundleInfo interfaces with LAUNCHER hap.(by callback) */ it('getBundleInfo_1400', 0, async function (done) { - await demo.getBundleInfo(LAUNCHER, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, - bundleOptions, (err, dataInfo) => { - if (err) { - console.info("getBundleInfo_1400 fail:" + JSON.stringify(err)); - expect(err).assertFail(); + let bundleOptions = { + userId: userId + }; + demo.getBundleInfo(LAUNCHER, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, + bundleOptions, (err, datainfo) => { + if (err) { + console.info("getBundleInfo_1400 fail:" + JSON.stringify(err)); + expect(err).assertFail(); + done(); + return; + } + console.info("getBundleInfo_1400 success:" + JSON.stringify(datainfo)); + expect(datainfo.name).assertEqual(LAUNCHER); + expect(datainfo.vendor).assertEqual("ohos"); + expect(datainfo.versionCode).assertEqual(1000000); + expect(datainfo.versionName.length).assertLarger(0); + expect(datainfo.uid).assertLarger(2099); + expect(datainfo.appInfo.name).assertEqual(LAUNCHER); + expect(datainfo.appInfo.systemApp).assertEqual(true); + expect(datainfo.appInfo.supportedModes).assertEqual(0); + expect(datainfo.appInfo.moduleInfos.length).assertLarger(0); + expect(datainfo.appInfo.enabled).assertEqual(true); done(); - return; - } - console.info("getBundleInfo_1400 success:" + JSON.stringify(datainfo)); - expect(datainfo.name).assertEqual(LAUNCHER); - expect(datainfo.vendor).assertEqual("ohos"); - expect(datainfo.versionCode).assertEqual(1000000); - expect(datainfo.versionName.length).assertLarger(0); - expect(datainfo.uid).assertLarger(2099); - expect(datainfo.appInfo.name).assertEqual(LAUNCHER); - expect(datainfo.appInfo.systemApp).assertEqual(true); - expect(datainfo.appInfo.supportedModes).assertEqual(0); - expect(datainfo.appInfo.moduleInfos.length).assertLarger(0); - expect(datainfo.appInfo.enabled).assertEqual(true); - done(); - }) + }) }) /** @@ -456,11 +472,11 @@ describe('ActsBundleManagerTest', function () { */ it('getBundleInfo_1500', 0, async function (done) { let bundleOptions = { - userId: USERID + userId: userId }; let dataInfo = await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions); console.info("getBundleInfo_1500 start --------"); - console.info("getBundleInfo_1500 dataInfo ====" + datainfo); + console.info("getBundleInfo_1500 dataInfo ====" + dataInfo); expect(dataInfo.name).assertEqual(NAME1); expect(dataInfo.vendor).assertEqual("example"); expect(dataInfo.versionCode).assertEqual(VERSIONCODE1); @@ -481,15 +497,15 @@ describe('ActsBundleManagerTest', function () { expect(dataInfo.compatibleVersion).assertEqual(5); expect(dataInfo.targetVersion).assertEqual(5); expect(dataInfo.isCompressNativeLibs).assertEqual(false); - for (let s = 0; s < dataInfo.hapModuleInfos; s++) { - expect(dataInfo.moduleInfos[s].name).assertEqual("com.example.myapplication1"); - expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry"); + for (let s = 0; s < dataInfo.hapModuleInfos.length; s++) { + expect(dataInfo.hapModuleInfos[s].name).assertEqual("com.example.myapplication1"); + expect(dataInfo.hapModuleInfos[s].moduleName).assertEqual("entry"); } expect(dataInfo.entryModuleName).assertEqual("entry"); expect(dataInfo.isSilentInstallation.length).assertEqual(0); expect(dataInfo.minCompatibleVersionCode).assertEqual(0); expect(dataInfo.entryInstallationFree).assertEqual(false); - for (let j = 0; j < dataInfo.appInfo.moduleInfos; j++) { + for (let j = 0; j < dataInfo.appInfo.moduleInfos.length; j++) { expect(dataInfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(dataInfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -505,11 +521,11 @@ describe('ActsBundleManagerTest', function () { */ it('getBundleInfo_1600', 0, async function (done) { let bundleOptions = { - userId: USERID + userId: userId }; - await demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, dataInfo) => { + demo.getBundleInfo(NAME1, demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, bundleOptions, (err, dataInfo) => { console.info("getBundleInfo_1600 start --------"); - console.info("getBundleInfo_1600 dataInfo ====" + datainfo); + console.info("getBundleInfo_1600 dataInfo ====" + dataInfo); expect(dataInfo.name).assertEqual(NAME1); expect(dataInfo.vendor).assertEqual("example"); expect(dataInfo.versionCode).assertEqual(VERSIONCODE1); @@ -530,15 +546,15 @@ describe('ActsBundleManagerTest', function () { expect(dataInfo.compatibleVersion).assertEqual(5); expect(dataInfo.targetVersion).assertEqual(5); expect(dataInfo.isCompressNativeLibs).assertEqual(false); - for (let s = 0; s < dataInfo.hapModuleInfos; s++) { - expect(dataInfo.moduleInfos[s].name).assertEqual("com.example.myapplication1"); - expect(dataInfo.moduleInfos[s].moduleName).assertEqual("entry"); + for (let s = 0; s < dataInfo.hapModuleInfos.length; s++) { + expect(dataInfo.hapModuleInfos[s].name).assertEqual("com.example.myapplication1"); + expect(dataInfo.hapModuleInfos[s].moduleName).assertEqual("entry"); } expect(dataInfo.entryModuleName).assertEqual("entry"); expect(dataInfo.isSilentInstallation.length).assertEqual(0); expect(dataInfo.minCompatibleVersionCode).assertEqual(0); expect(dataInfo.entryInstallationFree).assertEqual(false); - for (let j = 0; j < dataInfo.appInfo.moduleInfos; j++) { + for (let j = 0; j < dataInfo.appInfo.moduleInfos.length; j++) { expect(dataInfo.appInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(dataInfo.appInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -593,7 +609,7 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getApplicationInfos interfaces with one hap. */ it('getApplicationInfos_0100', 0, async function (done) { - let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USERID); + let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId); checkgetApplicationInfos(datainfo); done(); }) @@ -604,7 +620,7 @@ describe('ActsBundleManagerTest', function () { for (let i = 0; i < datainfo.length; i++) { expect(datainfo[i].name.length).assertLarger(0); if (datainfo[i].name == NAME1 || datainfo[i].name == NAME2 - || datainfo[i].name == NAME3 || datainfo[i].name == NAME4 || datainfo[i].name == NAME5) { + || datainfo[i].name == NAME3 || datainfo[i].name == NAME4 || datainfo[i].name == NAME5) { expect(datainfo[i].description.length).assertLarger(0); expect(datainfo[i].icon.length).assertLarger(0); expect(datainfo[i].label.length).assertLarger(0); @@ -612,8 +628,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo[i].moduleSourceDirs.length).assertLarger(0); expect(datainfo[i].moduleInfos.length).assertLarger(0); expect(datainfo[i].supportedModes).assertEqual(0); - expect(datainfo[i].flags).assertEqual(0); - for (let j = 0; j < datainfo[i].moduleInfos; j++) { + for (let j = 0; j < datainfo[i].moduleInfos.length; j++) { expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0); expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0); } @@ -628,15 +643,14 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfos_0600', 0, async function (done) { await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - USERID, (error, datainfo) => { + userId, (error, datainfo) => { expect(datainfo.length).assertLarger(0); for (let i = 0; i < datainfo.length; i++) { expect(datainfo[i].name.length).assertLarger(0); expect(datainfo[i].moduleSourceDirs.length).assertLarger(0); expect(datainfo[i].moduleInfos.length).assertLarger(0); expect(datainfo[i].supportedModes).assertEqual(0); - expect(datainfo[i].flags).assertEqual(0); - for (let j = 0; j < datainfo[i].moduleInfos; j++) { + for (let j = 0; j < datainfo[i].moduleInfos.length; j++) { expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0); expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0); } @@ -658,7 +672,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -677,37 +691,36 @@ describe('ActsBundleManagerTest', function () { it('getApplicationInfo_0100', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION | demo.BundleFlag.GET_APPLICATION_INFO_WITH_METADATA, - USERID).then(datainfo => { - expect(typeof datainfo).assertEqual(OBJECT); - console.info("getApplicationInfo success:" + JSON.stringify(datainfo)); - expect(datainfo.moduleSourceDirs.length).assertLarger(0); - expect(datainfo.moduleInfos.length).assertLarger(0); - expect(datainfo.name).assertEqual(NAME1); - expect(datainfo.description).assertEqual(DESCRIPTION); - expect(datainfo.icon).assertEqual("$media:icon"); - expect(datainfo.label).assertEqual("$string:app_name"); - expect(datainfo.systemApp).assertEqual(true); - expect(datainfo.descriptionId).assertLarger(0); - expect(parseInt(datainfo.iconId)).assertLarger(0); - expect(parseInt(datainfo.labelId)).assertLarger(0); - expect(datainfo.supportedModes).assertEqual(0); - expect(datainfo.process).assertEqual(""); - expect(datainfo.enabled).assertEqual(true); - expect(datainfo.flags).assertEqual(0); - expect(datainfo.metaData.entry[0].name).assertEqual("metaDataName"); - expect(datainfo.metaData.entry[0].value).assertEqual("metaDataValue"); - expect(datainfo.metaData.entry[0].extra).assertEqual("$string:app_name"); - expect(datainfo.moduleSourceDirs.length).assertLarger(0); - for (let j = 0; j < datainfo.moduleInfos; j++) { - expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry"); + userId).then(datainfo => { + expect(typeof datainfo).assertEqual(OBJECT); + console.info("getApplicationInfo success:" + JSON.stringify(datainfo)); + expect(datainfo.moduleSourceDirs.length).assertLarger(0); + expect(datainfo.moduleInfos.length).assertLarger(0); + expect(datainfo.name).assertEqual(NAME1); + expect(datainfo.description).assertEqual(DESCRIPTION); + expect(datainfo.icon).assertEqual("$media:icon"); + expect(datainfo.label).assertEqual("$string:app_name"); + expect(datainfo.systemApp).assertEqual(true); + expect(datainfo.descriptionId).assertLarger(0); + expect(parseInt(datainfo.iconId)).assertLarger(0); + expect(parseInt(datainfo.labelId)).assertLarger(0); + expect(datainfo.supportedModes).assertEqual(0); + expect(datainfo.process).assertEqual(""); + expect(datainfo.enabled).assertEqual(true); + expect(datainfo.metaData.entry[0].name).assertEqual("metaDataName"); + expect(datainfo.metaData.entry[0].value).assertEqual("metaDataValue"); + expect(datainfo.metaData.entry[0].extra).assertEqual("$string:app_name"); + expect(datainfo.moduleSourceDirs.length).assertLarger(0); + for (let j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0); - } - done(); - }).catch(err => { - console.info("getApplicationInfo fail:" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) + } + done(); + }).catch(err => { + console.info("getApplicationInfo fail:" + JSON.stringify(err)); + expect(err).assertFail(); + done(); + }) }) /** @@ -718,7 +731,7 @@ describe('ActsBundleManagerTest', function () { it('getApplicationInfo_0200', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION | demo.BundleFlag.GET_APPLICATION_INFO_WITH_METADATA, - USERID, (error, datainfo) => { + userId, (error, datainfo) => { if (error) { console.info("getApplicationInfo_0200 fail:" + JSON.stringify(error)); expect(error).assertFail(); @@ -740,12 +753,11 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.supportedModes).assertEqual(0); expect(datainfo.process).assertEqual(""); expect(datainfo.enabled).assertEqual(true); - expect(datainfo.flags).assertEqual(0); expect(datainfo.metaData.entry[0].name).assertEqual("metaDataName"); expect(datainfo.metaData.entry[0].value).assertEqual("metaDataValue"); expect(datainfo.metaData.entry[0].extra).assertEqual("$string:app_name"); expect(datainfo.moduleSourceDirs.length).assertLarger(0); - for (let j = 0; j < datainfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.moduleInfos.length; j++) { expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0); } @@ -760,7 +772,7 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_0300', 0, async function (done) { let datainfo = await demo.getApplicationInfo(NAME2, - demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USERID); + demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId); console.info("getApplicationInfo_0300 result" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); expect(datainfo.name.length).assertLarger(0); @@ -780,9 +792,8 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.supportedModes).assertEqual(0); expect(datainfo.process).assertEqual(""); expect(datainfo.enabled).assertEqual(true); - expect(datainfo.flags).assertEqual(0); expect(datainfo.moduleSourceDirs.length).assertLarger(0); - for (let j = 0; j < datainfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.moduleInfos.length; j++) { expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0); } @@ -796,7 +807,7 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_0400', 0, async function (done) { await demo.getApplicationInfo(NAME2, - demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USERID, (error, datainfo) => { + demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { console.info("getApplicationInfo_0400 result" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); expect(datainfo.name.length).assertLarger(0); @@ -816,9 +827,8 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.supportedModes).assertEqual(0); expect(datainfo.process).assertEqual(""); expect(datainfo.enabled).assertEqual(true); - expect(datainfo.flags).assertEqual(0); expect(datainfo.moduleSourceDirs.length).assertLarger(0); - for (let j = 0; j < datainfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.moduleInfos.length; j++) { expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0); } @@ -833,7 +843,7 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_0500', 0, async function (done) { let datainfo = await demo.getApplicationInfo(NAME3, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES); + userId); console.info("getApplicationInfo_0500 result" + JSON.stringify(datainfo)); expect(datainfo.name).assertEqual(NAME3); expect(datainfo.label).assertEqual("$string:app_name"); @@ -858,7 +868,7 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_0600', 0, async function (done) { await demo.getApplicationInfo(NAME3, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - demo.BundleFlag.GET_BUNDLE_WITH_ABILITIES, (error, datainfo) => { + userId, (error, datainfo) => { console.info("getApplicationInfo_0600 result" + JSON.stringify(datainfo)); expect(datainfo.name).assertEqual(NAME3); expect(datainfo.label).assertEqual("$string:app_name"); @@ -884,15 +894,15 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_0700', 0, async function (done) { await demo.getApplicationInfo(ERROR, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - USERID).then(datainfo => { - console.info("getApplicationInfo_0700 success" + JSON.stringify(datainfo)); - expect(datainfo).assertFail(); - done(); - }).catch(err => { - console.info("getApplicationInfo_0700 err" + JSON.stringify(err)); - expect(err).assertEqual(1); - done(); - }); + userId).then(datainfo => { + console.info("getApplicationInfo_0700 success" + JSON.stringify(datainfo)); + expect(datainfo).assertFail(); + done(); + }).catch(err => { + console.info("getApplicationInfo_0700 err" + JSON.stringify(err)); + expect(err).assertEqual(1); + done(); + }); }) /** @@ -902,7 +912,7 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_0800', 0, async function (done) { await demo.getApplicationInfo(ERROR, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - USERID, (error, datainfo) => { + userId, (error, datainfo) => { if (error) { console.info("getApplicationInfo_0800 fail" + JSON.stringify(error)); expect(error).assertEqual(1); @@ -922,15 +932,15 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_0900', 0, async function (done) { await demo.getApplicationInfo('', demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - USERID).then(datainfo => { - console.info("getApplicationInfo_0900 success" + JSON.stringify(datainfo)); - expect(datainfo).assertFail(); - done(); - }).catch(error => { - console.info("getApplicationInfo_0900 err" + JSON.stringify(error)); - expect(error).assertEqual(1); - done(); - }); + userId).then(datainfo => { + console.info("getApplicationInfo_0900 success" + JSON.stringify(datainfo)); + expect(datainfo).assertFail(); + done(); + }).catch(error => { + console.info("getApplicationInfo_0900 err" + JSON.stringify(error)); + expect(error).assertEqual(1); + done(); + }); }) /** @@ -940,7 +950,7 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_1000', 0, async function (done) { await demo.getApplicationInfo('', demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - USERID, (error, datainfo) => { + userId, (error, datainfo) => { if (error) { console.info("getApplicationInfo_1000 fail" + JSON.stringify(error)); expect(error).assertEqual(1); @@ -959,7 +969,7 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getApplicationInfo interfaces with one hap and different param. (by promise) */ it('getApplicationInfo_1100', 0, async function (done) { - await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_BUNDLE_DEFAULT, USERID).then(datainfo => { + await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_BUNDLE_DEFAULT, userId).then(datainfo => { console.info("getApplicationInfo_1100 success" + JSON.stringify(datainfo)); expect(typeof datainfo).assertEqual(OBJECT); expect(datainfo.name).assertEqual(NAME1); @@ -985,7 +995,7 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getApplicationInfo interfaces with one hap and different param. (by callback) */ it('getApplicationInfo_1200', 0, async function (done) { - await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (error, datainfo) => { + await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_BUNDLE_DEFAULT, userId, (error, datainfo) => { if (error) { console.info("getApplicationInfo_1200 fail" + JSON.stringify(error)); expect(error).assertFail(); @@ -1014,29 +1024,29 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfo_1300', 0, async function (done) { await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - USERID).then(datainfo => { - console.info("getApplicationInfo_1300 success:" + JSON.stringify(datainfo)); - expect(typeof datainfo).assertEqual(OBJECT); - expect(datainfo.name).assertEqual(NAME1); - expect(datainfo.label).assertEqual("$string:app_name"); - expect(datainfo.description).assertEqual(DESCRIPTION); - expect(datainfo.icon).assertEqual("$media:icon"); - expect(datainfo.descriptionId >= 0).assertTrue(); - expect(parseInt(datainfo.iconId)).assertLarger(0); - expect(parseInt(datainfo.labelId)).assertLarger(0); - expect(datainfo.systemApp).assertEqual(true); - expect(datainfo.supportedModes).assertEqual(0); - expect(datainfo.enabled).assertEqual(true); - for (let j = 0; j < datainfo.moduleInfos; j++) { - expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry"); - expect(datainfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); - } - done(); - }).catch(error => { - console.info("getApplicationInfo_1300 fail:" + JSON.stringify(error)); - expect(error).assertFail(); - done(); - }) + userId).then(datainfo => { + console.info("getApplicationInfo_1300 success:" + JSON.stringify(datainfo)); + expect(typeof datainfo).assertEqual(OBJECT); + expect(datainfo.name).assertEqual(NAME1); + expect(datainfo.label).assertEqual("$string:app_name"); + expect(datainfo.description).assertEqual(DESCRIPTION); + expect(datainfo.icon).assertEqual("$media:icon"); + expect(datainfo.descriptionId >= 0).assertTrue(); + expect(parseInt(datainfo.iconId)).assertLarger(0); + expect(parseInt(datainfo.labelId)).assertLarger(0); + expect(datainfo.systemApp).assertEqual(true); + expect(datainfo.supportedModes).assertEqual(0); + expect(datainfo.enabled).assertEqual(true); + for (let j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry"); + expect(datainfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); + } + done(); + }).catch(error => { + console.info("getApplicationInfo_1300 fail:" + JSON.stringify(error)); + expect(error).assertFail(); + done(); + }) }) /** @@ -1045,7 +1055,7 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getApplicationInfo interfaces with one hap. (by callback) */ it('getApplicationInfo_1400', 0, async function (done) { - await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USERID, + await demo.getApplicationInfo(NAME1, demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId, (error, datainfo) => { if (error) { console.info("getApplicationInfo_1400 fail:" + JSON.stringify(error)); @@ -1065,7 +1075,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.systemApp).assertEqual(true); expect(datainfo.supportedModes).assertEqual(0); expect(datainfo.enabled).assertEqual(true); - for (let j = 0; j < datainfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.moduleInfos.length; j++) { expect(datainfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -1085,7 +1095,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -1103,7 +1113,7 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getApplicationInfos interfaces with two haps. */ it('getApplicationInfos_0200', 0, async function (done) { - let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, USERID); + let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, userId); console.info("==========ActsBmsGetInfosSecondScene is ==========" + JSON.stringify(datainfo)); checkgetApplicationInfos(datainfo); done(); @@ -1115,7 +1125,7 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getApplicationInfos interfaces with two haps and different param. */ it('getApplicationInfos_0400', 0, async function (done) { - let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, USERID); + let datainfo = await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, userId); expect(datainfo.length).assertLarger(0); checkgetApplicationInfos(datainfo); done(); @@ -1128,11 +1138,11 @@ describe('ActsBundleManagerTest', function () { */ it('getApplicationInfos_0700', 0, async function (done) { await demo.getAllApplicationInfo(demo.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION, - USERID, (error, datainfo) => { + userId, (error, datainfo) => { for (let i = 0; i < datainfo.length; i++) { expect(datainfo[i].name.length).assertLarger(0); if (datainfo[i].name == NAME1 || datainfo[i].name == NAME2 - || datainfo[i].name == NAME3 || datainfo[i].name == NAME4 || datainfo[i].name == NAME5) { + || datainfo[i].name == NAME3 || datainfo[i].name == NAME4 || datainfo[i].name == NAME5) { expect(datainfo[i].description.length).assertLarger(0); expect(datainfo[i].icon.length).assertLarger(0); expect(datainfo[i].label.length).assertLarger(0); @@ -1140,8 +1150,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo[i].moduleSourceDirs.length).assertLarger(0); expect(datainfo[i].moduleInfos.length).assertLarger(0); expect(datainfo[i].supportedModes).assertEqual(0); - expect(datainfo[i].flags).assertEqual(0); - for (let j = 0; j < datainfo[i].moduleInfos; j++) { + for (let j = 0; j < datainfo[i].moduleInfos.length; j++) { expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0); expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0); } @@ -1156,11 +1165,11 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getApplicationInfos interfaces with three haps. */ it('getApplicationInfos_0800', 0, async function (done) { - await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (error, datainfo) => { + await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, userId, (error, datainfo) => { for (let i = 0; i < datainfo.length; i++) { expect(datainfo[i].name.length).assertLarger(0); if (datainfo[i].name == NAME1 || datainfo[i].name == NAME2 - || datainfo[i].name == NAME3 || datainfo[i].name == NAME4 || datainfo[i].name == NAME5) { + || datainfo[i].name == NAME3 || datainfo[i].name == NAME4 || datainfo[i].name == NAME5) { expect(datainfo[i].description.length).assertLarger(0); expect(datainfo[i].icon.length).assertLarger(0); expect(datainfo[i].label.length).assertLarger(0); @@ -1168,8 +1177,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo[i].moduleSourceDirs.length).assertLarger(0); expect(datainfo[i].moduleInfos.length).assertLarger(0); expect(datainfo[i].supportedModes).assertEqual(0); - expect(datainfo[i].flags).assertEqual(0); - for (let j = 0; j < datainfo[i].moduleInfos; j++) { + for (let j = 0; j < datainfo[i].moduleInfos.length; j++) { expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0); expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0); } @@ -1184,11 +1192,11 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test getApplicationInfos interfaces with two haps and different param. */ it('getApplicationInfos_0900', 0, async function (done) { - await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (error, datainfo) => { + await demo.getAllApplicationInfo(demo.BundleFlag.GET_BUNDLE_DEFAULT, userId, (error, datainfo) => { for (let i = 0; i < datainfo.length; i++) { expect(datainfo[i].name.length).assertLarger(0); if (datainfo[i].name == NAME1 || datainfo[i].name == NAME2 - || datainfo[i].name == NAME3 || datainfo[i].name == NAME4 || datainfo[i].name == NAME5) { + || datainfo[i].name == NAME3 || datainfo[i].name == NAME4 || datainfo[i].name == NAME5) { expect(datainfo[i].description.length).assertLarger(0); expect(datainfo[i].icon.length).assertLarger(0); expect(datainfo[i].label.length).assertLarger(0); @@ -1196,8 +1204,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo[i].moduleSourceDirs.length).assertLarger(0); expect(datainfo[i].moduleInfos.length).assertLarger(0); expect(datainfo[i].supportedModes).assertEqual(0); - expect(datainfo[i].flags).assertEqual(0); - for (let j = 0; j < datainfo[i].moduleInfos; j++) { + for (let j = 0; j < datainfo[i].moduleInfos.length; j++) { expect(datainfo[i].moduleInfos[j].moduleName.length).assertLarger(0); expect(datainfo[i].moduleInfos[j].moduleSourceDir.length).assertLarger(0); } @@ -1218,7 +1225,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -1241,7 +1248,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -1265,7 +1272,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -1289,7 +1296,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -1312,7 +1319,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -1334,7 +1341,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -1356,7 +1363,7 @@ describe('ActsBundleManagerTest', function () { expect(data[i].name.length).assertLarger(0); expect(data[i].appInfo.name.length).assertLarger(0); if (data[i].name == NAME1 || data[i].name == NAME2 - || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { + || data[i].name == NAME3 || data[i].name == NAME4 || data[i].name == NAME5) { expect(data[i].appInfo.description.length).assertLarger(0); expect(data[i].appInfo.icon.length).assertLarger(0); expect(data[i].appInfo.label.length).assertLarger(0); @@ -1380,46 +1387,46 @@ describe('ActsBundleManagerTest', function () { "bundleName": "com.example.myapplication1", "abilityName": "com.example.myapplication1.MainAbility", }, demo.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | - demo.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION | + demo.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION | demo.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, - USERID).then(data => { - expect(data.length).assertLarger(0); - for (let i = 0, len = data.length; i < len; i++) { - let datainfo = data[i]; - console.info("queryAbilityByWant_0100 success:" + JSON.stringify(datainfo)); - expect(datainfo.name).assertEqual("com.example.myapplication1.MainAbility"); - expect(datainfo.label).assertEqual("$string:app_name"); - expect(datainfo.description).assertEqual(DESCRIPTION); - expect(datainfo.icon).assertEqual("$media:icon"); - expect(datainfo.moduleName).assertEqual("entry"); - expect(datainfo.bundleName).assertEqual(NAME1); - expect(datainfo.type).assertEqual(demo.AbilityType.PAGE); - expect(datainfo.subType).assertEqual(demo.AbilitySubType.UNSPECIFIED); - expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.UNSPECIFIED); - expect(datainfo.launchMode).assertEqual(demo.LaunchMode.STANDARD); - expect(datainfo.permissions[0]).assertEqual("com.permission.BMS_PERMISSION_CAMERA"); - expect(datainfo.applicationInfo.name).assertEqual(NAME1); - expect(datainfo.applicationInfo.description).assertEqual(DESCRIPTION); - expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue(); - expect(datainfo.applicationInfo.icon).assertEqual("$media:icon"); - expect(datainfo.applicationInfo.iconId >= 0).assertTrue(); - expect(datainfo.applicationInfo.label).assertEqual("$string:app_name"); - expect(datainfo.applicationInfo.labelId >= 0).assertTrue(); - expect(datainfo.applicationInfo.systemApp).assertEqual(true); - expect(datainfo.applicationInfo.supportedModes).assertEqual(0); - expect(datainfo.applicationInfo.enabled).assertEqual(true); - expect(datainfo.metaData.length).assertLarger(0); - for (let j = 0; j < datainfo.applicationInfo.moduleInfos; j++) { - expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry"); - expect(datainfo.applicationInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); + userId).then(data => { + expect(data.length).assertLarger(0); + for (let i = 0, len = data.length; i < len; i++) { + let datainfo = data[i]; + console.info("queryAbilityByWant_0100 success:" + JSON.stringify(datainfo)); + expect(datainfo.name).assertEqual("com.example.myapplication1.MainAbility"); + expect(datainfo.label).assertEqual("$string:app_name"); + expect(datainfo.description).assertEqual(DESCRIPTION); + expect(datainfo.icon).assertEqual("$media:icon"); + expect(datainfo.moduleName).assertEqual("entry"); + expect(datainfo.bundleName).assertEqual(NAME1); + expect(datainfo.type).assertEqual(demo.AbilityType.PAGE); + expect(datainfo.subType).assertEqual(demo.AbilitySubType.UNSPECIFIED); + expect(datainfo.orientation).assertEqual(demo.DisplayOrientation.UNSPECIFIED); + expect(datainfo.launchMode).assertEqual(demo.LaunchMode.STANDARD); + expect(datainfo.permissions[0]).assertEqual("com.permission.BMS_PERMISSION_CAMERA"); + expect(datainfo.applicationInfo.name).assertEqual(NAME1); + expect(datainfo.applicationInfo.description).assertEqual(DESCRIPTION); + expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue(); + expect(datainfo.applicationInfo.icon).assertEqual("$media:icon"); + expect(datainfo.applicationInfo.iconId >= 0).assertTrue(); + expect(datainfo.applicationInfo.label).assertEqual("$string:app_name"); + expect(datainfo.applicationInfo.labelId >= 0).assertTrue(); + expect(datainfo.applicationInfo.systemApp).assertEqual(true); + expect(datainfo.applicationInfo.supportedModes).assertEqual(0); + expect(datainfo.applicationInfo.enabled).assertEqual(true); + expect(datainfo.metaData.length).assertLarger(0); + for (let j = 0; j < datainfo.applicationInfo.moduleInfos.length; j++) { + expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry"); + expect(datainfo.applicationInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); + } } - } - done(); - }).catch(err => { - console.info("queryAbilityByWant_0100 err" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) + done(); + }).catch(err => { + console.info("queryAbilityByWant_0100 err" + JSON.stringify(err)); + expect(err).assertFail(); + done(); + }) }) /** @@ -1428,14 +1435,14 @@ describe('ActsBundleManagerTest', function () { * @tc.desc Test queryAbilityByWant interfaces with none hap. (by callback) */ it('queryAbilityByWant_0200', 0, async function (done) { - await demo.queryAbilityByWant( + demo.queryAbilityByWant( { "bundleName": "com.example.myapplication1", "abilityName": "com.example.myapplication1.MainAbility", }, demo.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | - demo.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION | + demo.BundleFlag.GET_ABILITY_INFO_WITH_PERMISSION | demo.BundleFlag.GET_ABILITY_INFO_WITH_METADATA, - USERID, (error, data) => { + userId, (err, data) => { if (err) { console.info("queryAbilityByWant_0200 err" + JSON.stringify(err)); expect(err).assertFail(); @@ -1468,7 +1475,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.applicationInfo.supportedModes).assertEqual(0); expect(datainfo.applicationInfo.enabled).assertEqual(true); expect(datainfo.metaData.length).assertLarger(0); - for (let j = 0; j < datainfo.applicationInfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.applicationInfo.moduleInfos.length; j++) { expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry"); expect(datainfo.applicationInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR1); } @@ -1487,7 +1494,7 @@ describe('ActsBundleManagerTest', function () { { "bundleName": "com.example.myapplication2", "abilityName": "com.example.myapplication1.MainAbility", - }, demo.BundleFlag.GET_ALL_APPLICATION_INFO, USERID); + }, demo.BundleFlag.GET_ALL_APPLICATION_INFO, userId); expect(data.length).assertLarger(0); for (let i = 0, len = data.length; i < len; i++) { let datainfo = data[i]; @@ -1510,10 +1517,10 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.applicationInfo.systemApp).assertEqual(true); expect(datainfo.applicationInfo.supportedModes).assertEqual(0); expect(datainfo.applicationInfo.enabled).assertEqual(true); - for (let j = 0; j < datainfo.applicationInfo.moduleInfos; j++) { - expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry"); - expect(datainfo.applicationInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR2); - } + expect(datainfo.applicationInfo.moduleInfos[0].moduleName).assertEqual("entry"); + expect(datainfo.applicationInfo.moduleInfos[0].moduleSourceDir).assertEqual(DIR3); + expect(datainfo.applicationInfo.moduleInfos[1].moduleName).assertEqual("entry"); + expect(datainfo.applicationInfo.moduleInfos[1].moduleSourceDir).assertEqual(DIR2); } done(); }) @@ -1528,36 +1535,36 @@ describe('ActsBundleManagerTest', function () { { "bundleName": "com.example.myapplication2", "abilityName": "com.example.myapplication1.MainAbility", - }, demo.BundleFlag.GET_ALL_APPLICATION_INFO, USERID, (error, data) => { - expect(data.length).assertLarger(0); - for (let i = 0, len = data.length; i < len; i++) { - let datainfo = data[i]; - console.info("queryAbilityByWant_0400 success:" + JSON.stringify(datainfo)); - expect(datainfo.name.length).assertLarger(0); - expect(datainfo.label).assertEqual("$string:app_name"); - expect(datainfo.description).assertEqual(DESCRIPTION); - expect(datainfo.icon).assertEqual("$media:icon"); - expect(datainfo.moduleName).assertEqual("entry"); - expect(datainfo.bundleName).assertEqual(NAME2); - expect(datainfo.orientation).assertEqual(1); - expect(datainfo.launchMode).assertEqual(demo.LaunchMode.SINGLETON); - expect(datainfo.applicationInfo.name).assertEqual(NAME2); - expect(datainfo.applicationInfo.description).assertEqual(DESCRIPTION); - expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue(); - expect(datainfo.applicationInfo.icon).assertEqual("$media:icon"); - expect(datainfo.applicationInfo.iconId >= 0).assertTrue(); - expect(datainfo.applicationInfo.label).assertEqual("$string:app_name"); - expect(datainfo.applicationInfo.labelId >= 0).assertTrue(); - expect(datainfo.applicationInfo.systemApp).assertEqual(true); - expect(datainfo.applicationInfo.supportedModes).assertEqual(0); - expect(datainfo.applicationInfo.enabled).assertEqual(true); - for (let j = 0; j < datainfo.applicationInfo.moduleInfos; j++) { - expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry"); - expect(datainfo.applicationInfo.moduleInfos[j].moduleSourceDir).assertEqual(DIR2); + }, demo.BundleFlag.GET_ALL_APPLICATION_INFO, userId, (error, data) => { + expect(data.length).assertLarger(0); + for (let i = 0, len = data.length; i < len; i++) { + let datainfo = data[i]; + console.info("queryAbilityByWant_0400 success:" + JSON.stringify(datainfo)); + expect(datainfo.name.length).assertLarger(0); + expect(datainfo.label).assertEqual("$string:app_name"); + expect(datainfo.description).assertEqual(DESCRIPTION); + expect(datainfo.icon).assertEqual("$media:icon"); + expect(datainfo.moduleName).assertEqual("entry"); + expect(datainfo.bundleName).assertEqual(NAME2); + expect(datainfo.orientation).assertEqual(1); + expect(datainfo.launchMode).assertEqual(demo.LaunchMode.SINGLETON); + expect(datainfo.applicationInfo.name).assertEqual(NAME2); + expect(datainfo.applicationInfo.description).assertEqual(DESCRIPTION); + expect(datainfo.applicationInfo.descriptionId >= 0).assertTrue(); + expect(datainfo.applicationInfo.icon).assertEqual("$media:icon"); + expect(datainfo.applicationInfo.iconId >= 0).assertTrue(); + expect(datainfo.applicationInfo.label).assertEqual("$string:app_name"); + expect(datainfo.applicationInfo.labelId >= 0).assertTrue(); + expect(datainfo.applicationInfo.systemApp).assertEqual(true); + expect(datainfo.applicationInfo.supportedModes).assertEqual(0); + expect(datainfo.applicationInfo.enabled).assertEqual(true); + expect(datainfo.applicationInfo.moduleInfos[0].moduleName).assertEqual("entry"); + expect(datainfo.applicationInfo.moduleInfos[0].moduleSourceDir).assertEqual(DIR3); + expect(datainfo.applicationInfo.moduleInfos[1].moduleName).assertEqual("entry"); + expect(datainfo.applicationInfo.moduleInfos[1].moduleSourceDir).assertEqual(DIR2); } - } - done(); - }) + done(); + }) }) /** @@ -1568,7 +1575,7 @@ describe('ActsBundleManagerTest', function () { it('queryAbilityByWant_0500', 0, async function (done) { await demo.queryAbilityByWant({ entities: ['entity.system.home', 'entitiesentities'] - }, 4, USERID).then(data => { + }, 4, userId).then(data => { checkAbilityInfo0500(data) done(); }).catch(err => { @@ -1601,7 +1608,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.applicationInfo.supportedModes).assertEqual(0); expect(datainfo.orientation).assertEqual(2); expect(datainfo.applicationInfo.enabled).assertEqual(true); - for (let j = 0; j < datainfo.applicationInfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.applicationInfo.moduleInfos.length; j++) { expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry"); } queryResultCount++; @@ -1631,16 +1638,16 @@ describe('ActsBundleManagerTest', function () { await demo.queryAbilityByWant( { entities: ['entity.system.home', 'entitiesentities'] - }, 4, USERID, (err, data) => { - if (err) { - console.info("queryAbilityByWant_0600 err" + JSON.stringify(err)); - expect(err).assertFail(); + }, 4, userId, (err, data) => { + if (err) { + console.info("queryAbilityByWant_0600 err" + JSON.stringify(err)); + expect(err).assertFail(); + done(); + return; + } + checkAbilityInfo0600(data); done(); - return; - } - checkAbilityInfo0600(data); - done(); - }) + }) }) function checkAbilityInfo0600(data) { @@ -1666,7 +1673,7 @@ describe('ActsBundleManagerTest', function () { expect(datainfo.applicationInfo.supportedModes).assertEqual(0); expect(datainfo.orientation).assertEqual(2); expect(datainfo.applicationInfo.enabled).assertEqual(true); - for (let j = 0; j < datainfo.applicationInfo.moduleInfos; j++) { + for (let j = 0; j < datainfo.applicationInfo.moduleInfos.length; j++) { expect(datainfo.applicationInfo.moduleInfos[j].moduleName).assertEqual("entry"); } queryResultCount++; @@ -1697,15 +1704,15 @@ describe('ActsBundleManagerTest', function () { { "bundleName": "wrong name", "abilityName": "com.example.myapplication1.MainAbility" - }, demo.BundleFlag.GET_BUNDLE_DEFAULT, USERID).then(datainfo => { - console.info("queryAbilityByWant_0700 dataInfo : ===========" + datainfo); - expect(datainfo).assertFail(); - done(); - }).catch(err => { - console.info("queryAbilityByWant_0700 err : ===========" + err); - expect(err).assertEqual(1); - done(); - }) + }, demo.BundleFlag.GET_BUNDLE_DEFAULT, userId).then(datainfo => { + console.info("queryAbilityByWant_0700 dataInfo : ===========" + datainfo); + expect(datainfo).assertFail(); + done(); + }).catch(err => { + console.info("queryAbilityByWant_0700 err : ===========" + err); + expect(err).assertEqual(1); + done(); + }) }) /** @@ -1718,17 +1725,17 @@ describe('ActsBundleManagerTest', function () { { "bundleName": "wrong name", "abilityName": "com.example.myapplication1.MainAbility" - }, demo.BundleFlag.GET_BUNDLE_DEFAULT, USERID, (err, datainfo) => { - if (err) { - console.info("queryAbilityByWant_0800 err : ===========" + err); - expect(err).assertEqual(1); + }, demo.BundleFlag.GET_BUNDLE_DEFAULT, userId, (err, datainfo) => { + if (err) { + console.info("queryAbilityByWant_0800 err : ===========" + err); + expect(err).assertEqual(1); + done(); + return; + } + console.info("queryAbilityByWant_0800 dataInfo : ===========" + datainfo); + expect(datainfo).assertFail(); done(); - return; - } - console.info("queryAbilityByWant_0800 dataInfo : ===========" + datainfo); - expect(datainfo).assertFail(); - done(); - }) + }) }) /** @@ -1741,15 +1748,15 @@ describe('ActsBundleManagerTest', function () { { bundleName: "wrong name", abilityName: "wrong name", - }, 0, USERID).then(datainfo => { - console.info("queryAbilityByWant_0900 dataInfo : ===========" + datainfo); - expect(datainfo.length).assertLarger(0); - done(); - }).catch(err => { - console.info("queryAbilityByWant_0900 err : ===========" + err); - expect(err).assertEqual(1); - done(); - }) + }, 0, userId).then(datainfo => { + console.info("queryAbilityByWant_0900 dataInfo : ===========" + datainfo); + expect(datainfo.length).assertLarger(0); + done(); + }).catch(err => { + console.info("queryAbilityByWant_0900 err : ===========" + err); + expect(err).assertEqual(1); + done(); + }) }) /** @@ -1762,7 +1769,7 @@ describe('ActsBundleManagerTest', function () { { bundleName: "wrong name", abilityName: "wrong name", - }, 0, USERID, OnReceiveEvent); + }, 0, userId, OnReceiveEvent); function OnReceiveEvent(err, datainfo) { console.info("queryAbilityByWant_1000 err : ===========" + err);