diff --git a/appexecfwk/bundle_standard/bundlemanager/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/BUILD.gn index b6776ebf54fd67c6be1a20089d277d1a82ac8d24..46c174c9fa70b59500311afaa02ed829debd6ee8 100644 --- a/appexecfwk/bundle_standard/bundlemanager/BUILD.gn +++ b/appexecfwk/bundle_standard/bundlemanager/BUILD.gn @@ -56,6 +56,7 @@ group("bundlemanager") { "sceneProject/bmsscenethree:bmsJstest3", "sceneProject/bmsscenetwo:bmsJstest2", "sceneProject/bmssecondright:second_right", + "sceneProject/bmsstagedemoone:bmsStageDemo1", ] } } 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 cbb24fe8a548a6456e867263f0a47818ab716ea8..a65db539dfa3e374435d504d752a2987c3a195cb 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 @@ -19,6 +19,8 @@ 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'; describe('ActsBmsQueryAbilityByWant', function () { @@ -30,8 +32,8 @@ describe('ActsBmsQueryAbilityByWant', function () { */ it('bms_queryAbilityByWant_0100', 0, async function (done) { await bundle.queryAbilityByWant({ - action: ['action.system.home'], - entities: ['entity.system.home'], + action: [ACTION_NAME], + entities: [ENTITY_NAME], bundleName: BUNDLE_NAME1 }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, USERID).then(data => { @@ -40,8 +42,8 @@ describe('ActsBmsQueryAbilityByWant', function () { expect(err).assertEqual(1); }); bundle.queryAbilityByWant({ - action: ['action.system.home'], - entities: ['entity.system.home'], + action: [ACTION_NAME], + entities: [ENTITY_NAME], bundleName: BUNDLE_NAME1 }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, USERID, (err, data) => { @@ -60,8 +62,8 @@ describe('ActsBmsQueryAbilityByWant', function () { it('bms_queryAbilityByWant_0200', 0, async function (done) { await bundle.queryAbilityByWant( { - action: ['action.system.home'], - entities: ['entity.system.home'] + action: [ACTION_NAME], + entities: [ENTITY_NAME] }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, USERID).then(data => { @@ -75,8 +77,8 @@ describe('ActsBmsQueryAbilityByWant', function () { }); bundle.queryAbilityByWant( { - action: ['action.system.home'], - entities: ['entity.system.home'] + action: [ACTION_NAME], + entities: [ENTITY_NAME] }, bundle.BundleFlag.GET_ABILITY_INFO_WITH_APPLICATION | bundle.BundleFlag.GET_ABILITY_INFO_SYSTEMAPP_ONLY, USERID, (err, data) => { @@ -98,7 +100,7 @@ describe('ActsBmsQueryAbilityByWant', function () { */ it('bms_queryAbilityByEntities_0300', 0, async function (done) { let dataInfos = await bundle.queryAbilityByWant({ - action: 'action.system.home', + action: ACTION_NAME, entities: ["entity.app.music", "entity.app.email", "entity.app.contacts", @@ -117,7 +119,7 @@ describe('ActsBmsQueryAbilityByWant', function () { expect(dataInfos.length).assertEqual(1); cheackAbilityInfos(dataInfos[0]); bundle.queryAbilityByWant({ - action: 'action.system.home', + action: ACTION_NAME, entities: ["entity.app.music", "entity.app.email", "entity.app.contacts", 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 793f8f5565392416df18733ce7908fa61feb7f20..1502384a51bb25092b53ab9e3c9032821a449874 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 @@ -23,6 +23,10 @@ const BUNDLE_NAME5 = 'com.example.system1'; 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'; describe('ActsBmsHapModuleTest', function () { @@ -40,18 +44,18 @@ describe('ActsBmsHapModuleTest', function () { if (result.hapModuleInfos.length > 0) { let hapModuleInfo = result.hapModuleInfos[0]; expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME1); - expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.descriptionId).assertEqual(0); - expect(hapModuleInfo.iconPath).assertEqual("$media:icon"); + expect(hapModuleInfo.iconPath).assertEqual(ICON_PATH); expect(hapModuleInfo.icon).assertEqual(''); - expect(hapModuleInfo.label).assertEqual('$string:app_name'); + expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.labelId).assertEqual(0); expect(hapModuleInfo.iconId).assertEqual(0); expect(hapModuleInfo.backgroundImg).assertEqual(""); expect(hapModuleInfo.supportedModes).assertEqual(0); expect(hapModuleInfo.reqCapabilities.length).assertEqual(0); - expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone'); + expect(hapModuleInfo.deviceTypes[0]).assertEqual(DEVICE_TYPES); expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY); expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY); expect(hapModuleInfo.abilityInfo.length).assertLarger(0); @@ -79,10 +83,10 @@ describe('ActsBmsHapModuleTest', function () { let hapModuleInfo1 = result.hapModuleInfos[1]; checkHapMoudleInfos(hapModuleInfo); checkHapMoudleInfos(hapModuleInfo1); - expect(hapModuleInfo.label).assertEqual('$string:app_name'); + expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME1); expect(hapModuleInfo1.name).assertEqual(BUNDLE_NAME6); - expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.mainAbilityName).assertEqual(FIRSTMAINABILITY); expect(hapModuleInfo.mainElementName).assertEqual(FIRSTMAINABILITY); expect(hapModuleInfo1.moduleName).assertEqual('bmsmainabilitysecondscene'); @@ -106,18 +110,18 @@ describe('ActsBmsHapModuleTest', function () { if (result.hapModuleInfos.length > 0) { let hapModuleInfo = result.hapModuleInfos[0]; expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME2); - expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.descriptionId).assertEqual(0); - expect(hapModuleInfo.iconPath).assertEqual("$media:icon"); + expect(hapModuleInfo.iconPath).assertEqual(ICON_PATH); expect(hapModuleInfo.icon).assertEqual(''); - expect(hapModuleInfo.label).assertEqual('$string:app_name'); + expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.labelId).assertEqual(0); expect(hapModuleInfo.iconId).assertEqual(0); expect(hapModuleInfo.backgroundImg).assertEqual(""); expect(hapModuleInfo.supportedModes).assertEqual(0); expect(hapModuleInfo.reqCapabilities.length).assertEqual(0); - expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone'); + expect(hapModuleInfo.deviceTypes[0]).assertEqual(DEVICE_TYPES); expect(hapModuleInfo.mainAbilityName).assertEqual(""); expect(hapModuleInfo.mainElementName).assertEqual(""); expect(hapModuleInfo.abilityInfo.length).assertLarger(0); @@ -143,18 +147,18 @@ describe('ActsBmsHapModuleTest', function () { if (result.hapModuleInfos.length == 1) { let hapModuleInfo = result.hapModuleInfos[0]; expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME3); - expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.descriptionId).assertEqual(0); - expect(hapModuleInfo.iconPath).assertEqual("$media:icon"); + expect(hapModuleInfo.iconPath).assertEqual(ICON_PATH); expect(hapModuleInfo.icon).assertEqual(''); - expect(hapModuleInfo.label).assertEqual('$string:app_name'); + expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.labelId).assertEqual(0); expect(hapModuleInfo.iconId).assertEqual(0); expect(hapModuleInfo.backgroundImg).assertEqual(""); expect(hapModuleInfo.supportedModes).assertEqual(0); expect(hapModuleInfo.reqCapabilities.length).assertEqual(0); - expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone'); + expect(hapModuleInfo.deviceTypes[0]).assertEqual(DEVICE_TYPES); expect(hapModuleInfo.mainAbilityName).assertEqual("com.example.third5.AMainAbility"); expect(hapModuleInfo.mainElementName).assertEqual("com.example.third5.AMainAbility"); expect(hapModuleInfo.abilityInfo.length).assertLarger(0); @@ -181,18 +185,18 @@ describe('ActsBmsHapModuleTest', function () { if (data.hapModuleInfos.length == 1) { let hapModuleInfo = data.hapModuleInfos[0]; expect(hapModuleInfo.name).assertEqual(BUNDLE_NAME5); - expect(hapModuleInfo.moduleName).assertEqual('entry'); + expect(hapModuleInfo.moduleName).assertEqual(MODULE_NAME); expect(hapModuleInfo.description).assertEqual(''); expect(hapModuleInfo.descriptionId).assertEqual(0); - expect(hapModuleInfo.iconPath).assertEqual("$media:icon"); + expect(hapModuleInfo.iconPath).assertEqual(ICON_PATH); expect(hapModuleInfo.icon).assertEqual(''); - expect(hapModuleInfo.label).assertEqual('$string:app_name'); + expect(hapModuleInfo.label).assertEqual(LABEL); expect(hapModuleInfo.labelId).assertEqual(0); expect(hapModuleInfo.iconId).assertEqual(0); expect(hapModuleInfo.backgroundImg).assertEqual(""); expect(hapModuleInfo.supportedModes).assertEqual(0); expect(hapModuleInfo.reqCapabilities.length).assertEqual(0); - expect(hapModuleInfo.deviceTypes[0]).assertEqual('phone'); + expect(hapModuleInfo.deviceTypes[0]).assertEqual(DEVICE_TYPES); expect(hapModuleInfo.mainAbilityName).assertEqual("com.example.system1.MainAbility"); expect(hapModuleInfo.mainElementName).assertEqual("com.example.system1.MainAbility"); expect(hapModuleInfo.abilityInfo.length).assertLarger(0); @@ -208,14 +212,14 @@ describe('ActsBmsHapModuleTest', function () { function checkHapMoudleInfos(info) { expect(info.description).assertEqual(''); expect(info.descriptionId).assertEqual(0); - expect(info.iconPath).assertEqual("$media:icon"); + expect(info.iconPath).assertEqual(ICON_PATH); expect(info.icon).assertEqual(''); expect(info.labelId).assertEqual(0); expect(info.iconId).assertEqual(0); expect(info.backgroundImg).assertEqual(""); expect(info.supportedModes).assertEqual(0); expect(info.reqCapabilities.length).assertEqual(0); - expect(info.deviceTypes[0]).assertEqual('phone'); + expect(info.deviceTypes[0]).assertEqual(DEVICE_TYPES); expect(info.abilityInfo.length).assertLarger(0); expect(info.colorMode).assertEqual(-1); expect(info.extensionAbilityInfo.length).assertEqual(0); diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json index 43f0abe6ff642df392c4bc77adb90acc5b758f2f..56ad127d85571fe9790b26b3474f63f6368bba8e 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/Test.json @@ -27,7 +27,8 @@ "push":[ "bmsThirdBundleTest1.hap -> /data/bmsThirdBundleTest1.hap ", "first_right.hap -> /data/test/first_right.hap", - "second_right.hap -> /data/second_right.hap" + "second_right.hap -> /data/second_right.hap", + "bmsStageDemo1.hap -> /data/test/bmsStageDemo1.hap" ] }, { @@ -35,7 +36,8 @@ "run-command": [ "bm install -p /data/bmsThirdBundleTest1.hap", "bm install -p /data/test/first_right.hap", - "bm install -p /data/second_right.hap" + "bm install -p /data/second_right.hap", + "bm install -p /data/test/bmsStageDemo1.hap" ], "teardown-command":[ "bm uninstall -n com.example.third1", diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets index 0d567bdf11f434f2ee1e69cc40841515092cf0c8..04b6fa4379b263a1824d19e4c5f3b065ad5d233f 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/List.test.ets @@ -21,8 +21,10 @@ import isAbilityEnableETSUnit from "./IsAbilityEnabledETSUnit.ets"; import isApplicationEnabledETSUnit from "./IsApplicationEnabledETSUnit.ets"; import getAbilityIcon from "./GetAbilityIcon.test.ets"; import getNameForUid from "./GetNameForUid.test.ets"; +import queryExtensionAbilityInfos from "./QueryExtensionAbilityInfos.test.ets"; export default function testsuite() { + queryExtensionAbilityInfos(); getAbilityIcon(); getLaunchWantForBundle(); getNameForUid(); 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 new file mode 100644 index 0000000000000000000000000000000000000000..5a27e61c801359ffefbdc5c2533077ef0a3e63cd --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageretstest/entry/src/main/ets/test/QueryExtensionAbilityInfos.test.ets @@ -0,0 +1,404 @@ +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import bundle from '@ohos.bundle' +import { describe, it, expect } from 'hypium/index'; + +const BUNDLE_NAME1 = "ohos.acts.bundle.stage"; +const BUNDLE_NAME2 = "com.noexit.com"; +const ABILITY_NAME1 = "ExtensionAbility1"; +const ABILITY_NAME2 = "noexitAbility"; + +export default function QueryExtensionAbilityInfos() { + + describe('QueryExtensionAbilityInfos', function () { + + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0001 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos with invalid userId + */ + it('SUB_BMS_APPINFO_EXTENSION_0001', 0, async function (done) { + await bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 1001).then(data => { + expect(data).assertFail(); + }).catch(err => { + expect(err).assertEqual(1); + }); + bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 1001, (err, data) => { + if (err) { + expect(err).assertEqual(1); + done(); + return; + } + expect(data).assertFail(); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0002 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos get permissions flag + */ + it('SUB_BMS_APPINFO_EXTENSION_0002', 0, async function (done) { + await bundle.queryExtensionAbilityInfos({ + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, 100).then(data => { + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual("ExtensionAbility1"); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(0); + expect(data[0].permissions[0]).assertEqual("ohos.permission.GET_BUNDLE_INFO"); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata.length).assertEqual(0); + }).catch(err => { + expect(err).assertEqual(1); + }); + bundle.queryExtensionAbilityInfos({ + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_PERMISSION, 100, (err, data) => { + if (err) { + expect(err).assertEqual(1); + done(); + return; + } + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual("ExtensionAbility1"); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(0); + expect(data[0].permissions[0]).assertEqual("ohos.permission.GET_BUNDLE_INFO"); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata.length).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0003 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos with default flag + */ + + it('SUB_BMS_APPINFO_EXTENSION_0003', 0, async function (done) { + await bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, + 100).then(data => { + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual("ExtensionAbility1"); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(0); + expect(data[0].permissions.length).assertEqual(0); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata.length).assertEqual(0); + }).catch(err => { + expect(err).assertEqual(1); + }); + bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, + 100, (err, data) => { + if (err) { + expect(err).assertEqual(1); + done(); + return; + } + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual("ExtensionAbility1"); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(0); + expect(data[0].permissions.length).assertEqual(0); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata.length).assertEqual(0); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0004 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos with get application flag + */ + + it('SUB_BMS_APPINFO_EXTENSION_0004', 0, async function (done) { + await bundle.queryExtensionAbilityInfos({ + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_APPLICATION, + 100).then(data => { + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual("ExtensionAbility1"); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(0); + expect(data[0].permissions.length).assertEqual(0); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata.length).assertEqual(0); + checkApplication(data); + }).catch(err => { + expect(err).assertFail(); + }); + bundle.queryExtensionAbilityInfos({ + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_APPLICATION, + 100, (err, data) => { + if (err) { + expect(err).assertFail(); + done(); + return; + } + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual("ExtensionAbility1"); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(0); + expect(data[0].permissions.length).assertEqual(0); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata.length).assertEqual(0); + checkApplication(data); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0005 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos with invalid bundleName + */ + it('SUB_BMS_APPINFO_EXTENSION_0005', 0, async function (done) { + await bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME2, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100).then(data => { + expect(data).assertFail(); + }).catch(err => { + expect(err).assertEqual(1); + }); + bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME2, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100, (err, data) => { + if (err) { + expect(err).assertEqual(1); + done(); + return; + } + expect(data).assertFail(); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0006 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos with invalid abilityName + */ + it('SUB_BMS_APPINFO_EXTENSION_0006', 0, async function (done) { + await bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME2 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100).then(data => { + expect(data).assertFail(); + }).catch(err => { + expect(err).assertEqual(1); + }); + bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME2 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, 100, (err, data) => { + if (err) { + expect(err).assertEqual(1); + done(); + return; + } + expect(data).assertFail(); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0007 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos with invalid param + */ + it('SUB_BMS_APPINFO_EXTENSION_0007', 0, async function (done) { + await bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, null, 100).then(data => { + expect(data).assertFail(); + }).catch(err => { + expect(err).assertEqual(1); + }); + await bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_DEFAULT, null).then(data => { + expect(data).assertFail(); + }).catch(err => { + expect(err).assertEqual(1); + }); + bundle.queryExtensionAbilityInfos( + { + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, null, 100, (err, data) => { + expect(err).assertEqual(1); + expect(data).assertEqual("type mismatch"); + done(); + }) + }) + + /* + * @tc.number: SUB_BMS_APPINFO_EXTENSION_0008 + * @tc.name: test queryExtensionAbilityInfos api + * @tc.desc: test queryExtensionAbilityInfos with get metaData flag and no userId + */ + it('SUB_BMS_APPINFO_EXTENSION_0008', 0, async function (done) { + await bundle.queryExtensionAbilityInfos({ + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_METADATA).then(data => { + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual("ExtensionAbility1"); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(0); + expect(data[0].permissions.length).assertEqual(0); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata[0].name).assertEqual("ohos.extension.form"); + expect(data[0].metadata[0].value).assertEqual(""); + expect(data[0].metadata[0].resource).assertEqual("$profile:form_config"); + }).catch(err => { + expect(err).assertFail(); + }); + bundle.queryExtensionAbilityInfos({ + "bundleName": BUNDLE_NAME1, + "abilityName": ABILITY_NAME1 + }, bundle.ExtensionAbilityType.FORM, bundle.ExtensionFlag.GET_EXTENSION_INFO_WITH_METADATA, (err, data) => { + if (err) { + expect(err).assertFail(); + done(); + return; + } + expect(data[0].bundleName).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].moduleName).assertEqual("phone"); + expect(data[0].name).assertEqual("ExtensionAbility1"); + expect(data[0].labelId).assertLarger(0); + expect(data[0].descriptionId).assertLarger(0); + expect(data[0].iconId).assertEqual(0); + expect(data[0].isVisible).assertFalse(); + expect(data[0].extensionAbilityType).assertEqual(0); + expect(data[0].permissions.length).assertEqual(0); + expect(data[0].enabled).assertTrue(); + expect(data[0].readPermission).assertEqual(""); + expect(data[0].writePermission).assertEqual(""); + expect(data[0].metadata[0].name).assertEqual("ohos.extension.form"); + expect(data[0].metadata[0].value).assertEqual(""); + expect(data[0].metadata[0].resource).assertEqual("$profile:form_config"); + done(); + }) + }) + + function checkApplication(data) { + expect(data[0].applicationInfo.name).assertEqual("ohos.acts.bundle.stage"); + expect(data[0].applicationInfo.codePath).assertEqual("/data/app/el1/bundle/public/ohos.acts.bundle.stage"); + expect(data[0].applicationInfo.accessTokenId).assertLarger(0); + expect(data[0].applicationInfo.description).assertEqual("$string:description_application"); + expect(data[0].applicationInfo.descriptionId).assertLarger(0); + expect(data[0].applicationInfo.icon).assertEqual("$media:icon"); + expect(data[0].applicationInfo.iconId).assertLarger(0); + expect(data[0].applicationInfo.label).assertEqual("$string:app_name"); + expect(data[0].applicationInfo.labelId).assertLarger(0); + expect(data[0].applicationInfo.systemApp).assertTrue(); + expect(data[0].applicationInfo.supportedModes).assertEqual(0); + expect(data[0].applicationInfo.process).assertEqual(""); + expect(data[0].applicationInfo.entryDir).assertEqual("/data/app/el1/bundle/public/ohos.acts.bundle.stage/phone"); + expect(data[0].applicationInfo.permissions.length).assertEqual(0); + expect(data[0].applicationInfo.moduleSourceDirs[0]).assertEqual("/data/app/el1/bundle/public/ohos.acts.bundle.stage/phone"); + expect(data[0].applicationInfo.moduleInfos[0].moduleName).assertEqual("phone"); + expect(data[0].applicationInfo.moduleInfos[0].moduleSourceDir).assertEqual("/data/app/el1/bundle/public/ohos.acts.bundle.stage/phone"); + 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(); + expect(data[0].applicationInfo.fingerprint).assertEqual(""); + } + + }) +} 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 1a913d9ac9f9d2050554d0722c90feaab616366e..3c2e73bf05f8ffe8bc0097bab8a82cab04a6a7a4 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 @@ -33,7 +33,7 @@ const BUNDLE_NAME = 'com.open.harmony.packagemag'; const BUNDLE_NAME_OTHER = 'com.ohos.acepackage'; const USER_ID_100 = 100; -export default function applicationBundleJsunit() { +export default function getApplicationInfoJsunit() { describe('appInfoTest', function () { diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/AppScope/app.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..3c2c2b076c74b5aa64e39d16cb7ecec00ee2ae3d --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/AppScope/app.json @@ -0,0 +1,21 @@ +{ + "app":{ + "bundleName":"ohos.acts.bundle.stage", + "vendor":"huawei", + "versionCode":1000000, + "versionName":"1.0.0", + "debug":false, + "icon":"$media:icon", + "label":"$string:app_name", + "description":"$string:description_application", + "distributedNotificationEnabled":true, + "keepAlive":true, + "singleUser":true, + "minAPIVersion":8, + "targetAPIVersion":8, + "car":{ + "apiCompatibleVersion":8, + "singleUser":false + } + } +} diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/AppScope/resources/base/element/string.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ee69f9a861d9dc269ed6638735d52674583498e1 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"ohosProject" + } + ] +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..d5a079d99a374802ba307a6fd9cac4cc128eeb24 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/BUILD.gn @@ -0,0 +1,41 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("bmsStageDemo1") { + hap_profile = "entry/src/main/module.json" + deps = [ + ":bmsstagedemoone_js_assets", + ":bmsstagedemoone_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "bmsStageDemo1" + testonly = true +} + +ohos_app_scope("bmsstagedemoone_app_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("bmsstagedemoone_js_assets") { + source_dir = "entry/src/main/ets" +} + +ohos_resources("bmsstagedemoone_resources") { + sources = [ "entry/src/main/resources" ] + deps = [ ":bmsstagedemoone_app_profile" ] + hap_profile = "entry/src/main/module.json" +} diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/Test.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..26909f2889de98a479f076f87725fed805c7a343 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/Test.json @@ -0,0 +1,4 @@ +{ + "description": "Configuration for hjunit demo Tests", +} + diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/Application/AbilityStage.ts b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/Application/AbilityStage.ts new file mode 100644 index 0000000000000000000000000000000000000000..51cb02ba3f5c7011c1cd433d07deebd47a195704 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/Application/AbilityStage.ts @@ -0,0 +1,9 @@ +import AbilityStage from "@ohos.application.AbilityStage" + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + console.log("[Demo] MyAbilityStage onCreate") + globalThis.stageOnCreateRun = 1; + globalThis.stageContext = this.context; + } +} diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/FormAbility/FormAbility.ts b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/FormAbility/FormAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f94ce17654ff7562d7bc9878961bbab2219fe92 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/FormAbility/FormAbility.ts @@ -0,0 +1,37 @@ +import FormExtension from '@ohos.application.FormExtension'; +import formBindingData from '@ohos.application.formBindingData'; +import formInfo from '@ohos.application.formInfo'; + +export default class FormAbility extends FormExtension { + onCreate(want) { + // Called to return a FormBindingData object. + let formData = {}; + return formBindingData.createFormBindingData(formData); + } + + onCastToNormal(formId) { + // Called when the form provider is notified that a temporary form is successfully + // converted to a normal form. + } + + onUpdate(formId) { + // Called to notify the form provider to update a specified form. + } + + onVisibilityChange(newStatus) { + // Called when the form provider receives form events from the system. + } + + onEvent(formId, message) { + // Called when a specified message event defined by the form provider is triggered. + } + + onDestroy(formId) { + // Called to notify the form provider that a specified form has been destroyed. + } + + onAcquireFormState(want) { + // Called to return a {@link FormState} object. + return formInfo.FormState.READY; + } +}; \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/MainAbility/MainAbility.ts b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/MainAbility/MainAbility.ts new file mode 100644 index 0000000000000000000000000000000000000000..2f9d6d1f23f95d9fc891fbc550cd5a589cfb6c89 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/MainAbility/MainAbility.ts @@ -0,0 +1,36 @@ +import Ability from '@ohos.application.Ability' + +export default class MainAbility extends Ability { + onCreate(want,launchParam){ + // Ability is creating, initialize resources for this ability + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + // Ability is destroying, release resources for this ability + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + globalThis.abilityContext = this.context + windowStage.setUIContent(this.context, "pages/index/index", null) + } + + onWindowStageDestroy() { + //Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground") + } +}; \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/pages/index/index.ets b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/pages/index/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..7974e5d93b5154d6fdf9609f18c2168ff4fd7d60 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/pages/index/index.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import file from '@system.file'; + +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" +import testsuite from "../../test/List.test.ets" + + +@Entry +@Component +struct Index { + + aboutToAppear(){ + console.info("start run testcase!!!!") + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) + globalThis.abilityWant.parameters.timeout = 70000; + configService.setConfig(globalThis.abilityWant.parameters) + testsuite(globalThis.abilityContext) + core.execute() + } + + build() { + Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('Hello World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(25) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/pages/second/second.ets b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/pages/second/second.ets new file mode 100644 index 0000000000000000000000000000000000000000..1c1c727ff11ecc97909f482c35268db87ae23bb4 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/pages/second/second.ets @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Second { + private content: string = "Second Page" + + build() { + Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('back to index') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .onClick(() => { + router.back() + }) + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/test/List.test.ets b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..193419242c9869f76b7cb16e2999f5d76ec6da9c --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/ets/test/List.test.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +export default function testsuite(context) { + + +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..2cb80f071885c3d62794e73f87d104cf58569f61 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/module.json @@ -0,0 +1,68 @@ +{ + "module": { + "name": "phone", + "type": "entry", + "srcEntrance": "./ets/Application/AbilityStage.ts", + "description": "$string:phone_entry_dsc", + "mainElement": "MainAbility", + "deviceTypes": [ + "phone" + ], + "deliveryWithInstall": true, + "installationFree": false, + "uiSyntax": "ets", + "pages": "$profile:main_pages", + "abilities": [ + { + "name": "ohos.acts.bundle.stage.MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:phone_entry_main", + "icon": "$media:icon", + "label": "$string:entry_label", + "orientation": "portrait", + "visible": true, + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities":[ + "entity.system.home" + ] + } + ] + } + ], + "extensionAbilities": [ + { + "name": "FormAbility", + "srcEntrance": "./ets/FormAbility/FormAbility.ts", + "label": "$string:form_FormAbility_label", + "description": "$string:form_FormAbility_desc", + "type": "form", + "metadata": [ + { + "name": "ohos.extension.form", + "resource": "$profile:form_config" + } + ], + "permissions": ["ohos.permission.GET_BUNDLE_INFO"] + }, + { + "name": "ExtensionAbility1", + "srcEntrance": "./ets/FormAbility/FormAbility.ts", + "label": "$string:form_FormAbility_label", + "description": "$string:form_FormAbility_desc", + "type": "form", + "metadata": [ + { + "name": "ohos.extension.form", + "resource": "$profile:form_config" + } + ], + "permissions": ["ohos.permission.GET_BUNDLE_INFO"] + } + ] + + } +} diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/element/string.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..c9962d9e060b2701436e65408ad934b871cd1867 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/element/string.json @@ -0,0 +1,40 @@ +{ + "string": [ + { + "name": "phone_entry_dsc", + "value": "i am an entry for phone" + }, + { + "name": "phone_entry_main", + "value": "the phone entry ability" + }, + { + "name": "entry_label", + "value": "ActsContextTest" + }, + { + "name": "form_description", + "value": "my form" + }, + { + "name": "serviceability_description", + "value": "my whether" + }, + { + "name": "description_application", + "value": "demo for test" + }, + { + "name": "app_name", + "value": "Demo" + }, + { + "name": "form_FormAbility_desc", + "value": "form_description" + }, + { + "name": "form_FormAbility_label", + "value": "form_label" + } + ] +} diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/media/icon.png b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..474a55588fd7216113dd42073aadf254d4dba023 Binary files /dev/null and b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/media/icon.png differ diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/profile/form_config.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/profile/form_config.json new file mode 100644 index 0000000000000000000000000000000000000000..d468824a7bec4668668459e107e018f5c89792f3 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/profile/form_config.json @@ -0,0 +1,81 @@ +{ + "forms": [ + { + "isDefault": true, + "src": "./js/widget/pages/index/index", + "scheduledUpdateTime": "10:30", + "defaultDimension": "2*2", + "name": "widget", + "description": "This is a service widget.", + "colorMode": "auto", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "formConfigAbility": "ability://xxxxx", + "supportDimensions": [ + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "isDefault": true, + "src": "./js/widget1/pages/index/index", + "scheduledUpdateTime": "10:30", + "defaultDimension": "2*2", + "name": "widget1", + "description": "This is a service widget.", + "colorMode": "auto", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "formConfigAbility": "ability://xxxxx", + "supportDimensions": [ + "1*2", + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "isDefault": true, + "src": "./js/widget2/pages/index/index", + "scheduledUpdateTime": "10:30", + "defaultDimension": "2*2", + "name": "widget2", + "description": "This is a service widget.", + "colorMode": "auto", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "formConfigAbility": "ability://xxxxx", + "supportDimensions": [ + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + }, + { + "isDefault": true, + "src": "./js/widget3/pages/index/index", + "scheduledUpdateTime": "10:30", + "defaultDimension": "2*2", + "name": "widget3", + "description": "This is a service widget.", + "colorMode": "auto", + "window": { + "designWidth": 720, + "autoDesignWidth": true + }, + "formConfigAbility": "ability://xxxxx", + "supportDimensions": [ + "2*2" + ], + "updateEnabled": true, + "updateDuration": 1 + } + ] +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/profile/main_pages.json b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/profile/main_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..6898b31d2085f478ee1ed9d933a5910cbf901d92 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/entry/src/main/resources/base/profile/main_pages.json @@ -0,0 +1,6 @@ +{ + "src": [ + "pages/index/index", + "pages/second/second" + ] +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/signature/openharmony_sx.p7b b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..66b4457a8a81fb8d3356cf46d67226c850944858 Binary files /dev/null and b/appexecfwk/bundle_standard/bundlemanager/sceneProject/bmsstagedemoone/signature/openharmony_sx.p7b differ diff --git a/appexecfwk/zlib/actszipfileandunzipfiletest/entry/src/main/js/test/actszipfileandunzipfiletest.test.js b/appexecfwk/zlib/actszipfileandunzipfiletest/entry/src/main/js/test/actszipfileandunzipfiletest.test.js index 7011d478a8edb0fe4d8667878dfabbbaba21e0e1..1243c29831eca47d6b47e8812d23ecc47a0bd299 100644 --- a/appexecfwk/zlib/actszipfileandunzipfiletest/entry/src/main/js/test/actszipfileandunzipfiletest.test.js +++ b/appexecfwk/zlib/actszipfileandunzipfiletest/entry/src/main/js/test/actszipfileandunzipfiletest.test.js @@ -263,7 +263,7 @@ it('ACTS_ZipFile_2300', 0, async function (done) { done(); }) }).catch(function (err) { - console.info("ACTS_ZipFile_2200 write data to file failed with error:" + err); + console.info("ACTS_ZipFile_2300 write data to file failed with error:" + err); expect(err).assertFail(); done(); }); @@ -813,7 +813,7 @@ it('ACTS_ZipFile_3200', 0, async function (done) { /* * @tc.number: ACTS_ZipFile_3300 * @tc.name: zipFile -* @tc.desc: COMPRESS_STRATEGY_FILTERED,, +* @tc.desc: COMPRESS_STRATEGY_FIXED,, */ it('ACTS_ZipFile_3300', 0, async function (done) { console.log("==================ACTS_ZipFile_3300 start=================="); @@ -822,7 +822,7 @@ it('ACTS_ZipFile_3300', 0, async function (done) { var unzipdir = dir + "/ACTS_ZipFile_3300"; var unzipresultfile = unzipdir + "/ACTS_ZipFile_3300.txt"; var options = {}; - options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FILTERED; + options.strategy = zlib.CompressStrategy.COMPRESS_STRATEGY_FIXED; var fd = fileio.openSync(path, 0o100 | 0o2, 0o666); fileio.write(fd, infos).then(function (number) { console.info("ACTS_ZipFile_3300 write data to file successfully:" + number); @@ -873,7 +873,7 @@ it('ACTS_ZipFile_3300', 0, async function (done) { /* * @tc.number: ACTS_ZipFile_3500 * @tc.name: zipFile -* @tc.desc: FLUSH_TYPE_NO_FLUSH,, +* @tc.desc: INPUT_FILE_NOT_EXIST,, */ it('ACTS_ZipFile_3500', 0, async function (done) { console.log("==================ACTS_ZipFile_3500 start=================="); @@ -905,7 +905,7 @@ it('ACTS_ZipFile_3500', 0, async function (done) { /* * @tc.number: ACTS_ZipFile_3600 * @tc.name: zipFile -* @tc.desc: FLUSH_TYPE_NO_FLUSH,, +* @tc.desc: INPUT_FILE_NULL,, */ it('ACTS_ZipFile_3600', 0, async function (done) { console.log("==================ACTS_ZipFile_3600 start=================="); @@ -936,7 +936,7 @@ it('ACTS_ZipFile_3600', 0, async function (done) { /* * @tc.number: ACTS_ZipFile_4500 * @tc.name: zipFile -* @tc.desc: COMPRESS_STRATEGY_FILTERED,, +* @tc.desc: COMPRESS_STRATEGY_FILTERED_CALLBACK,, */ it('ACTS_ZipFile_4500', 0, async function (done) { console.log("==================ACTS_ZipFile_4500 start=================="); @@ -975,7 +975,7 @@ it('ACTS_ZipFile_4500', 0, async function (done) { done(); }); }).catch((err) => { - console.log("zipFile fail: " + err); + console.log("ACTS_ZipFile_4500 zipFile fail: " + err); expect(err).assertFail(); done(); }) @@ -990,7 +990,7 @@ it('ACTS_ZipFile_4500', 0, async function (done) { /* * @tc.number: ACTS_ZipFile_4900 * @tc.name: zipFile -* @tc.desc: COMPRESS_STRATEGY_FILTERED, +* @tc.desc: COMPRESS_STRATEGY_FILTERED_PROMISE, */ it('ACTS_ZipFile_4900', 0, async function (done) { console.log("==================ACTS_ZipFile_4900 start=================="); @@ -1019,7 +1019,7 @@ it('ACTS_ZipFile_4900', 0, async function (done) { expect(data).assertEqual(zlib.ErrorCode.ERROR_CODE_OK); done(); }).catch(err => { - console.log("unzipFile fail: " + err); + console.log("ACTS_ZipFile_4900 err: " + err); expect(err).assertFail(); done(); }) @@ -1029,7 +1029,7 @@ it('ACTS_ZipFile_4900', 0, async function (done) { done(); }); }).catch(err => { - console.log("zipFile fail: " + err); + console.log("ACTS_ZipFile_4900 zipFile fail: " + err); expect(err).assertFail(); done(); })