diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/index.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/index.ets index b81c3ae70d1207de3681040c3e03cb0ba94a9b43..8315b59dbcbd2543de8048d12f647e808e9a2fc8 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/index.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/pages/index.ets @@ -15,7 +15,7 @@ import router from '@system.router'; import file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index"; import testsuite from "../test/List.test.ets"; import featureAbility from "@ohos.ability.featureAbility"; diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets index 481d77a3c83bd2d9598a5475902946d738b3c52d..8a95165d47b1621bfe63d8d3da5cebbf83cde0ee 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetAbilityLabelJsUnit.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, it, expect } from 'deccjsunit/index.ets'; +import { describe, it, expect } from 'deccjsunit/index'; import Utils from './Utils'; import Bundle from '@ohos.bundle'; diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets index c6721e832e5e2bc247e02b63fe8905cd681b0aa6..61bab6b5d0a6b0b91a49caf772b9e32dd6251623 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/GetabilityInfo.test.ets @@ -13,7 +13,7 @@ * limitations under the License. */ -import { describe, it, expect } from 'deccjsunit/index.ets'; +import { describe, it, expect } from 'deccjsunit/index'; import Utils from './Utils'; import bundleManager from '@ohos.bundle'; diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets index 79bd45b0f3c4be3ef00e27b7594f8bebfbe38bba..892e70a54cd8411443ad78166098d2d12d167ab8 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsAbilityEnabledETSUnit.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, it, expect } from 'deccjsunit/index.ets'; +import { describe, it, expect } from 'deccjsunit/index'; import Utils from './Utils'; import Bundle from '@ohos.bundle'; @@ -20,14 +20,6 @@ const BUNDLE_NAME = 'com.open.harmony.packagemag'; const BUNDLE_NAME_ERROR = 'com.ohos.acepackage.error'; const ABILITY_NAME = 'com.open.harmony.packagemag.MainAbility'; const ABILITY_NAME_ERROR = 'com.ohos.acepackage.error.MainAbility'; -const ABILITY = { - bundleName: BUNDLE_NAME, - name: ABILITY_NAME -} -const ABILITY_ERROR = { - bundleName: BUNDLE_NAME_ERROR, - name: ABILITY_NAME_ERROR -} export default function isAbilityEnabledETSUnit() { @@ -40,9 +32,10 @@ export default function isAbilityEnabledETSUnit() { * @tc.level 0 */ it('isAbilityEnabled_test_0100', 0, async function (done) { + let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME,ABILITY_NAME); let timeOldStamp = await Utils.getNowTime(); let mData; - await Bundle.isAbilityEnabled(ABILITY).then((data) => { + await Bundle.isAbilityEnabled(abilityInfo).then((data) => { let timeNewStamp = Utils.getNowTime(); Utils.getDurationTime('[isAbilityEnabled_test_0100]', timeOldStamp, timeNewStamp); mData = data; @@ -62,9 +55,10 @@ export default function isAbilityEnabledETSUnit() { * @tc.level 0 */ it('isAbilityEnabled_test_0200', 0, async function (done) { + let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME,ABILITY_NAME); let timeOldStamp = await Utils.getNowTime(); let mData; - Bundle.isAbilityEnabled(ABILITY, (error, data) => { + Bundle.isAbilityEnabled(abilityInfo, (error, data) => { if (error) { console.error('[isAbilityEnabled_test_0200]Operation failed. Cause: ' + JSON.stringify(error)); expect(error).assertFail(); @@ -86,9 +80,10 @@ export default function isAbilityEnabledETSUnit() { * @tc.level 0 */ it('isAbilityEnabled_test_0300', 0, async function (done) { + let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME_ERROR,ABILITY_NAME_ERROR); let timeOldStamp = await Utils.getNowTime(); let mData; - await Bundle.isAbilityEnabled(ABILITY_ERROR).then((data) => { + await Bundle.isAbilityEnabled(abilityInfo).then((data) => { let timeNewStamp = Utils.getNowTime(); Utils.getDurationTime('[isAbilityEnabled_test_0300]', timeOldStamp, timeNewStamp); mData = data; @@ -110,9 +105,10 @@ export default function isAbilityEnabledETSUnit() { * @tc.level 0 */ it('isAbilityEnabled_test_0400', 0, async function (done) { + let abilityInfo = generateAbilityInfoForTest(BUNDLE_NAME_ERROR,ABILITY_NAME_ERROR); let timeOldStamp = await Utils.getNowTime(); let mData; - Bundle.isAbilityEnabled(ABILITY_ERROR, (error, data) => { + Bundle.isAbilityEnabled(abilityInfo, (error, data) => { if (error) { console.error('[isAbilityEnabled_test_0400]Operation failed. Cause: ' + JSON.stringify(error)); expect(error).assertFail(); @@ -144,6 +140,48 @@ export default function isAbilityEnabledETSUnit() { expect(data).assertEqual(false); } + function generateAbilityInfoForTest(bundleName, name) { + let map1 = new Map([ + ["", [{ + "name": "", "value": "", "extra": "" + }]] + ]); + + let abilityInfo = { + bundleName: bundleName, + name: name, + label: "", + description: "", + icon: "", + labelId: 0, + descriptionId: 0, + iconId: 0, + moduleName: "", + process: "", + targetAbility: "", + backgroundModes: 0, + isVisible: true, + formEnabled: true, + type: 0, + subType: 0, + orientation: 0, + launchMode: 0, + permissions: [], + deviceTypes: [], + deviceCapabilities: [], + readPermission: "", + writePermission: "", + applicationInfo: { + name: "", description: "", descriptionId: 0, systemApp: true, enabled: true, label: "", + labelId: "", icon: "", iconId: "", process: "", supportedModes: 0, moduleSourceDirs: [], + permissions: [], moduleInfos: [], entryDir: "", codePath: "", metaData: map1, + removable: true, accessTokenId: 0, uid: 0, entityType: "" + }, + uri: "", metaData: [], enabled: true + }; + return abilityInfo; + } + }) } \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets index e5b4b39d051d11b941aa6e0b4d460be9ff14375f..132bb99a9e4972a5f67f8f4b451f333e69020181 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/IsApplicationEnabledETSUnit.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, it, expect } from 'deccjsunit/index.ets'; +import { describe, it, expect } from 'deccjsunit/index'; import Utils from './Utils'; import Bundle from '@ohos.bundle'; diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets index d64a1136b7ace0502bcf30cf16be30e330f1474e..13c5f03efe54412b65622c74795fabedda155fa9 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getAllApplicationInfoJsunit.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, beforeAll ,it, expect } from 'deccjsunit/index.ets'; +import { describe, beforeAll ,it, expect } from 'deccjsunit/index'; import Utils from './Utils'; import Bundle from '@ohos.bundle'; import account from '@ohos.account.osAccount'; @@ -226,50 +226,6 @@ export default function applicationBundleJsunit() { done(); }); - /** - * @tc.number: bundle_getApplicationInfo_test_0500_009 - * @tc.name: getApplicationInfo : Obtains based on a given bundle name. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it(TAG_TEST_0500_001, 0, async function (done) { - let errors; - let startTime = await Utils.getNowTime(); - await Bundle.getAllApplicationInfo('Bundle.BundleFlag.GET_BUNDLE_DEFAULT').then((data) => { - console.info(TAG_TEST_0500_001 + 'noUserId promise data is: ' + data); - expect(data).assertFail(); - }).catch((error) => { - console.info(TAG_TEST_0500_001 + 'noUserId promise error is: ' + error); - errors = error; - expect(errors).assertEqual(1); - }); - let endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0500_001, startTime, endTime); - done(); - }); - - /** - * @tc.number: bundle_getApplicationInfo_test_0500_0010 - * @tc.name: getApplicationInfo : Obtains based on a given bundle name. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it(TAG_TEST_0500_002, 0, async function (done) { - let errors; - let startTime = await Utils.getNowTime(); - 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) => { - console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error); - errors = error; - expect(errors).assertEqual(1); - }); - let endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime); - done(); - }); - function expectData(msg, data) { console.info(msg + 'commonTest data length [' + data.length + ']'); for (let i = 0; i < data.length; i++) { diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets index 63d92cf1217e4498b6e2a1b7932c43b559ca1bb0..bd919e7f5095d9b5a97d71a8596aba35d6ce1e54 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/MainAbility/test/getApplicationInfoJsunit.test.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { describe, it, beforeAll, expect } from 'deccjsunit/index.ets'; +import { describe, it, beforeAll, expect } from 'deccjsunit/index'; import Utils from './Utils'; import Bundle from '@ohos.bundle'; import account from '@ohos.account.osAccount'; @@ -254,26 +254,6 @@ export default function applicationBundleJsunit() { done(); }); - /** - * @tc.number: bundle_getApplicationInfo_test_0500_002 - * @tc.name: getApplicationInfo : Obtains based on a given bundle name. - * @tc.desc: Check the return value of the interface (by promise) - * @tc.level 0 - */ - it(TAG_TEST_0500_002, 0, async function (done) { - let startTime = await Utils.getNowTime(); - 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) => { - console.info(TAG_TEST_0500_002 + 'UserId promise error is: ' + error); - expect(error).assertEqual(1); - }); - let endTime = Utils.getNowTime(); - Utils.getDurationTime(TAG_TEST_0500_002, startTime, endTime); - done(); - }); - /** * @tc.number: bundle_getApplicationInfo_test_0600_001 * @tc.name: getApplicationInfo : Obtains based on a given bundle name. diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmssceneeight/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmssceneeight/src/main/js/default/pages/index/index.js index a2ff58470a93d145ec2da6f0c58ef486b9cbd08d..d7c6ca6e1b13254d5b8c8ab75fa226fc971c4e43 100644 --- a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmssceneeight/src/main/js/default/pages/index/index.js +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmssceneeight/src/main/js/default/pages/index/index.js @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import commonEvent from '@ohos.commonevent' +import commonEvent from '@ohos.commonEvent' const injectRef = Object.getPrototypeOf(global) || global injectRef.regeneratorRuntime = require('@babel/runtime/regenerator')