diff --git a/aafwk/aafwk_standard/BUILD.gn b/aafwk/aafwk_standard/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2726a95eaddd4e1ea2bae6649bbf7e368d4eea17 --- /dev/null +++ b/aafwk/aafwk_standard/BUILD.gn @@ -0,0 +1,26 @@ +# 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("//build/ohos_var.gni") + +group("aafwk_standard") { + testonly = true + if (is_standard_system) { + deps = [ + "abilitymanager:ActsAbilityManagerTest", + "context:ActsContextTest", + "featureability:ActsFeatureAbilityTest", + "want:ActsSetWantTest", + ] + } +} diff --git a/aafwk/aafwk_standard/abilitymanager/BUILD.gn b/aafwk/aafwk_standard/abilitymanager/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..1eef0208a4c38bac3ab5cbebc19498846a37b9e2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/BUILD.gn @@ -0,0 +1,28 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAbilityManagerTest") { + test_hap_name = "ActsAbilityManagerTest" + hap_source_path = "hap/sceneTestOne.hap" + hap_source_path = "hap/sceneTestTwo.hap" + hap_source_path = "hap/sceneTestThree.hap" + hap_source_path = "hap/sceneTestFour.hap" + hap_source_path = "hap/sceneTestFive.hap" + hap_source_path = "hap/sceneCallbackTestOne.hap" + hap_source_path = "hap/sceneCallbackTestTwo.hap" + hap_source_path = "hap/sceneCallbackTestThree.hap" + hap_source_path = "hap/sceneCallbackTestFour.hap" + hap_source_path = "hap/sceneCallbackTestFive.hap" +} diff --git a/aafwk/aafwk_standard/abilitymanager/Test.json b/aafwk/aafwk_standard/abilitymanager/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a66d99d7f1053847908cb526b7abf7424804e960 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "21600000", + "package": "ohos.acts.aafwk.ability", + "shell-timeout": "21600000" + }, + "kits": [ + { + "test-file-name": [ + "AbilityDemo.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackFive.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackFive.hap new file mode 100644 index 0000000000000000000000000000000000000000..2be1fc91c5bcb3a1f00ce5c6efada8843b030759 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackFive.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackFour.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackFour.hap new file mode 100644 index 0000000000000000000000000000000000000000..104ae817cebf24578831c02aaed7af0361bc443e Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackFour.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackOne.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackOne.hap new file mode 100644 index 0000000000000000000000000000000000000000..d75b19f8ae90c013f7388e5aa0029b5922f935cf Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackOne.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackThree.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackThree.hap new file mode 100644 index 0000000000000000000000000000000000000000..051fb2a5d6b16d69b4f579e32a3c1340124e1811 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackThree.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackTwo.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackTwo.hap new file mode 100644 index 0000000000000000000000000000000000000000..659a68e226a8e11d440a66f4b292f2e178184df4 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestCallbackTwo.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestFive.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestFive.hap new file mode 100644 index 0000000000000000000000000000000000000000..628859042b65cac6293df6c2d5b1bd5e7bc31c85 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestFive.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestFour.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestFour.hap new file mode 100644 index 0000000000000000000000000000000000000000..c4a3b49dffb9680c4e64685f10e12c4690018f72 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestFour.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestOne.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestOne.hap new file mode 100644 index 0000000000000000000000000000000000000000..c6ec734c47b00bc0132b6064dccdd88b5724deb0 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestOne.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestThree.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestThree.hap new file mode 100644 index 0000000000000000000000000000000000000000..db277c252b7426f200dce2d91405dcd33340d6d2 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestThree.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/hap/sceneTestTwo.hap b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestTwo.hap new file mode 100644 index 0000000000000000000000000000000000000000..2271f68419c3eee411c745ebad5bbd92c759a564 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/hap/sceneTestTwo.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/project/entry/package.json b/aafwk/aafwk_standard/abilitymanager/project/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..25aaa5808a090c1012c6a268dcdeb050567107b4 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.scene001", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.myapplication", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.SceneOneAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..948c9842d2e0783543184a21f39ac77916819cd2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/entry/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,213 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} +describe('scene_test_1', function () { + console.info('----scene_test_1----'); + + it('startlauncher_scene1', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + it('removeMission_01', 0, async function (done) { + var maxnum = 10,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + for (var i = 0; i < data.length; i++) { + if(data[i].baseAbility.bundleName != 'com.example.scene001'&& data[i].topAbility.bundleName != 'com.example.scene001'){ + var info = abilitymanager.removeMission(data[i].id); + console.info('============== removeMission data [' + info + ']' ); + } + } + done(); + }) + it('startAbility_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + it('Acts_Ams_test_0100', 0, async function (done) { + var info = await abilitymanager.getAllRunningProcesses(); + console.info('getAllRunningProcesses data length [' + info.length + ']' ); + console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + done(); + }) + + it('Acts_Ams_test_0300', 0, async function (done) { + var maxnum = 10; + var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' ); + console.info('==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_0500', 0, async function (done) { + var maxnum = 10,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); + console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' ); + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_0700', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMission(result[0].id); + console.info('============== removeMission data [' + info + ']' ); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_1100', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.moveMissionToTop(result[0].id); + console.info('============== moveMissionToTop data [' + info + ']' ); + expect(info).assertEqual(0); + done(); + }) + + it('Acts_Ams_test_1300', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMissions([result[0].id]); + console.info('============== removeMissions data [' + info + ']' ); + expect(info).assertLarger(0); + done(); + }) + + + it('Acts_Ams_test_0900', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + console.info('============== clearMissions data [' + info + ']' ); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_1500', 0, async function (done) { + var info = await abilitymanager.killProcessesByBundleName('com.ix.simulate.feature'); + console.info('============== killProcessesByBundleName data [' + info + ']' ); + expect(info).assertEqual(0); + done(); + }) + + it('clearMissions_01', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + done(); + }) + +}) + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ea7b6453a003e7a176ebc9f6eb68e87d440ebb33 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.callbackscene005", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenecallbacktestfive", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenecallbacktestfive", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneFiveCallbackAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..eb0eef5bf92179fd90a05faa041c102d6df1e57d --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfive/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,294 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} + +describe('scene_callback_test_5', function () { + console.info('----scene_callback_test_5----'); + + it('startlauncher_callbackscene5_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('removeMission_callback_05', 0, async function (done) { + var maxnum = 10,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag, + (info) => { + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) ); + for (var i = 0; i < info.length; i++) { + if(info[i].baseAbility.bundleName != 'com.example.callbackscene005'&& info[i].topAbility.bundleName != 'com.example.callbackscene005'){ + abilitymanager.removeMission(info[i].id, + (info) => { + console.info('============== removeMission data [' + info + ']' ); + }); + } + } + done(); + }) + }) + + it('startAbility_callbackscene5_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('startAbility_callbackscene5_02', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('startAbility_callbackscene5_03', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilitySed", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('Acts_Ams_test_6600', 0, async function (done) { + abilitymanager.getAllRunningProcesses( + (error,info) => { + console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' ); + console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + expect(info[i].pkgList.length).assertEqual(0); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + }); + done(); + }) + + it('Acts_Ams_test_7000', 0, async function (done) { + var maxnum = 10,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag, + (error,data) => { + console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + data.length + ']' ); + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + + it('Acts_Ams_test_6800', 0, async function (done) { + var maxnum = 10; + abilitymanager.queryRunningAbilityMissionInfos(maxnum, + (error,data) => { + console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + data.length + ']' ); + console.info('==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + + it('Acts_Ams_test_7200', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMission(result[1].id, + (error,info) => { + console.info('============== removeMission error.code:' + error.code +', data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + }); + done(); + }) + + it('Acts_Ams_test_7600', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.moveMissionToTop(result[0].id, + (error,info) => { + console.info('============== moveMissionToTop error.code:' + error.code + ',data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + }); + done(); + }) + + it('Acts_Ams_test_7800', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMissions([result[0].id], + (error,info) => { + console.info('============== removeMissions error.code :' + error.code + ',data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_7400', 0, async function (done) { + abilitymanager.clearMissions( + (error,info) => { + console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_8000', 0, async function (done) { + abilitymanager.killProcessesByBundleName('com.ix.verify.io', + (error,info) => { + console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + }); + done(); + }) + + it('startlauncher_callbackscene5_02', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('clearMissions_callback_05', 0, async function (done) { + abilitymanager.clearMissions( + (info) => { + console.info('============== clearMissions data [' + info + ']' ); + }); + done(); + }) +}) diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a7f5e4ae68688d523fb2db15a1d4fa220dec69b6 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.callbackscene004", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenecallbacktestfour", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenecallbacktestfour", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneFourCallbackAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7620e92d42208d4917f0b9c040358f8027c44354 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestfour/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,322 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} +describe('scene_callback_test_4', function () { + console.info('----scene_callback_test_4----'); + + it('startlauncher_callbackscene4_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('removeMission_callback_04', 0, async function (done) { + var maxnum = 20,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag, + (info) => { + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) ); + for (var i = 0; i < info.length; i++) { + if(info[i].baseAbility.bundleName != 'com.example.callbackscene004'&& info[i].topAbility.bundleName != 'com.example.callbackscene004'){ + abilitymanager.removeMission(info[i].id, + (info) => { + console.info('============== removeMission data [' + info + ']' ); + }); + } + } + done(); + }) + }) + + it('startAbility_callbackscene4_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('startAbility_callbackscene4_02', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('startAbility_callbackscene4_03', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.act", + abilityName: "com.example.VerifyActThirdAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('startAbility_callbackscene4_04', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.entry", + abilityName: "com.example.SimulateEntryAbilityFir", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('Acts_Ams_test_5000', 0, async function (done) { + abilitymanager.getAllRunningProcesses( + (error,info) => { + console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' ); + console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + expect(info[i].pkgList.length).assertEqual(0); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + }); + done(); + }) + + it('Acts_Ams_test_5400', 0, async function (done) { + var maxnum = 100,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag, + (error,data) => { + console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + data.length + ']' ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + console.info('queryRecentAbilityMissionInfos id: ' + data[i].id + ' baseAbility.deviceId: ' + data[i].baseAbility.deviceId + + ' baseAbility.bundleName: ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: ' + data[i].baseAbility.abilityName + + ' topAbility.deviceId: ' + data[i].topAbility.deviceId + ' topAbility.bundleName: ' + data[i].topAbility.bundleName + + ' topAbility.abilityName: ' + data[i].topAbility.abilityName + ' missionDescription.label: ' + data[i].missionDescription.label + + ' missionDescription.iconPath: ' + data[i].missionDescription.iconPath); + + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + + it('Acts_Ams_test_5200', 0, async function (done) { + var maxnum = 30; + abilitymanager.queryRunningAbilityMissionInfos(maxnum, + (error,data) => { + console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + data.length + ']' ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + console.info('queryRunningAbilityMissionInfos id: ' + data[i].id + ' baseAbility.deviceId: ' + data[i].baseAbility.deviceId + + ' baseAbility.bundleName: ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: ' + data[i].baseAbility.abilityName + + ' topAbility.deviceId: ' + data[i].topAbility.deviceId + ' topAbility.bundleName: ' + data[i].topAbility.bundleName + + ' topAbility.abilityName: ' + data[i].topAbility.abilityName + ' missionDescription.label: ' + data[i].missionDescription.label + + ' missionDescription.iconPath: ' + data[i].missionDescription.iconPath); + + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + + it('Acts_Ams_test_5600', 0, async function (done) { + var maxnum = 30; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMission(result[0].id, + (error,info) => { + console.info('============== removeMission error.code:' + error.code +', data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_6000', 0, async function (done) { + var maxnum = 30; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.moveMissionToTop(result[0].id, + (error,info) => { + console.info('============== moveMissionToTop error.code:' + error.code + ',data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + }); + done(); + }) + + it('Acts_Ams_test_5800', 0, async function (done) { + abilitymanager.clearMissions( + (error,info) => { + console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_6400', 0, async function (done) { + abilitymanager.killProcessesByBundleName('xxxxxxxxx', + (error,info) => { + console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + }); + done(); + }) + + it('Acts_Ams_test_6200', 0, async function (done) { + var maxnum = 30; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMissions([result[1].id,result[2].id], + (error,info) => { + console.info('============== removeMissions error.code :' + error.code + ',data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + }); + done(); + }) + + it('startlauncher_callbackscene4_02', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('clearMissions_callback_04', 0, async function (done) { + abilitymanager.clearMissions( + (info) => { + console.info('============== clearMissions data [' + info + ']' ); + }); + done(); + }) +}) diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0af9eb9a51acd6404136c634b95a737103e2fc89 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.callbackscene001", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenecallbacktestone", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenecallbacktestone", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneOneCallbackAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7c4ab5e85d685d7dfb449b6ddd2cb66379972d9a --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestone/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,231 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} +describe('scene_callback_test_1', function () { + console.info('----scene_callback_test_1----'); + + it('startlauncher_callback_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('removeMission_callback_01', 0, async function (done) { + var maxnum = 10,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag, + (info) => { + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) ); + for (var i = 0; i < info.length; i++) { + if(info[i].baseAbility.bundleName != 'com.example.callbackscene001'&& info[i].topAbility.bundleName != 'com.example.callbackscene001'){ + abilitymanager.removeMission(info[i].id, + (info) => { + console.info('============== removeMission data [' + info + ']' ); + }); + } + } + done(); + }) + }) + + it('startability_callback_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('Acts_Ams_test_0200', 0, async function (done) { + abilitymanager.getAllRunningProcesses( + (error,info) => { + console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' ); + console.info('==================== getAllRunningProcesses data ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + }); + done(); + }) + + it('Acts_Ams_test_0400', 0, async function (done) { + var maxnum = 10; + abilitymanager.queryRunningAbilityMissionInfos(maxnum, + (error,info) => { + console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' ); + console.info('==================== queryRunningAbilityMissionInfos info ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof (info[i].id)).assertEqual("number"); + expect(info[i].id).assertLarger(0); + + expect(typeof (info[i].baseAbility)).assertEqual("object"); + expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string"); + expect(info[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string"); + expect(info[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].topAbility)).assertEqual("object"); + expect(typeof (info[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].topAbility.bundleName)).assertEqual("string"); + expect(info[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].topAbility.abilityName)).assertEqual("string"); + expect(info[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].missionDescription)).assertEqual("object"); + expect(typeof (info[i].missionDescription.label)).assertEqual("string"); + expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + + it('Acts_Ams_test_0600', 0, async function (done) { + var maxnum = 10,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag, + (error,info) => { + console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' ); + console.info('==================== queryRecentAbilityMissionInfos info ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof (info[i].id)).assertEqual("number"); + expect(info[i].id).assertLarger(0); + + expect(typeof (info[i].baseAbility)).assertEqual("object"); + expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string"); + expect(info[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string"); + expect(info[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].topAbility)).assertEqual("object"); + expect(typeof (info[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].topAbility.bundleName)).assertEqual("string"); + expect(info[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].topAbility.abilityName)).assertEqual("string"); + expect(info[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].missionDescription)).assertEqual("object"); + expect(typeof (info[i].missionDescription.label)).assertEqual("string"); + expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + it('Acts_Ams_test_0800', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMission(result[0].id, + (error,info) => { + console.info('============== removeMission error.code:' + error.code +', info [' + info + ']' ); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_1200', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.moveMissionToTop(result[0].id, + (error,info) => { + console.info('============== moveMissionToTop error.code:' + error.code + ',info [' + info + ']' ); + expect(info).assertEqual(0); + }); + done(); + }) + it('Acts_Ams_test_1400', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMissions([result[0].id], + (error,info) => { + console.info('============== removeMissions error.code :' + error.code + ',info [' + info + ']' ); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_1000', 0, async function (done) { + abilitymanager.clearMissions( + (error,info) => { + console.info('============== clearMissions error.code ' + error.code + ',info [' + info + ']' ); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_1600', 0, async function (done) { + abilitymanager.killProcessesByBundleName('com.ix.simulate.feature', + (error,info) => { + console.info('============== killProcessesByBundleName error.code: ' + error.code + ',info [' + info + ']' ); + expect(info).assertEqual(0); + }); + done(); + + }) + + it('ClearMinssion_callback_01', 0, async function (done) { + abilitymanager.clearMissions( + (info) => { + console.info('============== clearMissions data [' + info + ']' ); + }); + done(); + }) +}) + + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ef677a2abe96d8d62fef266bcabd5decafb067be --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.callbackscene003", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenecallbacktestthree", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenecallbacktestthree", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneThreeCallbackAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bba3b34b1a3bb30cdc936c861ef43ba1e0eff012 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktestthree/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,289 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} +describe('scene_callback_test_3', function () { + console.info('----scene_callback_test_3----'); + + it('startlauncher_callbackscene3_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('removeMission_callback_03', 0, async function (done) { + var maxnum = 20,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag, + (info) => { + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) ); + for (var i = 0; i < info.length; i++) { + if(info[i].baseAbility.bundleName != 'com.example.callbackscene003'&& info[i].topAbility.bundleName != 'com.example.callbackscene003'){ + abilitymanager.removeMission(info[i].id, + (info) => { + console.info('============== removeMission data [' + info + ']' ); + }); + } + } + done(); + }) + }) + + it('startability_callback3_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('startability_callback3_02', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('startability_callback3_03', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('Acts_Ams_test_3400', 0, async function (done) { + abilitymanager.getAllRunningProcesses( + (error,info) => { + console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' ); + console.info('Acts_Ams_test_3400==================== getAllRunningProcesses data ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + }); + done(); + }) + + it('Acts_Ams_test_3600', 0, async function (done) { + var maxnum = 20; + abilitymanager.queryRunningAbilityMissionInfos(maxnum, + (error,info) => { + console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' ); + console.info('Acts_Ams_test_3600==================== queryRunningAbilityMissionInfos info ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof (info[i].id)).assertEqual("number"); + expect(info[i].id).assertLarger(0); + + expect(typeof (info[i].baseAbility)).assertEqual("object"); + expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string"); + expect(info[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string"); + expect(info[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].topAbility)).assertEqual("object"); + expect(typeof (info[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].topAbility.bundleName)).assertEqual("string"); + expect(info[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].topAbility.abilityName)).assertEqual("string"); + expect(info[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].missionDescription)).assertEqual("object"); + expect(typeof (info[i].missionDescription.label)).assertEqual("string"); + expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + it('Acts_Ams_test_3800', 0, async function (done) { + var maxnum = 20,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag, + (error,info) => { + console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' ); + console.info('Acts_Ams_test_3800==================== queryRecentAbilityMissionInfos info ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof (info[i].id)).assertEqual("number"); + expect(info[i].id).assertLarger(0); + + expect(typeof (info[i].baseAbility)).assertEqual("object"); + expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string"); + expect(info[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string"); + expect(info[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].topAbility)).assertEqual("object"); + expect(typeof (info[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].topAbility.bundleName)).assertEqual("string"); + expect(info[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].topAbility.abilityName)).assertEqual("string"); + expect(info[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].missionDescription)).assertEqual("object"); + expect(typeof (info[i].missionDescription.label)).assertEqual("string"); + expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + + it('Acts_Ams_test_4000', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMission(result[1].id, + (error,info) => { + console.info('============== removeMission error.code:' + error.code +', data [' + info + ']' ); + expect(info).assertEqual(0); + }); + done(); + }) + + it('Acts_Ams_test_4400', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.moveMissionToTop(result[0].id, + (error,info) => { + console.info('============== moveMissionToTop error.code:' + error.code + ',data [' + info + ']' ); + expect(info).assertEqual(0); + }); + done(); + }) + + it('Acts_Ams_test_4600', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMissions([result[0].id], + (error,info) => { + console.info('============== removeMissions error.code :' + error.code + ',data [' + info + ']' ); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_4200', 0, async function (done) { + abilitymanager.clearMissions( + (error,info) => { + console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' ); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_4800', 0, async function (done) { + abilitymanager.killProcessesByBundleName('xxxxxxxxxxx', + (error,info) => { + console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' ); + expect(info).assertEqual(0); + }); + done(); + + }) + + it('startlauncher_callbackscene3_02', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('clearMissions_callback_03', 0, async function (done) { + abilitymanager.clearMissions( + (info) => { + console.info('============== clearMissions data [' + info + ']' ); + }); + done(); + }) +}) + + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..3c7d0f037f314e41d106f6cc645af2417c348630 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.callbackscene002", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenecallbacktesttwo", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenecallbacktesttwo", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneTwoCallbackAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..0a943e5b0ef7fc4b05d1ea6c4b9283370cfdb59b --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenecallbacktesttwo/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,270 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} +describe('scene_callback_test_2', function () { + console.info('----scene_callback_test_2----'); + + it('startlauncher_callbackscene2_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('removeMission_callback_02', 0, async function (done) { + var maxnum = 20,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag, + (info) => { + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(info) ); + for (var i = 0; i < info.length; i++) { + if(info[i].baseAbility.bundleName != 'com.example.callbackscene002'&& info[i].topAbility.bundleName != 'com.example.callbackscene002'){ + abilitymanager.removeMission(info[i].id, + (info) => { + console.info('============== removeMission data [' + info + ']' ); + }); + } + } + done(); + }) + }) + + it('startability_callback2_01', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('startability_callback2_02', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('Acts_Ams_test_1800', 0, async function (done) { + abilitymanager.getAllRunningProcesses( + (error,info) => { + console.info('getAllRunningProcesses error.code ' + error.code + ', data length [' + info.length + ']' ); + console.info('==================== getAllRunningProcesses data ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + }); + done(); + }) + + it('Acts_Ams_test_2000', 0, async function (done) { + var maxnum = 20; + abilitymanager.queryRunningAbilityMissionInfos(maxnum, + (error,info) => { + console.info('queryRunningAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' ); + console.info('==================== queryRunningAbilityMissionInfos info ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof (info[i].id)).assertEqual("number"); + expect(info[i].id).assertLarger(0); + + expect(typeof (info[i].baseAbility)).assertEqual("object"); + expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string"); + expect(info[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string"); + expect(info[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].topAbility)).assertEqual("object"); + expect(typeof (info[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].topAbility.bundleName)).assertEqual("string"); + expect(info[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].topAbility.abilityName)).assertEqual("string"); + expect(info[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].missionDescription)).assertEqual("object"); + expect(typeof (info[i].missionDescription.label)).assertEqual("string"); + expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + it('Acts_Ams_test_2200', 0, async function (done) { + var maxnum = 20,flag = 1; + abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag, + (error,info) => { + console.info('queryRecentAbilityMissionInfos error.code :' + error.code + ',data length [' + info.length + ']' ); + console.info('==================== queryRecentAbilityMissionInfos info ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof (info[i].id)).assertEqual("number"); + expect(info[i].id).assertLarger(0); + + expect(typeof (info[i].baseAbility)).assertEqual("object"); + expect(typeof (info[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].baseAbility.bundleName)).assertEqual("string"); + expect(info[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].baseAbility.abilityName)).assertEqual("string"); + expect(info[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].topAbility)).assertEqual("object"); + expect(typeof (info[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (info[i].topAbility.bundleName)).assertEqual("string"); + expect(info[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (info[i].topAbility.abilityName)).assertEqual("string"); + expect(info[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (info[i].missionDescription)).assertEqual("object"); + expect(typeof (info[i].missionDescription.label)).assertEqual("string"); + expect(typeof (info[i].missionDescription.iconPath)).assertEqual("string"); + } + }); + done(); + }) + + it('Acts_Ams_test_2400', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMission(result[1].id, + (error,info) => { + console.info('============== removeMission error.code:' + error.code +', data [' + info + ']' ); + expect(info).assertEqual(0); + }); + done(); + }) + + it('Acts_Ams_test_2800', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.moveMissionToTop(result[0].id, + (error,info) => { + console.info('============== moveMissionToTop error.code:' + error.code + ',data [' + info + ']' ); + expect(info).assertEqual(0); + }); + done(); + }) + + it('Acts_Ams_test_3000', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + abilitymanager.removeMissions([result[0].id], + (error,info) => { + console.info('============== removeMissions error.code :' + error.code + ',data [' + info + ']' ); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_2600', 0, async function (done) { + abilitymanager.clearMissions( + (error,info) => { + console.info('============== clearMissions error.code ' + error.code + ',data [' + info + ']' ); + expect(info).assertLarger(0); + }); + done(); + }) + + it('Acts_Ams_test_3200', 0, async function (done) { + abilitymanager.killProcessesByBundleName('XXXXXXXXXXXX', + (error,info) => { + console.info('============== killProcessesByBundleName error.code: ' + error.code + ',data [' + info + ']' ); + expect(info).assertEqual(0); + }); + done(); + + }) + + it('startlauncher_callbackscene2_02', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + parameters: + {}, + }, + }, + (err, data) => { + done(); + } + ); + }) + + it('clearMissions_callback_02', 0, async function (done) { + abilitymanager.clearMissions( + (info) => { + console.info('============== clearMissions data [' + info + ']' ); + }); + done(); + }) +}) + + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..97ead60153040787879019e6fca97eb56e300bcf --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.scene005", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenetestfive", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenetestfive", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneFiveAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..449c91b8b175ac6c20b2cc4b7b42308c2e95bb79 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfive/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,288 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} + +describe('scene_test_5', function () { + console.info('----scene_test_5----'); + + it('startlauncher_scene5_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('removeMission_05', 0, async function (done) { + var maxnum = 10,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + for (var i = 0; i < data.length; i++) { + if(data[i].baseAbility.bundleName != 'com.example.scene005'&& data[i].topAbility.bundleName != 'com.example.scene005'){ + var info = abilitymanager.removeMission(data[i].id); + console.info('============== removeMission data [' + info + ']' ); + } + } + done(); + }) + + it('startAbility_scene5_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('startAbility_scene5_02', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('startAbility_scene5_03', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilitySed", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('Acts_Ams_test_6500', 0, async function (done) { + var info = await abilitymanager.getAllRunningProcesses(); + console.info('getAllRunningProcesses data length [' + info.length + ']' ); + console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + expect(info[i].pkgList.length).assertEqual(0); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + done(); + }) + + it('Acts_Ams_test_6900', 0, async function (done) { + var maxnum = 10,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); + console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' ); + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_6700', 0, async function (done) { + var maxnum = 10; + var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' ); + console.info('==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_7100', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMission(result[1].id); + console.info('============== removeMission data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + done(); + }) + + it('Acts_Ams_test_7500', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.moveMissionToTop(result[0].id); + console.info('============== moveMissionToTop data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + done(); + }) + + it('Acts_Ams_test_7700', 0, async function (done) { + var maxnum = 10; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMissions([result[0].id]); + console.info('============== removeMissions data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_7300', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + console.info('============== clearMissions data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_7900', 0, async function (done) { + var info = await abilitymanager.killProcessesByBundleName('com.ix.verify.io'); + console.info('============== killProcessesByBundleName data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + done(); + }) + + it('startlauncher_scene5_02', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('ClearMinssion_05', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + console.info('============== clearMissions data [' + info + ']' ); + done(); + }) + +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b2a0bba163a18bd2a5e8f7c4a9122d933a0b0747 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.scene004", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenetestfour", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenetestfour", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneFourAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8325bfcf935c874a49fe762d7ea957c3327e5706 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestfour/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,318 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} +describe('scene_test_4', function () { + console.info('----scene_test_4----'); + + it('startlauncher_scene4_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('removeMission_04', 0, async function (done) { + var maxnum = 20,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + for (var i = 0; i < data.length; i++) { + if(data[i].baseAbility.bundleName != 'com.example.scene004'&& data[i].topAbility.bundleName != 'com.example.scene004'){ + var info = abilitymanager.removeMission(data[i].id); + console.info('============== removeMission data [' + info + ']' ); + } + } + done(); + }) + + it('startAbility_scene4_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('startAbility_scene4_02', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('startAbility_scene4_03', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.act", + abilityName: "com.example.VerifyActThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('startAbility_scene4_04', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.entry", + abilityName: "com.example.SimulateEntryAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('Acts_Ams_test_4900', 0, async function (done) { + var info = await abilitymanager.getAllRunningProcesses(); + console.info('getAllRunningProcesses data length [' + info.length + ']' ); + console.info('==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + expect(info[i].pkgList.length).assertEqual(0); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + done(); + }) + + it('Acts_Ams_test_5300', 0, async function (done) { + var maxnum = 100,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); + console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + console.info('queryRunningAbilityMissionInfos id: ' + data[i].id + ' baseAbility.deviceId: ' + data[i].baseAbility.deviceId + + ' baseAbility.bundleName: ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: ' + data[i].baseAbility.abilityName + + ' topAbility.deviceId: ' + data[i].topAbility.deviceId + ' topAbility.bundleName: ' + data[i].topAbility.bundleName + + ' topAbility.abilityName: ' + data[i].topAbility.abilityName + ' missionDescription.label: ' + data[i].missionDescription.label + + ' missionDescription.iconPath: ' + data[i].missionDescription.iconPath); + + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_5100', 0, async function (done) { + var maxnum = 30; + var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + console.info('queryRunningAbilityMissionInfos id: ' + data[i].id + ' baseAbility.deviceId: ' + data[i].baseAbility.deviceId + + ' baseAbility.bundleName: ' + data[i].baseAbility.bundleName + ' baseAbility.abilityName: ' + data[i].baseAbility.abilityName + + ' topAbility.deviceId: ' + data[i].topAbility.deviceId + ' topAbility.bundleName: ' + data[i].topAbility.bundleName + + ' topAbility.abilityName: ' + data[i].topAbility.abilityName + ' missionDescription.label: ' + data[i].missionDescription.label + + ' missionDescription.iconPath: ' + data[i].missionDescription.iconPath); + + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_5500', 0, async function (done) { + var maxnum = 30; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMission(result[0].id); + console.info('============== removeMission data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_5900', 0, async function (done) { + var maxnum = 30; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.moveMissionToTop(result[0].id); + console.info('============== moveMissionToTop data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + done(); + }) + + it('Acts_Ams_test_5700', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + console.info('============== clearMissions data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_6300', 0, async function (done) { + var info = await abilitymanager.killProcessesByBundleName('xxxxxxxxxxxx'); + console.info('============== killProcessesByBundleName data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + done(); + }) + + it('Acts_Ams_test_6100', 0, async function (done) { + var maxnum = 30; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMissions([result[1].id,result[2].id]); + console.info('============== removeMissions data [' + info + ']' ); + expect(typeof(info)).assertEqual("number"); + expect(info).assertEqual(0); + done(); + }) + + it('startlauncher_scene4_02', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('ClearMinssion_04', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + console.info('============== clearMissions data [' + info + ']' ); + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b8b011018f79fc607ff225c66e894b8cce241017 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.scene003", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenetestthree", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenetestthree", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneThreeAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4f012dc8fc353ea28261a6ad0e73082e20fd0a03 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetestthree/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,276 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} +describe('scene_test_3', function () { + console.info('----scene_test_3----'); + + it('startlauncher_scene3_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('removeMission_03', 0, async function (done) { + var maxnum = 20,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag); + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + for (var i = 0; i < data.length; i++) { + if(data[i].baseAbility.bundleName != 'com.example.scene003'&& data[i].topAbility.bundleName != 'com.example.scene003'){ + var info = abilitymanager.removeMission(data[i].id); + console.info('============== removeMission data [' + info + ']' ); + } + } + done(); + }) + + it('startAbility_scene3_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + it('startAbility_scene3_02', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + it('startAbility_scene3_03', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('Acts_Ams_test_3300', 0, async function (done) { + var info = await abilitymanager.getAllRunningProcesses(); + console.info('getAllRunningProcesses data length [' + info.length + ']' ); + console.info('Acts_Ams_test_3300==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + done(); + }) + + it('Acts_Ams_test_3500', 0, async function (done) { + var maxnum = 20; + var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' ); + console.info('Acts_Ams_test_3500==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_3700', 0, async function (done) { + var maxnum = 20,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); + console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' ); + console.info('Acts_Ams_test_3700==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_3900', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMission(result[1].id); + console.info('Acts_Ams_test_3900============== removeMission data [' + info + ']' ); + expect(info).assertEqual(0); + done(); + }) + it('Acts_Ams_test_4300', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.moveMissionToTop(result[0].id); + console.info('Acts_Ams_test_4300============== moveMissionToTop data [' + info + ']' ); + expect(info).assertEqual(0); + done(); + }) + it('Acts_Ams_test_4500', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMissions([result[0].id]); + console.info('Acts_Ams_test_4500============== removeMissions data [' + info + ']' ); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_4100', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + console.info('Acts_Ams_test_4100============== clearMissions data [' + info + ']' ); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_4700', 0, async function (done) { + var info = await abilitymanager.killProcessesByBundleName('XXXXXXXX'); + console.info('Acts_Ams_test_4700============== killProcessesByBundleName data [' + info + ']' ); + expect(info).assertEqual(0); + done(); + }) + + it('startlauncher_scene3_02', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('clearMissions_03', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + done(); + }) +}) + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/package.json b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d27f161bd5c36bd0a0a9b1456ec08e3096e847e9 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/config.json @@ -0,0 +1,53 @@ +{ + "app": { + "bundleName": "com.example.scene002", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.scenetesttwo", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "scenetesttwo", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SceneTwoAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..19d1586cf5cb47afb140c2ae35fdeba878b2d22c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/default/pages/index/index.js @@ -0,0 +1,33 @@ +import file from '@system.file' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + console.info('onReady'); + }, +} + diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/test/List.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e79234a7e0573b56991a594d481c335ae2d3e9b2 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./MangerAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/test/MangerAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a58d8e02103efad67b02042e07597c1bc4471f7f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/project/scenetesttwo/src/main/js/test/MangerAbilityJsunit.test.js @@ -0,0 +1,260 @@ +import featureAbility from '@ohos.ability.featureability' +import abilitymanager from '@ohos.app.abilitymanager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +var WeightReasonCode = { + REASON_UNKNOWN : 0, + WEIGHT_FOREGROUND : 100, + WEIGHT_FOREGROUND_SERVICE : 125, + WEIGHT_VISIBLE : 200, + WEIGHT_PERCEPTIBLE : 230, + WEIGHT_SERVICE : 300, + WEIGHT_TOP_SLEEPING : 325, + WEIGHT_CANT_SAVE_STATE : 350, + WEIGHT_CACHED : 400, + WEIGHT_GONE : 1000 +} +describe('scene_test_2', function () { + console.info('----scene_test_2----'); + + it('startlauncher_scene2_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('removeMission_02', 0, async function (done) { + var maxnum = 20,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum, flag); + console.info('==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + for (var i = 0; i < data.length; i++) { + if(data[i].baseAbility.bundleName != 'com.example.scene002'&& data[i].topAbility.bundleName != 'com.example.scene002'){ + var info = abilitymanager.removeMission(data[i].id); + console.info('============== removeMission data [' + info + ']' ); + } + } + done(); + }) + + it('startAbility_scene2_01', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.verify.io", + abilityName: "com.example.VerifyIoThirdAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('startAbility_scene2_02', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ix.simulate.feature", + abilityName: "com.example.SimulateFeatureAbilityFir", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('Acts_Ams_test_1700', 0, async function (done) { + var info = await abilitymanager.getAllRunningProcesses(); + console.info('getAllRunningProcesses data length [' + info.length + ']' ); + console.info('Acts_Ams_test_1700==================== getAllRunningProcesses JSON String: ' + JSON.stringify(info) ); + expect(Array.isArray(info)).assertEqual(true); + for (var i = 0; i < info.length; i++) { + expect(typeof(info[i].pid)).assertEqual("number"); + expect(info[i].pid).assertLarger(0); + + expect(typeof(info[i].processName)).assertEqual("string"); + expect(info[i].processName.length).assertLarger(0); + + expect(Array.isArray(info[i].pkgList)).assertEqual(true); + + expect(typeof(info[i].uid)).assertEqual("number"); + expect(info[i].uid).assertLarger(0); + + expect(typeof(info[i].lastMemoryLevel)).assertEqual("number"); + expect(info[i].lastMemoryLevel).assertEqual(-1); + + expect(typeof(info[i].weight)).assertEqual("number"); + expect(info[i].weight).assertEqual(-1); + + expect(typeof(info[i].weightReasonCode)).assertEqual("number"); + expect(info[i].weightReasonCode).assertEqual(WeightReasonCode.REASON_UNKNOWN); + } + done(); + }) + + it('Acts_Ams_test_1900', 0, async function (done) { + var maxnum = 20; + var data = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + console.info('queryRunningAbilityMissionInfos data length [' + data.length + ']' ); + console.info('Acts_Ams_test_1900==================== queryRunningAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_2100', 0, async function (done) { + var maxnum = 20,flag = 1; + var data = await abilitymanager.queryRecentAbilityMissionInfos(maxnum,flag); + console.info(' queryRecentAbilityMissionInfos data length [' + data.length + ']' ); + console.info('Acts_Ams_test_2100==================== queryRecentAbilityMissionInfos data ' + JSON.stringify(data) ); + expect(Array.isArray(data)).assertEqual(true); + for (var i = 0; i < data.length; i++) { + expect(typeof (data[i].id)).assertEqual("number"); + expect(data[i].id).assertLarger(0); + + expect(typeof (data[i].baseAbility)).assertEqual("object"); + expect(typeof (data[i].baseAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].baseAbility.bundleName)).assertEqual("string"); + expect(data[i].baseAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].baseAbility.abilityName)).assertEqual("string"); + expect(data[i].baseAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].topAbility)).assertEqual("object"); + expect(typeof (data[i].topAbility.deviceId)).assertEqual("string"); + expect(typeof (data[i].topAbility.bundleName)).assertEqual("string"); + expect(data[i].topAbility.bundleName.length).assertLarger(0); + expect(typeof (data[i].topAbility.abilityName)).assertEqual("string"); + expect(data[i].topAbility.abilityName.length).assertLarger(0); + + expect(typeof (data[i].missionDescription)).assertEqual("object"); + expect(typeof (data[i].missionDescription.label)).assertEqual("string"); + expect(typeof (data[i].missionDescription.iconPath)).assertEqual("string"); + } + done(); + }) + + it('Acts_Ams_test_2300', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMission(result[1].id); + console.info('Acts_Ams_test_2300============== removeMission data [' + info + ']' ); + expect(info).assertEqual(0); + done(); + }) + + it('Acts_Ams_test_2700', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.moveMissionToTop(result[0].id); + console.info('Acts_Ams_test_2700============== moveMissionToTop data [' + info + ']' ); + expect(info).assertEqual(0); + done(); + }) + + it('Acts_Ams_test_2900', 0, async function (done) { + var maxnum = 20; + var result = await abilitymanager.queryRunningAbilityMissionInfos(maxnum); + var info = await abilitymanager.removeMissions([result[0].id]); + console.info('Acts_Ams_test_2900============== removeMissions data [' + info + ']' ); + expect(info).assertLarger(0); + done(); + }) + + + it('Acts_Ams_test_2500', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + console.info('Acts_Ams_test_2500============== clearMissions data [' + info + ']' ); + expect(info).assertLarger(0); + done(); + }) + + it('Acts_Ams_test_3100', 0, async function (done) { + var info = await abilitymanager.killProcessesByBundleName('XXXXXXXXXXXX'); + console.info('Acts_Ams_test_3100============== killProcessesByBundleName data [' + info + ']' ); + expect(info).assertEqual(0); + done(); + }) + + it('startlauncher_scene2_02', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "", + bundleName: "com.ohos.launcher", + abilityName: "com.ohos.launcher.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + {}, + parameters: + {}, + }, + }, + ); + done(); + }) + + it('clearMissions_02', 0, async function (done) { + var info = await abilitymanager.clearMissions(); + console.info('============== clearMissions data [' + info + ']' ); + done(); + }) +}) + diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateEAbility.hap b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateEAbility.hap new file mode 100644 index 0000000000000000000000000000000000000000..93be72901e86de8ba19d8cd5dbd267e0c629d8fe Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateEAbility.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateFAbilityFir.hap b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateFAbilityFir.hap new file mode 100644 index 0000000000000000000000000000000000000000..19a64daa2d291aa5e99fe18dedf7edc1ea1bc7a1 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateFAbilityFir.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateFAbilitySed.hap b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateFAbilitySed.hap new file mode 100644 index 0000000000000000000000000000000000000000..7e61645390393c80cdcc9fd5dbb042a78b6a3576 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/simulateFAbilitySed.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/verifyAAbility.hap b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/verifyAAbility.hap new file mode 100644 index 0000000000000000000000000000000000000000..6520337bd0cf220764190610aef7938da3d394c3 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/verifyAAbility.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/verifyIAbility.hap b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/verifyIAbility.hap new file mode 100644 index 0000000000000000000000000000000000000000..a9099dc5f6100e2e8f3031ad40f4761c4bac9437 Binary files /dev/null and b/aafwk/aafwk_standard/abilitymanager/sceneProject/hap/verifyIAbility.hap differ diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/package.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..a5a2cd66855e9c1eb6f0838d4a66999551a5e184 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.ix.simulate.entry", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.simulateeability", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "simulateEAbility", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SimulateEntryAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8a7eec535cfd04ee1c54e23dc2d1074f889d2763 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateEAbility/src/main/js/default/pages/index/index.js @@ -0,0 +1,8 @@ +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/package.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..4bafa42e667bbaed8c242001efb0ae17b21677cb --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.ix.simulate.feature", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.simulatefabilityfir", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "simulateFAbilityFir", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SimulateFeatureAbilityFir", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8a7eec535cfd04ee1c54e23dc2d1074f889d2763 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilityFir/src/main/js/default/pages/index/index.js @@ -0,0 +1,8 @@ +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/package.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..4b62567f2e4d20486b5641d49b535cadf3f90762 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.ix.simulate.feature", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.simulatefabilitysed", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "simulateFAbilitySed", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.SimulateFeatureAbilitySed", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8a7eec535cfd04ee1c54e23dc2d1074f889d2763 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/simulateFAbilitySed/src/main/js/default/pages/index/index.js @@ -0,0 +1,8 @@ +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/package.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..27193352ba87e397dee9b434fb1327d3a676c4e4 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.ix.verify.act", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.verifyaability", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "verifyAAbility", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.VerifyActThirdAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8a7eec535cfd04ee1c54e23dc2d1074f889d2763 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyAAbility/src/main/js/default/pages/index/index.js @@ -0,0 +1,8 @@ +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/package.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/config.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..d81a978f0faf88b56c15fab990066a9342134524 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.ix.verify.io", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.verifyiability", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "verifyIAbility", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.VerifyIoThirdAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "singleton" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8a7eec535cfd04ee1c54e23dc2d1074f889d2763 --- /dev/null +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/verifyIAbility/src/main/js/default/pages/index/index.js @@ -0,0 +1,8 @@ +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/aafwk/aafwk_standard/context/BUILD.gn b/aafwk/aafwk_standard/context/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..64efe3c5b85857b39cbf5442552936367b3f0bbb --- /dev/null +++ b/aafwk/aafwk_standard/context/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsContextTest") { + test_hap_name = "ActsContextTest" + hap_source_path = "hap/contextJSUnit.hap" +} diff --git a/aafwk/aafwk_standard/context/Test.json b/aafwk/aafwk_standard/context/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a385abf18c813a62ecda78586dbbea5d79d2fcde --- /dev/null +++ b/aafwk/aafwk_standard/context/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.aafwk.aafwk_standard.context" + }, + "kits": [ + { + "test-file-name": [ + "contextJSUnit.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/context/hap/contextJSUnit.hap.hap b/aafwk/aafwk_standard/context/hap/contextJSUnit.hap.hap new file mode 100644 index 0000000000000000000000000000000000000000..a52842e241ece98947f6edb3c1c5051bbc2c08bf Binary files /dev/null and b/aafwk/aafwk_standard/context/hap/contextJSUnit.hap.hap differ diff --git a/aafwk/aafwk_standard/context/hap/permissionJSUnit.hap b/aafwk/aafwk_standard/context/hap/permissionJSUnit.hap new file mode 100644 index 0000000000000000000000000000000000000000..36d0b63f0a9c7d3d41b069b50cc246281cde3e9e Binary files /dev/null and b/aafwk/aafwk_standard/context/hap/permissionJSUnit.hap differ diff --git a/aafwk/aafwk_standard/context/project/entry/.gitignore b/aafwk/aafwk_standard/context/project/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/aafwk/aafwk_standard/context/project/entry/package.json b/aafwk/aafwk_standard/context/project/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/config.json b/aafwk/aafwk_standard/context/project/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..423023accc82a20b10eca0ed5de4a8e8d0c88bc9 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/config.json @@ -0,0 +1,71 @@ +{ + "app": { + "bundleName": "com.context.test", + "vendor": "example_context", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.context.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "reqPermissions": [ + { + "name": "ohos.permission.CAMERA", + "reason": "reason", + "usedScene": { + "ability": ["ability"], + "when": "when" + } + } + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.context.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..0c57ddeda85d8b65e964156c75261b39ae3f026a --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 测试Context + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e2b0b78ef41da742cff13130784007bf2991b529 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,48 @@ +/* + * 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 app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/js/test/ContextJsunit.test.js b/aafwk/aafwk_standard/context/project/entry/src/main/js/test/ContextJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bf45b568f47850575a5118756e915f2a6b189093 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/js/test/ContextJsunit.test.js @@ -0,0 +1,154 @@ +/* + * 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 featureAbility from '@ohos.ability.featureability' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsContextTest', function () { + // @tc.number: ACTS_VerifySelfPermission_0100 + // @tc.name: verifySelfPermission : Check specific permissions + // @tc.desc: Check the return type of the interface (by Promise) + it('ACTS_VerifySelfPermission_0100', 0, async function (done) { + var context = featureAbility.getContext().then( + data=> { + var promise = data.verifySelfPermission("ohos.permission.CAMERA"); + expect(typeof(promise)).assertEqual("object"); + } + ).catch(error => + console.log("getContext promise::catch : " + error) + ); + expect(typeof(context)).assertEqual("object"); + done(); + }) + + // @tc.number: ACTS_VerifySelfPermission_0200 + // @tc.name: verifySelfPermission : Check the status of the specified permission + // @tc.desc: Check the status of the specified permission and return the authorized status (by Promise) + it('ACTS_VerifySelfPermission_0200', 0, async function (done) { + var context = await featureAbility.getContext(); + var result = await context.verifySelfPermission("ohos.permission.CAMERA"); + expect(result).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_VerifySelfPermission_0300 + // @tc.name: verifySelfPermission : Check the status of the specified permission + // @tc.desc: Check the status of the specified permission and return the unauthorized status (by Promise) + it('ACTS_VerifySelfPermission_0300', 0, async function (done) { + var context = await featureAbility.getContext(); + var result = await context.verifySelfPermission("com.myability.permission.MYPERMISSION_NOT"); + expect(result).assertEqual(-1); + done(); + }) + + // @tc.number: ACTS_VerifySelfPermission_0400 + // @tc.name: verifySelfPermission : Check the status of the specified permission + // @tc.desc: Check the status of the specified permission and return the authorized status (by callback) + it('ACTS_VerifySelfPermission_0400', 0, async function (done) { + var context = featureAbility.getContext( + (errContext, dataContext) => { + var info = dataContext.verifySelfPermission("ohos.permission.CAMERA", + (err, data) => { + expect(data).assertEqual(0); + done(); + } + ); + } + ); + }) + + // @tc.number: ACTS_VerifySelfPermission_0500 + // @tc.name: verifySelfPermission : Check the status of the specified permission + // @tc.desc: Check the status of the specified permission and return the unauthorized status (by callback) + it('ACTS_VerifySelfPermission_0500', 0, async function (done) { + var context = featureAbility.getContext( + (errContext, dataContext) => { + var info = dataContext.verifySelfPermission("com.myability.permission.MYPERMISSION", + (err, data) => { + console.log("ACTS_VerifySelfPermission_0500>>>err=" + err.code); + console.log("ACTS_VerifySelfPermission_0500>>>data=" + data); + expect(err.code).assertEqual(-100); + expect(data).assertEqual(-1); + done(); + } + ); + } + ); + }) + + // @tc.number: ACTS_GetBundleName_0100 + // @tc.name: getBundleName : Query return value type + // @tc.desc: The class of the test return value is made Promise + it('ACTS_GetBundleName_0100', 0, async function (done) { + var context = await featureAbility.getContext(); + var result = await context.getBundleName(); + expect(typeof(context)).assertEqual("object"); + done(); + }) + + // @tc.number: ACTS_GetBundleName_0200 + // @tc.name: getBundleName : Get the bundlename of the hap package + // @tc.desc: Get the bundlename of the hap package(by promise) + it('ACTS_GetBundleName_0200', 0, async function (done) { + var context = await featureAbility.getContext(); + var result = await context.getBundleName(); + expect(result).assertEqual('com.context.test'); + done(); + }) + + // @tc.number: ACTS_GetBundleName_0300 + // @tc.name: getBundleName : Get the bundlename of the hap package + // @tc.desc: Get the value of return is void (by callback) + it('ACTS_GetBundleName_0300', 0, async function (done) { + var context = featureAbility.getContext( + (errContext, dataContext) => { + var info = dataContext.getBundleName( + (err, data) => { + expect(err.code).assertEqual(0); + expect(data).assertEqual('com.context.test'); + done(); + } + ) + } + ); + }) + + // @tc.number: ACTS_GetBundleName_0400 + // @tc.name: getBundleName : Get the bundlename of the hap package + // @tc.desc: Get the bundlename of the hap package(by callback) + it('ACTS_GetBundleName_0400', 0, async function (done) { + var context = await featureAbility.getContext(); + var info = context.getBundleName( + (err, data) => { + expect(data).assertEqual('com.context.test'); + done(); + } + ); + }) + + // @tc.number: ACTS_GetBundleName_0500 + // @tc.name: getBundleName : Get the bundlename of the hap package + // @tc.desc: Wrong parameters are provided, and the test return type is void (by callback) + it('ACTS_GetBundleName_0500', 0, async function (done) { + var context = await featureAbility.getContext(); + var info = context.getBundleName("error_param", + (err, data) => { + expect(data).assertEqual('com.context.test'); + done(); + } + ); + expect(info).assertEqual(null); + done(); + }) +}) diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/context/project/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..681808084af91b8c7dd523999a458bf341019157 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./ContextJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/context/project/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/aafwk/aafwk_standard/context/project/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/context/project/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/context/project/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/context/project/permission/package.json b/aafwk/aafwk_standard/context/project/permission/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/config.json b/aafwk/aafwk_standard/context/project/permission/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7137400327be3e8ff7f5feca17a977f170af2349 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.permission", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.permission", + "name": ".MyApplication", + "defPermissions": [ + { + "name": "ohos.permission.CAMERA", + "grantMode": "system_grant", + "availableScope": [], + "label": "CAMERA permission", + "description": "CAMERA permission in detail" + } + ], + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "permission", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.permission.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/js/default/app.js b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..49eb46a053db5a2da9542526b61eed164fa44d26 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/src/main/js/default/pages/index/index.js @@ -0,0 +1,22 @@ +/* + * 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 { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + } +} diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/context/project/permission/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d405647b90183b99fb4e15025a9fe12c85c495d4 --- /dev/null +++ b/aafwk/aafwk_standard/context/project/permission/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/context/project/permission/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/context/project/permission/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/context/project/permission/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/BUILD.gn b/aafwk/aafwk_standard/featureability/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..e92461bf9b172a2e1cc0de5c02cd3f13beb3d6a6 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsFeatureAbilityTest") { + test_hap_name = "ActsFeatureAbility" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/aafwk/aafwk_standard/featureability/Test.json b/aafwk/aafwk_standard/featureability/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..6f43569227721716e662cb0d69888d8ff0085b2b --- /dev/null +++ b/aafwk/aafwk_standard/featureability/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.aafwk.featureability" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/featureability/hap/featureabilitytest-signed.hap b/aafwk/aafwk_standard/featureability/hap/featureabilitytest-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..b46614256b34d860cddc569415bfb7d178b8b23b Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/featureabilitytest-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/finishwithresulttest1-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/finishwithresulttest1-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..015154231fbe5741f79f1967558d14a7cc710a48 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/finishwithresulttest1-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/finishwithresulttest2-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/finishwithresulttest2-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..f8cfb7f30ee97eb04b380ac96821432fd39768e4 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/finishwithresulttest2-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/finishwithresulttest3-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/finishwithresulttest3-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..93772bd00cdc4f9ce512bdad5c47f528d92f0c88 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/finishwithresulttest3-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/getcallingbundle-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/getcallingbundle-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..530a0b13bbbb4e2aa881d99313ea6606484b88e3 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/getcallingbundle-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest1-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest1-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..78463f269df80fb6cb351eabc9cc93c3d005d7cd Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest1-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest2-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest2-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..c0d1db7bb68f17d14dfcf7df559b9abcf88b8682 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest2-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest3-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest3-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..ffee0d809d7d80e819cd63c150f54e17074d025d Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest3-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest5-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest5-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..080c4623f948db00e6bf0badc080a1407ae1ab5f Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest5-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest6-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest6-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..b70a15f4905981062ef0056ebb33850160ce6330 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest6-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest7-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest7-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..a814c3961543347af108e8cdda33b06b23c66fa8 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilityforresulttest7-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilitytest1-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilitytest1-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..64b0e710b3ce13f70d3c6eb6e87c9797f0481563 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilitytest1-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilitytest2-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilitytest2-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..43c0d88ff837bfd9663a1299c3dc3bb432b91f50 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilitytest2-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilitytest3-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilitytest3-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..b99323ff7f81af08e6e3cb1882685a2dd540db39 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilitytest3-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilitytest5-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilitytest5-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..20eec933a4d6beb08db094f689f1b6dea3969811 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilitytest5-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilitytest6-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilitytest6-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..6c8d21f1cd56cde6b57cf124431da5949e32276f Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilitytest6-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/startabilitytest7-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/startabilitytest7-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..1d241b5c5358fc08b74b5e113d336d23e8d88d70 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/startabilitytest7-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/terminateability1-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/terminateability1-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..0ee10a6e2f89b28180b3307e71ac9d3b2b025f62 Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/terminateability1-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/hap/terminateability2-entry-debug-rich-signed.hap b/aafwk/aafwk_standard/featureability/hap/terminateability2-entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..3e190c50037fe264693a70478f566a27a2c40bfa Binary files /dev/null and b/aafwk/aafwk_standard/featureability/hap/terminateability2-entry-debug-rich-signed.hap differ diff --git a/aafwk/aafwk_standard/featureability/project/entry/package.json b/aafwk/aafwk_standard/featureability/project/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/config.json b/aafwk/aafwk_standard/featureability/project/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..9a8e6e2706b1955a887b5fe7ef30fd49774e485f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/config.json @@ -0,0 +1,82 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": { + "default": { + "process": "processTest" + } + }, + "module": { + "package": "com.jstest.featureabilitytest", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.jstest.featureabilitytest.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "process": "processTestAbility", + "permissions": ["ohos.permission.ACCELEROMETER","ohos.permission.ANSWER_CALL"], + "deviceCapability": ["screen_support","audio_support"], + "uri": "uriTest", + "visible": true + } + ], + "reqCapabilities": ["reqCapabilitiesTest1","reqCapabilitiesTest2"], + "description": "descriptionTest", + "reqPermissions": [ + { + "name": "ohos.permission.CAMERA", + "reason": "$string:permreason_camera", + "usedScene": + { + "ability": ["com.mycamera.Ability", "com.mycamera.AbilityBackground"], + "when": "always" + } + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..473188bece984d9102718caf3b9edda1d84e3539 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,1669 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import wantconstant from '@ohos.ability.wantconstant' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_wantConstant_0100 + // @tc.name: wantConstant : Check specific enum + // @tc.desc: Check the return type of the interface (by Promise) + it('ACTS_wantConstant_0100', 0, async function (done) { + expect(wantconstant.Action.ACTION_HOME).assertEqual("action.system.home"); + expect(wantconstant.Action.ACTION_PLAY).assertEqual("action.system.play"); + expect(wantconstant.Action.ACTION_BUNDLE_ADD).assertEqual("action.bundle.add"); + expect(wantconstant.Action.ACTION_BUNDLE_REMOVE).assertEqual("action.bundle.remove"); + expect(wantconstant.Action.ACTION_BUNDLE_UPDATE).assertEqual("action.bundle.update"); + expect(wantconstant.Action.ACTION_ORDER_TAXI).assertEqual("ability.intent.ORDER_TAXI"); + expect(wantconstant.Action.ACTION_QUERY_TRAFFIC_RESTRICTION).assertEqual("ability.intent.QUERY_TRAFFIC_RESTRICTION"); + expect(wantconstant.Action.ACTION_PLAN_ROUTE).assertEqual("ability.intent.PLAN_ROUTE"); + expect(wantconstant.Action.ACTION_BOOK_FLIGHT).assertEqual("ability.intent.BOOK_FLIGHT"); + expect(wantconstant.Action.ACTION_BOOK_TRAIN_TICKET).assertEqual("ability.intent.BOOK_TRAIN_TICKET"); + expect(wantconstant.Action.ACTION_BOOK_HOTEL).assertEqual("ability.intent.BOOK_HOTEL"); + expect(wantconstant.Action.ACTION_QUERY_TRAVELLING_GUIDELINE).assertEqual("ability.intent.QUERY_TRAVELLING_GUIDELINE"); + expect(wantconstant.Action.ACTION_QUERY_POI_INFO).assertEqual("ability.intent.QUERY_POI_INFO"); + expect(wantconstant.Action.ACTION_QUERY_CONSTELLATION_FORTUNE).assertEqual("ability.intent.QUERY_CONSTELLATION_FORTUNE"); + expect(wantconstant.Action.ACTION_QUERY_ALMANC).assertEqual("ability.intent.QUERY_ALMANC"); + expect(wantconstant.Action.ACTION_QUERY_WEATHER).assertEqual("ability.intent.QUERY_WEATHER"); + expect(wantconstant.Action.ACTION_QUERY_ENCYCLOPEDIA).assertEqual("ability.intent.QUERY_ENCYCLOPEDIA"); + expect(wantconstant.Action.ACTION_QUERY_RECIPE).assertEqual("ability.intent.QUERY_RECIPE"); + expect(wantconstant.Action.ACTION_BUY_TAKEOUT).assertEqual("ability.intent.BUY_TAKEOUT"); + expect(wantconstant.Action.ACTION_TRANSLATE_TEXT).assertEqual("ability.intent.TRANSLATE_TEXT"); + expect(wantconstant.Action.ACTION_BUY).assertEqual("ability.intent.BUY"); + expect(wantconstant.Action.ACTION_QUERY_LOGISTICS_INFO).assertEqual("ability.intent.QUERY_LOGISTICS_INFO"); + expect(wantconstant.Action.ACTION_SEND_LOGISTICS).assertEqual("ability.intent.SEND_LOGISTICS"); + expect(wantconstant.Action.ACTION_QUERY_SPORTS_INFO).assertEqual("ability.intent.QUERY_SPORTS_INFO"); + expect(wantconstant.Action.ACTION_QUERY_NEWS).assertEqual("ability.intent.QUERY_NEWS"); + expect(wantconstant.Action.ACTION_QUERY_JOKE).assertEqual("ability.intent.QUERY_JOKE"); + expect(wantconstant.Action.ACTION_WATCH_VIDEO_CLIPS).assertEqual("ability.intent.WATCH_VIDEO_CLIPS"); + expect(wantconstant.Action.ACTION_QUERY_STOCK_INFO).assertEqual("ability.intent.QUERY_STOCK_INFO"); + expect(wantconstant.Action.ACTION_LOCALE_CHANGED).assertEqual("ability.intent.LOCALE_CHANGED"); + + expect(wantconstant.Entity.ENTITY_HOME).assertEqual("entity.system.home"); + expect(wantconstant.Entity.ENTITY_VIDEO).assertEqual("entity.system.video"); + + console.log("wantConstant.Action.ACTION_HOME: " + wantconstant.Action.ACTION_HOME) + console.log("wantConstant.Action.ACTION_PLAY: " + wantconstant.Action.ACTION_PLAY) + console.log("wantConstant.Action.ACTION_BUNDLE_ADD: " + wantconstant.Action.ACTION_BUNDLE_ADD) + console.log("wantConstant.Action.ACTION_BUNDLE_REMOVE: " + wantconstant.Action.ACTION_BUNDLE_REMOVE) + console.log("wantConstant.Action.ACTION_BUNDLE_UPDATE: " + wantconstant.Action.ACTION_BUNDLE_UPDATE) + console.log("wantConstant.Action.ACTION_ORDER_TAXI: " + wantconstant.Action.ACTION_ORDER_TAXI) + console.log("wantConstant.Action.ACTION_QUERY_TRAFFIC_RESTRICTION: " + wantconstant.Action.ACTION_QUERY_TRAFFIC_RESTRICTION) + console.log("wantConstant.Action.ACTION_PLAN_ROUTE: " + wantconstant.Action.ACTION_PLAN_ROUTE) + console.log("wantConstant.Action.ACTION_BOOK_FLIGHT: " + wantconstant.Action.ACTION_BOOK_FLIGHT) + console.log("wantConstant.Action.ACTION_BOOK_TRAIN_TICKET: " + wantconstant.Action.ACTION_BOOK_TRAIN_TICKET) + console.log("wantConstant.Action.ACTION_BOOK_HOTEL: " + wantconstant.Action.ACTION_BOOK_HOTEL) + console.log("wantConstant.Action.ACTION_QUERY_TRAVELLING_GUIDELINE: " + wantconstant.Action.ACTION_QUERY_TRAVELLING_GUIDELINE) + console.log("wantConstant.Action.ACTION_QUERY_POI_INFO: " + wantconstant.Action.ACTION_QUERY_POI_INFO) + console.log("wantConstant.Action.ACTION_QUERY_CONSTELLATION_FORTUNE: " + wantconstant.Action.ACTION_QUERY_CONSTELLATION_FORTUNE) + console.log("wantConstant.Action.ACTION_QUERY_ALMANC: " + wantconstant.Action.ACTION_QUERY_ALMANC) + console.log("wantConstant.Action.ACTION_QUERY_WEATHER: " + wantconstant.Action.ACTION_QUERY_WEATHER) + console.log("wantConstant.Action.ACTION_QUERY_ENCYCLOPEDIA: " + wantconstant.Action.ACTION_QUERY_ENCYCLOPEDIA) + console.log("wantConstant.Action.ACTION_QUERY_RECIPE: " + wantconstant.Action.ACTION_QUERY_RECIPE) + console.log("wantConstant.Action.ACTION_BUY_TAKEOUT: " + wantconstant.Action.ACTION_BUY_TAKEOUT) + console.log("wantConstant.Action.ACTION_TRANSLATE_TEXT: " + wantconstant.Action.ACTION_TRANSLATE_TEXT) + console.log("wantConstant.Action.ACTION_BUY: " + wantconstant.Action.ACTION_BUY) + console.log("wantConstant.Action.ACTION_QUERY_LOGISTICS_INFO: " + wantconstant.Action.ACTION_QUERY_LOGISTICS_INFO) + console.log("wantConstant.Action.ACTION_SEND_LOGISTICS: " + wantconstant.Action.ACTION_SEND_LOGISTICS) + console.log("wantConstant.Action.ACTION_QUERY_SPORTS_INFO: " + wantconstant.Action.ACTION_QUERY_SPORTS_INFO) + console.log("wantConstant.Action.ACTION_QUERY_NEWS: " + wantconstant.Action.ACTION_QUERY_NEWS) + console.log("wantConstant.Action.ACTION_QUERY_JOKE: " + wantconstant.Action.ACTION_QUERY_JOKE) + console.log("wantConstant.Action.ACTION_WATCH_VIDEO_CLIPS: " + wantconstant.Action.ACTION_WATCH_VIDEO_CLIPS) + console.log("wantConstant.Action.ACTION_QUERY_STOCK_INFO: " + wantconstant.Action.ACTION_QUERY_STOCK_INFO) + console.log("wantConstant.Action.ACTION_LOCALE_CHANGED: " + wantconstant.Action.ACTION_LOCALE_CHANGED) + + console.log("wantConstant.Entity.ENTITY_HOME: " + wantconstant.Entity.ENTITY_HOME ) + console.log("wantConstant.Entity.ENTITY_VIDEO: " + wantconstant.Entity.ENTITY_VIDEO) + + done(); + }) + + // @tc.number: ACTS_GetContext_0100 + // @tc.name: GetContext : Obtains the Context object + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_GetContext_0100',0,async function (done) { + var promise = featureAbility.getContext() + expect(typeof(promise)).assertEqual("object"); + done() + }) + + // @tc.number: ACTS_GetContext_0200 + // @tc.name: GetContext : Obtains the Context object + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_GetContext_0200', 0, async function (done) { + var result = await featureAbility.getContext( + (data) => { + expect(typeof(data)).assertEqual("object"); + done(); + }, + ); + }) + + // @tc.number: ACTS_HasWindowFocus_0100 + // @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_HasWindowFocus_0100', 0, async function (done) { + var promise = featureAbility.hasWindowFocus(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.hasWindowFocus(); + expect(info).assertEqual(true); + done(); + }) + + // @tc.number: ACTS_HasWindowFocus_0300 + // @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_HasWindowFocus_0300', 0, async function (done) { + var result = featureAbility.hasWindowFocus( + (err, data) => { + console.log("hasWindowFocus asyncCallback code: " + err.code + " data: " + data) + done() + } + ); + console.info('AceApplication : hasWindowFocus : ' + result); + }) + + + // @tc.number: ACTS_StartAbility_0100 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbility_0100', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilitytest1.MainAbility", + uri:"" + }, + } + ); + expect(promise).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_StartAbility_0200 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbility_0200', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilitytest2.MainAbility", + uri:"", + parameters: + { + mykey0: 1111, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "xxxxxxxxxxxxxxxxxxxxxx", + mykey4: [1, 15], + mykey5: [false, true, false], + mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], + mykey7: true, + }, + }, + } + ); + expect(promise).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_StartAbility_0300 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbility_0300', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + action: "", + entities: [""], + type: "", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilitytest3.MainAbility", + uri:"" + }, + } + ); + expect(promise).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_StartAbility_0400 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_StartAbility_0400', 0, async function (done) { + var result = featureAbility.startAbility( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilitytest5.MainAbility", + uri:"" + }, + }, + (error,data) => { + expect(data).assertEqual(0); + console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error +" data: " + data) + done(); + }, + ); + }) + + // @tc.number: ACTS_StartAbility_0500 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_StartAbility_0500', 0, async function (done) { + var result = featureAbility.startAbility( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilitytest6.MainAbility", + uri:"" + }, + parameters: + { + mykey0: 1111, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "xxxxxxxxxxxxxxxxxxxxxx", + mykey4: [1, 15], + mykey5: [false, true, false], + mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], + mykey7: true, + }, + }, + (error,data) => { + expect(data).assertEqual(0); + console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error +" data: " + data) + done() + }, + ); + }) + + // @tc.number: ACTS_StartAbility_0600 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_StartAbility_0600', 0, async function (done) { + var result = featureAbility.startAbility( + { + want: + { + action: "", + entities: [""], + type: "", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilitytest7.MainAbility", + uri:"" + }, + }, + (error,data) => { + expect(data).assertEqual(0); + console.log('featureAbilityTest startAbility asyncCallback errCode : ' + error +" data: " + data) + done() + }, + ); + }) + + + // @tc.number: ACTS_StartAbilityForResult_0100 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbilityForResult_0100', 0, async function (done) { + var promise = await featureAbility.startAbilityForResult( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilityforresulttest1.MainAbility", + uri:"" + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0100 asyncCallback errCode : ' + error + " result: " + result) + done(); + }, + ); + expect(promise).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_StartAbilityForResult_0200 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbilityForResult_0200', 0, async function (done) { + var promise = await featureAbility.startAbilityForResult( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilityforresulttest2.MainAbility", + uri:"", + parameters: + { + mykey0: 1111, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "xxxxxxxxxxxxxxxxxxxxxx", + mykey4: [1, 15], + mykey5: [false, true, false], + mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], + mykey7: true, + }, + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0200 asyncCallback errCode : ' + error + " result: " + result) + done(); + }, + ); + expect(promise).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_StartAbilityForResult_0300 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbilityForResult_0300', 0, async function (done) { + var promise = await featureAbility.startAbilityForResult( + { + want: + { + action: "", + entities: [""], + type: "", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilityforresulttest3.MainAbility", + uri:"" + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0300 asyncCallback errCode : ' + error + " result: " + result) + done(); + }, + ); + expect(promise).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_StartAbilityForResult_0400 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_StartAbilityForResult_0400', 0, async function (done) { + var result = featureAbility.startAbilityForResult( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilityforresulttest5.MainAbility", + uri:"" + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0700 asyncCallback errCode : ' + error + " result: " + result) + done() + }, + (error,result) => { + expect(result).assertEqual(0); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0700 asyncCallback errCode : ' + error + " result: " + result) + done() + }, + + ); + }) + + // @tc.number: ACTS_StartAbilityForResult_0500 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_StartAbilityForResult_0500', 0, async function (done) { + var result = featureAbility.startAbilityForResult( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilityforresulttest6.MainAbility", + uri:"", + parameters: + { + mykey0: 1111, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "xxxxxxxxxxxxxxxxxxxxxx", + mykey4: [1, 15], + mykey5: [false, true, false], + mykey6: ["aaaaaa", "bbbbb", "ccccccccccc"], + mykey7: true, + }, + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0800 asyncCallback errCode : ' + error + " result: " + result) + done(); + }, + (error,result) => { + expect(result).assertEqual(0); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0800 asyncCallback errCode : ' + error + " result: " + result) + done(); + }, + ); + }) + + // @tc.number: ACTS_StartAbilityForResult_0600 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_StartAbilityForResult_0600', 0, async function (done) { + var result = featureAbility.startAbilityForResult( + { + want: + { + action: "", + entities: [""], + type: "", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.startabilityforresulttest7.MainAbility", + uri:"" + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0900 asyncCallback errCode : ' + error + " result: " + result) + done() + }, + (error,result) => { + expect(result).assertEqual(0); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0900 asyncCallback errCode : ' + error + " result: " + result) + done() + }, + ); + }) + + function checkOnAbilityResult(data) { + expect(typeof(data)).assertEqual("object"); + expect(typeof(data.requestCode)).assertEqual("number"); + expect(typeof(data.resultCode)).assertEqual("number"); + expect(typeof(data.want.action)).assertEqual("string"); + expect(Array.isArray(data.want.entities)).assertEqual(true); + expect(typeof(data.want.type)).assertEqual("string"); + expect(typeof(data.want.options)).assertEqual("object"); + expect(typeof(data.want.deviceId)).assertEqual("string"); + expect(typeof(data.want.bundleName)).assertEqual("string"); + expect(typeof(data.want.abilityName)).assertEqual("string"); + expect(typeof(data.want.uri)).assertEqual("string"); + + console.info('featureAbilityTest onAbilityResult asyncCallback success : *************'); + console.info('requestCode : ' + data.requestCode); + console.info('resultCode : ' + data.resultCode); + console.info('want.action : ' + data.want.action); + console.info('want.entities.length : ' + data.want.entities.length); + for(var j = 0; j < data.want.entities.length; j++) { + console.info('want.entities : ' + data.want.entities[j]); + } + console.info('want.type : ' + data.want.type); + console.info('want.options : ' + data.want.options); + console.info('want.deviceId : ' + data.want.deviceId); + console.info('want.options.authReadUriPermission : ' + data.want.options.authReadUriPermission); + console.info('want.options.authWriteUriPermission : ' + data.want.options.authWriteUriPermission); + console.info('want.options.abilityForwardResult : ' + data.want.options.abilityForwardResult); + console.info('want.options.abilityContinuation : ' + data.want.options.abilityContinuation); + console.info('want.options.notOhosComponent : ' + data.want.options.notOhosComponent); + console.info('want.options.abilityFormEnabled : ' + data.want.options.abilityFormEnabled); + console.info('want.options.authPersistableUriPermission : ' + data.want.options.authPersistableUriPermission); + console.info('want.options.authPrefixUriPermission : ' + data.want.options.authPrefixUriPermission); + console.info('want.options.abilitySliceMultiDevice : ' + data.want.options.abilitySliceMultiDevice); + console.info('want.options.startForegroundAbility : ' + data.want.options.startForegroundAbility); + console.info('want.options.installOnDemand : ' + data.want.options.installOnDemand); + console.info('want.options.abilitySliceForwardResult : ' + data.want.options.abilitySliceForwardResult); + console.info('want.options.installWithBackgroundMode : ' + data.want.options.installWithBackgroundMode); + console.info('want.bundleName : ' + data.want.bundleName); + console.info('want.abilityName : ' + data.want.abilityName); + console.info('want.uri : ' + data.want.uri); + } + + // @tc.number: ACTS_HasWindowFocus_0200 + // @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_HasWindowFocus_0200', 0, async function (done) { + var promise = featureAbility.hasWindowFocus(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.hasWindowFocus(); + expect(info).assertEqual(false); + done(); + }) + + // @tc.number: ACTS_HasWindowFocus_0400 + // @tc.name: HasWindowFocus : Checks whether the main window of this ability has window focus + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_HasWindowFocus_0400', 0, async function (done) { + var result = featureAbility.hasWindowFocus( + (error, data) => { + console.log("ACTS_HasWindowFocus_0400 asyncCallback code: " + error.code + " data: " + data) + expect(data).assertEqual(false); + done(); + } + ); + }) + + // @tc.number: ACTS_TerminateAbility_0100 + // @tc.name: TerminateAbility : Destroys ability + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_TerminateAbility_0100', 0, async function (done) { + var promise = featureAbility.startAbility( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.terminateability1.MainAbility", + uri:"" + }, + } + ); + expect(typeof(promise)).assertEqual("object"); + done(); + }) + + // @tc.number: ACTS_TerminateAbility_0200 + // @tc.name: TerminateAbility : Destroys ability + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_TerminateAbility_0200', 0, async function (done) { + var promise = featureAbility.startAbility( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + flags: 2, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.terminateability2.MainAbility", + uri:"" + }, + } + ); + expect(typeof(promise)).assertEqual("object"); + done(); + }) + + + // @tc.number: ACTS_FinishWithResult_0100 + // @tc.name: FinishWithResult : Called when startAbilityForResultis called to start an ability and the result is returned. + // @tc.desc: Check the return value of the interface + it('ACTS_FinishWithResult_0100', 0, async function (done) { + var promise = await featureAbility.startAbilityForResult( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.finishwithresulttest1.MainAbility", + uri:"" + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0100 asyncCallback errCode : ' + error + " result: " + result) + done(); + }, + ); + expect(promise).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_FinishWithResult_0200 + // @tc.name: FinishWithResult : Called when startAbilityForResultis called to start an ability and the result is returned. + // @tc.desc: Check the return value of the interface + it('ACTS_FinishWithResult_0200', 0, async function (done) { + var promise = await featureAbility.startAbilityForResult( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.finishwithresulttest2.MainAbility", + uri:"" + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0200 asyncCallback errCode : ' + error + " result: " + result) + done(); + }, + ); + expect(promise).assertEqual(0); + done(); + }) + + // @tc.number: ACTS_FinishWithResult_0300 + // @tc.name: FinishWithResult : Called when startAbilityForResultis called to start an ability and the result is returned. + // @tc.desc: Check the return value of the interface + it('ACTS_FinishWithResult_0300', 0, async function (done) { + var promise = await featureAbility.startAbilityForResult( + { + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "", + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.finishwithresulttest3.MainAbility", + uri:"" + }, + requestCode: 2, + }, + (error, result) => { + checkOnAbilityResult(result); + console.log('featureAbilityTest ACTS_StartAbilityForResult_0300 asyncCallback errCode : ' + error + " result: " + result) + done(); + }, + ); + expect(promise).assertEqual(0); + done(); + }) + + // checkAbilityName + function checkAbilityName(info) { + console.log("AbilityName name : " + info); + expect(typeof(info)).assertEqual("string"); + expect(info).assertEqual("com.jstest.featureabilitytest.MainAbility"); + } + + // @tc.number: ACTS_GetAbilityName_0100 + // @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name. + // @tc.desc: Check the return type of the interface (by Promise) + it('ACTS_GetAbilityName_0100', 0, async function (done) { + var promise = featureAbility.getAbilityName(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.getAbilityName(); + checkAbilityName(info); + done(); + }) + + // @tc.number: ACTS_GetAbilityName_0200 + // @tc.name: GetAbilityName : Obtains the class name in this ability name, without the prefixed bundle name. + // @tc.desc: Check the return type of the interface (by Promise) + it('ACTS_GetAbilityName_0200', 0, async function (done) { + var result = featureAbility.getAbilityName( + (err, data) => { + checkAbilityName(data); + done() + } + ); + }) + + // checkApplicationInfo + function checkApplicationInfo(info) { + console.log("getApplicationInfo : " + info) + console.log("name : " + info.name); + console.log("description : " + info.description); + console.log("descriptionId : " + info.descriptionId); + console.log("systemApp : " + info.systemApp); + console.log("enabled : " + info.enabled); + console.log("label : " + info.label); + console.log("labelId : " + info.labelId); + console.log("icon : " + info.icon); + console.log("iconId : " + info.iconId); + console.log("process : " + info.process); + console.log("supportedModes : " + info.supportedModes); + + console.log("moduleSourceDirs length : " + info.moduleSourceDirs.length); + for(var j = 0; j < info.moduleSourceDirs.length; j++) { + console.log("info.moduleSourceDirs[" + j + "] : " + info.moduleSourceDirs[j]); + } + console.log("permissions length : " + info.permissions.length); + for(var j = 0; j < info.permissions.length; j++) { + console.log("info.permissions[" + j + "] : " + info.permissions[j]); + } + console.log("moduleInfos length : " + info.moduleInfos.length); + for(var j = 0; j < info.moduleInfos.length; j++) { + console.log("info.moduleInfos[" + j + "].moduleName : " + info.moduleInfos[j].moduleName); + console.log("info.moduleInfos[" + j + "].moduleSourceDir : " + info.moduleInfos[j].moduleSourceDir); + } + console.log("flags : " + info.flags); + console.log("entryDir : " + info.entryDir); + + expect(typeof(info)).assertEqual("object"); + expect(typeof(info.name)).assertEqual("string"); + expect(typeof(info.description)).assertEqual("string"); + expect(typeof(info.descriptionId)).assertEqual("number"); + expect(typeof(info.systemApp)).assertEqual("boolean"); + expect(typeof(info.enabled)).assertEqual("boolean"); + expect(typeof(info.label)).assertEqual("string"); + expect(typeof(info.labelId)).assertEqual("string"); + expect(typeof(info.icon)).assertEqual("string"); + expect(typeof(info.iconId)).assertEqual("string"); + expect(typeof(info.process)).assertEqual("string"); + expect(typeof(info.supportedModes)).assertEqual("number"); + expect(Array.isArray(info.moduleSourceDirs)).assertEqual(true); + expect(Array.isArray(info.permissions)).assertEqual(true); + expect(Array.isArray(info.moduleInfos)).assertEqual(true); + expect(typeof(info.flags)).assertEqual("number"); + expect(typeof(info.entryDir)).assertEqual("string"); + + expect(info.name).assertEqual("com.jstest.featureabilitytest"); + expect(info.description).assertEqual("$string:mainability_description"); + // expect(info.descriptionId).assertEqual(0); //create by DevEco when building HAP. + expect(info.systemApp).assertEqual(true); + expect(info.enabled).assertEqual(true); + expect(info.label).assertEqual("$string:app_name"); + // expect(info.labelId).assertEqual(0); //create by DevEco when building HAP. + expect(info.icon).assertEqual("$media:icon"); + // expect(info.iconId).assertEqual(0); //create by DevEco when building HAP. + expect(info.process).assertEqual(""); + expect(info.supportedModes).assertEqual(0); + expect(info.moduleSourceDirs[0]).assertEqual("/data/accounts/account_0/applications/com.jstest.featureabilitytest/com.jstest.featureabilitytest"); + expect(info.permissions[0]).assertEqual("ohos.permission.CAMERA"); + expect(info.moduleInfos[0].moduleName).assertEqual(".MyApplication"); + expect(info.moduleInfos[0].moduleSourceDir).assertEqual("/data/accounts/account_0/applications/com.jstest.featureabilitytest/com.jstest.featureabilitytest"); + expect(info.flags).assertEqual(0); + expect(info.entryDir).assertEqual("/data/accounts/account_0/applications/com.jstest.featureabilitytest/com.jstest.featureabilitytest"); + } + + + // @tc.number: ACTS_GetApplicationInfo_0100 + // @tc.name: GetApplicationInfo : Obtains information about the current application. + // @tc.desc: Check the return type of the interface (by Promise) + it('ACTS_GetApplicationInfo_0100', 0, async function (done) { + var promise = featureAbility.getApplicationInfo(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.getApplicationInfo(); + checkApplicationInfo(info); + done(); + }) + + // @tc.number: ACTS_GetApplicationInfo_0100 + // @tc.name: GetApplicationInfo : Obtains information about the current application. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_GetApplicationInfo_0200', 0, async function (done) { + var result = featureAbility.getApplicationInfo( + (err, data) => { + checkApplicationInfo(data); + done() + } + ); + }) + + // checkProcessInfo + function checkProcessInfo(info) { + console.log("checkProcessInfo ProcessInfo: " + info); + console.log("checkProcessInfo processName : " + info.processName); + console.log("checkProcessInfo pid : " + info.pid); + + expect(typeof(info)).assertEqual("object"); + expect(typeof(info.processName)).assertEqual("string"); + expect(typeof(info.pid)).assertEqual("number"); + expect(info.processName).assertEqual("processTestAbility"); + } + + // @tc.number: ACTS_GetProcessInfo_0100 + // @tc.name: GetProcessInfo : Called when getting the ProcessInfo + // @tc.desc: Check the return type of the interface (by promise) + it('ACTS_GetProcessInfo_0100', 0, async function (done) { + var promise = featureAbility.getProcessInfo(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.getProcessInfo(); + checkProcessInfo(info); + done(); + }) + + // @tc.number: ACTS_GetProcessInfo_0200 + // @tc.name: GetProcessInfo : Called when getting the ProcessInfo + // @tc.desc: Check the return type of the interface (by AsyncCallback) + it('ACTS_GetProcessInfo_0200', 0, async function (done) { + var result = featureAbility.getProcessInfo( + (err, data) => { + checkProcessInfo(data); + done() + } + ); + }) + + // checkElementName + function checkElementName(info) { + console.log("getElementName : " + info); + console.log("deviceId : " + info.deviceId); + console.log("bundleName : " + info.bundleName); + console.log("abilityName : " + info.abilityName); + console.log("uri : " + info.uri); + console.log("shortName : " + info.shortName); + + expect(typeof(info)).assertEqual("object"); + expect(typeof(info.deviceId)).assertEqual("string"); + expect(typeof(info.bundleName)).assertEqual("string"); + expect(typeof(info.abilityName)).assertEqual("string"); + expect(typeof(info.uri)).assertEqual("string"); + expect(typeof(info.shortName)).assertEqual("string"); + + expect(info.deviceId).assertEqual(""); + expect(info.bundleName).assertEqual("com.jstest.featureabilitytest"); + expect(info.abilityName).assertEqual("com.jstest.featureabilitytest.MainAbility"); + expect(info.uri).assertEqual(""); + expect(info.shortName).assertEqual(""); + } + + // @tc.number: ACTS_GetElementName_0100 + // @tc.name: GetElementName : Obtains the ohos.bundle.ElementName object of the current ability. + // @tc.desc: Check the return value of the interface (by promise) + it('ACTS_GetElementName_0100', 0, async function (done) { + var promise = featureAbility.getElementName(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.getElementName(); + checkElementName(info); + done(); + }) + + // @tc.number: ACTS_GetElementName_0200 + // @tc.name: GetElementName : Obtains the ohos.bundle.ElementName object of the current ability. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_GetElementName_0200', 0, async function (done) { + var result = featureAbility.getElementName( + (err, data) => { + checkElementName(data); + done() + } + ); + }) + + // checkAppType + function checkAppType(info) { + console.log("AppType : " + info); + expect(typeof(info)).assertEqual("string"); + expect(info).assertEqual("system"); + } + + // @tc.number: ACTS_GetAppType_0100 + // @tc.name: GetAppType : Obtains the type of this application. + // @tc.desc: Check the return value of the interface (by promise) + it('ACTS_GetAppType_0100', 0, async function (done) { + var promise = featureAbility.getAppType(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.getAppType(); + checkAppType(info); + done(); + }) + + // @tc.number: ACTS_GetAppType_0200 + // @tc.name: GetAppType : Obtains the type of this application. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_GetAppType_0200', 0, async function (done) { + var result = featureAbility.getAppType( + (err, data) => { + checkAppType(data); + done() + } + ); + }) + + // checkAbilityInfo + function checkAbilityInfo(data) { + console.log("checkAbilityInfo start " + data); + console.log("checkAbilityInfo bundleName : " + data.bundleName); + console.log("checkAbilityInfo name : " + data.name); + console.log("checkAbilityInfo label : " + data.label); + console.log("checkAbilityInfo description : " + data.description); + console.log("checkAbilityInfo icon : " + data.icon); + console.log("checkAbilityInfo labelId : " + data.labelId); + console.log("checkAbilityInfo descriptionId : " + data.descriptionId); + console.log("checkAbilityInfo iconId : " + data.iconId ); + console.log("checkAbilityInfo moduleName : " + data.moduleName ); + console.log("checkAbilityInfo process : " + data.process ); + console.log("checkAbilityInfo isVisible : " + data.isVisible ); + console.log("checkAbilityInfo type : " + data.type ) + console.log("checkAbilityInfo orientation : " + data.orientation ); + console.log("checkAbilityInfo launchMode : " + data.launchMode ); + console.log("checkAbilityInfo uri : " + data.uri); + console.log("checkAbilityInfo promise readPermission : " + data.readPermission ); + console.log("checkAbilityInfo writePermission : " + data.writePermission); + console.log("checkAbilityInfo formEntity : " + data.formEntity ); + console.log("checkAbilityInfo minFormHeight : " + data.minFormHeight); + console.log("checkAbilityInfo defaultFormHeight : " + data.defaultFormHeight); + console.log("checkAbilityInfo minFormWidth : " + data.minFormWidth ); + console.log("checkAbilityInfo defaultFormWidth : " + data.defaultFormWidth ); + console.log("checkAbilityInfo targetAbility : " + data.targetAbility ); + console.log("checkAbilityInfo backgroundModes : " + data.backgroundModes); + console.log("checkAbilityInfo subType : " + data.subType); + console.log("checkAbilityInfo formEnabled : " + data.formEnabled ); + + console.log("checkAbilityInfo permissions length : " + data.permissions.length); + for(var j = 0; j < data.permissions.length; j++) { + console.log("getAbilityInfo data.permissions[" + j + "] : " + data.permissions[j]); + } + console.log("checkAbilityInfo deviceTypes length : " + data.deviceTypes.length); + for(var j = 0; j < data.deviceTypes.length; j++) { + console.log("getAbilityInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); + } + console.log("checkAbilityInfo deviceCapabilities length : " + data.deviceCapabilities.length); + for(var j = 0; j < data.deviceCapabilities.length; j++) { + console.log("getAbilityInfo data.deviceCapabilities[" + j + "] : " + data.deviceCapabilities[j]); + } + + expect(typeof(data)).assertEqual("object"); + expect(typeof(data.bundleName)).assertEqual("string"); + expect(typeof(data.name)).assertEqual("string"); + expect(typeof(data.label)).assertEqual("string"); + expect(typeof(data.description)).assertEqual("string"); + expect(typeof(data.icon)).assertEqual("string"); + expect(typeof(data.labelId)).assertEqual("number"); + expect(typeof(data.descriptionId)).assertEqual("number"); + expect(typeof(data.iconId)).assertEqual("number"); + expect(typeof(data.moduleName)).assertEqual("string"); + expect(typeof(data.process)).assertEqual("string"); + expect(typeof(data.targetAbility)).assertEqual("string"); + expect(typeof(data.backgroundModes)).assertEqual("number"); + expect(typeof(data.isVisible)).assertEqual("boolean"); + expect(typeof(data.formEnabled)).assertEqual("boolean"); + expect(typeof(data.type)).assertEqual("number"); + expect(typeof(data.subType)).assertEqual("number"); + expect(typeof(data.orientation)).assertEqual("number"); + expect(typeof(data.launchMode)).assertEqual("number"); + expect(Array.isArray(data.permissions)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.deviceCapabilities)).assertEqual(true); + expect(typeof(data.readPermission)).assertEqual("string"); + expect(typeof(data.writePermission)).assertEqual("string"); + expect(typeof(data.applicationInfo)).assertEqual("object"); + expect(typeof(data.formEntity)).assertEqual("number"); + expect(typeof(data.minFormHeight)).assertEqual("number"); + expect(typeof(data.defaultFormHeight)).assertEqual("number"); + expect(typeof(data.minFormWidth)).assertEqual("number"); + expect(typeof(data.defaultFormWidth)).assertEqual("number"); + expect(typeof(data.uri)).assertEqual("string"); + + + expect(data.bundleName).assertEqual("com.jstest.featureabilitytest"); + expect(data.name).assertEqual("com.jstest.featureabilitytest.MainAbility"); + expect(data.label).assertEqual("$string:app_name"); + expect(data.description).assertEqual("$string:mainability_description"); + expect(data.icon).assertEqual("$media:icon"); + + // expect(data.labelId).assertEqual(16777216); //create by DevEco when building HAP. + // expect(data.descriptionId).assertEqual(16777217); //create by DevEco when building HAP. + // expect(data.iconId).assertEqual(16777218); //create by DevEco when building HAP. + + expect(data.moduleName).assertEqual(".MyApplication"); + expect(data.process).assertEqual("processTestAbility"); + expect(data.targetAbility).assertEqual(""); + expect(data.backgroundModes).assertEqual(0); + expect(data.isVisible).assertEqual(true); + expect(data.formEnabled).assertEqual(false); + expect(data.type).assertEqual(1); + expect(data.subType).assertEqual(0); + expect(data.orientation).assertEqual(0); + expect(data.launchMode).assertEqual(2); + + expect(data.permissions[0]).assertEqual("ohos.permission.ACCELEROMETER"); + expect(data.permissions[1]).assertEqual("ohos.permission.ANSWER_CALL"); + expect(data.deviceTypes[0]).assertEqual("phone"); + expect(data.deviceCapabilities[0]).assertEqual("screen_support"); + expect(data.deviceCapabilities[1]).assertEqual("audio_support"); + + expect(data.readPermission).assertEqual(""); + expect(data.writePermission).assertEqual(""); + checkApplicationInfo(data.applicationInfo); + expect(data.formEntity).assertEqual(0); + expect(data.minFormHeight).assertEqual(0); + expect(data.defaultFormHeight).assertEqual(0); + expect(data.minFormWidth).assertEqual(0); + expect(data.defaultFormWidth).assertEqual(0); + expect(data.uri).assertEqual("uriTest"); + + console.log("checkAbilityInfo end " + data); + } + + // @tc.number: ACTS_GetAbilityInfo_0100 + // @tc.name: GetAbilityInfo : Obtains the HapModuleInfo object of the application. + // @tc.desc: Check the return value of the interface (by promise) + it('ACTS_GetAbilityInfo_0100', 0, async function (done) { + var promise = featureAbility.getAbilityInfo(); + expect(typeof(promise)).assertEqual("object"); + + var info = await featureAbility.getAbilityInfo(); + checkAbilityInfo(info); + done(); + }) + + // @tc.number: ACTS_GetAbilityInfo_0200 + // @tc.name: GetAbilityInfo : Obtains the HapModuleInfo object of the application. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_GetAbilityInfo_0200', 0, async function (done) { + var result = featureAbility.getAbilityInfo( + (err, data) => { + checkAbilityInfo(data); + done() + } + ); + }) + + // checkHapModuleInfo + function checkHapModuleInfo(data) { + console.log("checkHapModuleInfo start " + data); + console.log("checkHapModuleInfo name : " + data.name); + console.log("checkHapModuleInfo description : " + data.description); + console.log("checkHapModuleInfo descriptionId : " + data.descriptionId); + console.log("checkHapModuleInfo icon : " + data.icon); + console.log("checkHapModuleInfo label : " + data.label); + console.log("checkHapModuleInfo labelId : " + data.labelId); + console.log("checkHapModuleInfo iconId : " + data.iconId); + console.log("checkHapModuleInfo backgroundImg : " + data.backgroundImg); + console.log("checkHapModuleInfo supportedModes : " + data.supportedModes); + console.log("checkHapModuleInfo reqCapabilities length : " + data.reqCapabilities.length); + for(var j = 0; j < data.reqCapabilities.length; j++) { + console.log("getHapModuleInfo data.reqCapabilities[" + j + "] : " + data.reqCapabilities[j]); + } + console.log("checkHapModuleInfo deviceTypes length : " + data.deviceTypes.length); + for(var j = 0; j < data.deviceTypes.length; j++) { + console.log("getHapModuleInfo data.deviceTypes[" + j + "] : " + data.deviceTypes[j]); + } + console.log("checkHapModuleInfo abilityInfos length : " + data.abilityInfos.length); + console.log("checkHapModuleInfo moduleName : " + data.moduleName); + console.log("checkHapModuleInfo mainAbilityName : " + data.mainAbilityName); + console.log("checkHapModuleInfo installationFree : " + data.installationFree); + + expect(typeof(data)).assertEqual("object"); + expect(typeof(data.name)).assertEqual("string"); + expect(typeof(data.description)).assertEqual("string"); + expect(typeof(data.descriptionId)).assertEqual("number"); + expect(typeof(data.icon)).assertEqual("string"); + expect(typeof(data.label)).assertEqual("string"); + expect(typeof(data.labelId)).assertEqual("number"); + expect(typeof(data.iconId)).assertEqual("number"); + expect(typeof(data.backgroundImg)).assertEqual("string"); + expect(typeof(data.supportedModes)).assertEqual("number"); + expect(Array.isArray(data.reqCapabilities)).assertEqual(true); + expect(Array.isArray(data.deviceTypes)).assertEqual(true); + expect(Array.isArray(data.abilityInfos)).assertEqual(true); + expect(typeof(data.moduleName)).assertEqual("string"); + expect(typeof(data.mainAbilityName)).assertEqual("string"); + expect(typeof(data.installationFree)).assertEqual("boolean"); + + expect(data.name).assertEqual("com.jstest.featureabilitytest"); + expect(data.description).assertEqual("descriptionTest"); + expect(data.descriptionId).assertEqual(0); + expect(data.icon).assertEqual("$media:icon"); + expect(data.label).assertEqual("$string:app_name"); + expect(data.labelId).assertEqual(0); + expect(data.iconId).assertEqual(0); + expect(data.backgroundImg).assertEqual(""); + expect(data.supportedModes).assertEqual(0); + + expect(data.reqCapabilities[0]).assertEqual("reqCapabilitiesTest1"); + expect(data.reqCapabilities[1]).assertEqual("reqCapabilitiesTest2"); + expect(data.deviceTypes[0]).assertEqual("phone"); + checkAbilityInfo(data.abilityInfos[0]); + expect(data.moduleName).assertEqual(".MyApplication") + expect(data.mainAbilityName).assertEqual(""); + expect(data.installationFree).assertEqual(false); + + console.log("checkHapModuleInfo end " + data); + } + + // @tc.number: ACTS_GetHapModuleInfo_0100 + // @tc.name: GetHapModuleInfo : Obtains the HapModuleInfo object of the application. + // @tc.desc: Check the return value of the interface (by promise) + it('ACTS_GetHapModuleInfo_0100', 0, async function (done) { + var promise = featureAbility.getHapModuleInfo(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.getHapModuleInfo(); + checkHapModuleInfo(info); + done(); + }) + + // @tc.number: ACTS_GetHapModuleInfo_0200 + // @tc.name: GetHapModuleInfo : Obtains the HapModuleInfo object of the application. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_GetHapModuleInfo_0200', 0, async function (done) { + var result = featureAbility.getHapModuleInfo( + (err, data) => { + checkHapModuleInfo(data); + done() + } + ); + }) + + // checkProcessName + function checkProcessName(info) { + console.log("checkProcessName processName : " + info); + expect(typeof(info)).assertEqual("string"); + expect(info).assertEqual("processTestAbility"); + } + + // @tc.number: ACTS_GetProcessName_0100 + // @tc.name: GetProcessName : Obtains the name of the current process. + // @tc.desc: Check the return value of the interface (by promise) + it('ACTS_GetProcessName_0100', 0, async function (done) { + var promise = featureAbility.getProcessName(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.getProcessName(); + checkProcessName(info); + done(); + }) + + // @tc.number: ACTS_GetProcessName_0200 + // @tc.name: GetProcessName : Obtains the name of the current process. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_GetProcessName_0200', 0, async function (done) { + var result = featureAbility.getProcessName( + (err, data) => { + checkProcessName(data); + done() + } + ); + }) + + // @tc.number: ACTS_GetCallingBundle_0100 + // @tc.name: GetCallingBundle : Obtains the bundle name of the ability that called the current ability. + // @tc.desc: Check the return type of the interface (by Promise) + it('ACTS_GetCallingBundle_0100', 0, async function (done) { + // startAbility + var result = await featureAbility.startAbility( + { + want: + { + bundleName: "com.jstest.featureabilitytest", + abilityName: "com.jstest.getcallingbundle.MainAbility", + }, + } + ); + done(); + }) +}) diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..78c176d8a98c29d75e995fed2c52f1dcd01990b9 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "FeatureAbilityTest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/package.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/config.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..38185cd0e401d642917103e36fab754f40c96db2 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.finishwithresulttest1", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "finishwithresulttest1", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.finishwithresulttest1.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..0c7df77c628e2f27f9b188501b786221cfd7dd0a --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('finishWithResultTest1') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..fa662f700f4747127d7416f7cc178011ae5da7ee --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,89 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_FinishWithResult_0100 + // @tc.name: FinishWithResult : Called when startAbilityForResultis called to start an ability and the result is returned. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_FinishWithResult_0100', 0, async function (done) { + var promise = await featureAbility.finishWithResult( + { + resultCode: 1, + want: + { + action: "action.system.home", + entities: ["entity.system.home"], + type: "MIMETYPE", + options:{ + // indicates the grant to perform read operations on the URI + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: true, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: true, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: true, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: true, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: true, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true + }, + deviceId: "deviceId", + bundleName: "com.neu.featureabilitytest", + abilityName: "com.jstest.finishwithresulttest1.MainAbility", + uri:"", + parameters: { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [1, 15], + mykey5: [false, true, false], + mykey6: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey7: true, + } + }, + } + ); + expect(typeof(promise)).assertEqual("object"); + done(); + }) + + // @tc.number: ACTS_TerminateAbility_0100 + // @tc.name: TerminateAbility : Destroys ability + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_TerminateAbility_0100', 0, async function (done) { + var promise = featureAbility.terminateAbility(); + expect(typeof(promise)).assertEqual("object"); + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a00ebc67522fd5469b95598c08d8ca10397745ad --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "FinishWithResultTest1" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/finishwithresulttest1/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/package.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/config.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..be9efc138b26101b53ec4c851e434cd63bc05804 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.finishwithresulttest2", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "finishwithresulttest2", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.finishwithresulttest2.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..cc478665acfe1cf644d46f2bef2e6240c228d6f9 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('finishWithResultTest2') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8a5bda243d124124815fa4dee3aa973507024d6e --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,45 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_FinishWithResult_0200 + // @tc.name: FinishWithResult : Called when startAbilityForResultis called to start an ability and the result is returned. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_FinishWithResult_0200', 0, async function (done) { + var promise = await featureAbility.finishWithResult( + { + resultCode: 1, + want: + { + bundleName: "com.neu.featureabilitytest", + abilityName: "com.jstest.finishwithresulttest2.MainAbility", + }, + } + ); + expect(typeof(promise)).assertEqual("object"); + done(); + }) + + // @tc.number: ACTS_TerminateAbility_0100 + // @tc.name: TerminateAbility : Destroys ability + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_TerminateAbility_0100', 0, async function (done) { + var promise = featureAbility.terminateAbility(); + expect(typeof(promise)).assertEqual("object"); + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..63c532b631d0859f967576efb81340fd507a227a --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "FinishWithResultTest2" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/finishwithresulttest2/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/package.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/config.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..9d43db3fc7f528e4c670c19ff8504bf9120d2bc8 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.finishwithresulttest3", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "finishwithresulttest3", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.finishwithresulttest3.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..1317f4d624c432900df94e74e1f7e0f2c3d830b0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('finishWithResultTest3') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..214f64f636794dd8a6dedcfdc5d84ddb45531b8e --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,50 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_FinishWithResult_0300 + // @tc.name: FinishWithResult : Called when startAbilityForResultis called to start an ability and the result is returned. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_FinishWithResult_0300', 0, async function (done) { + var promise = await featureAbility.finishWithResult( + { + resultCode: 1, + want: + { + action: "", + entities: [""], + type: "", + deviceId: "", + bundleName: "", + abilityName: "", + uri:"", + }, + } + ); + expect(typeof(promise)).assertEqual("object"); + done(); + }) + + // @tc.number: ACTS_TerminateAbility_0100 + // @tc.name: TerminateAbility : Destroys ability + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_TerminateAbility_0100', 0, async function (done) { + var promise = featureAbility.terminateAbility(); + expect(typeof(promise)).assertEqual("object"); + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..115ff9314a7cfdba40be0d1d18d886ccc6bafb6d --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "FinishWithResultTest3" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/finishwithresulttest3/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/package.json b/aafwk/aafwk_standard/featureability/project/getcallingbundle/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/config.json b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..87dac5b766b583e48f95f9a148aedb45f4dd6994 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.getcallingbundle", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "getcallingbundle", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.getcallingbundle.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..b4cd6619f03ff5c009d25d781c78467e1aa1e825 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('GetCallingBundleTest') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/test/GetCallingBundle.test.js b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/test/GetCallingBundle.test.js new file mode 100644 index 0000000000000000000000000000000000000000..90e0cdfaf4ede3cc415431ec13ad14544d7dbe63 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/test/GetCallingBundle.test.js @@ -0,0 +1,45 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_GetCallingBundle_0100 + // @tc.name: GetCallingBundle : Obtains the bundle name of the ability that called the current ability. + // @tc.desc: Check the return type of the interface (by Promise) + it('ACTS_GetCallingBundle_0100', 0, async function (done) { + var promise = featureAbility.getCallingBundle(); + expect(typeof(promise)).assertEqual("object"); + var info = await featureAbility.getCallingBundle(); + expect(typeof(info)).assertEqual("string"); + expect(info).assertEqual("com.jstest.featureabilitytest"); + done(); + }) + + // @tc.number: ACTS_GetCallingBundle_0200 + // @tc.name: GetCallingBundle : Obtains the bundle name of the ability that called the current ability. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_GetCallingBundle_0200', 0, async function (done) { + var result = featureAbility.getCallingBundle( + (err, data) => { + console.log("getCallingBundle : " + data) + expect(typeof(data)).assertEqual("string"); + expect(data).assertEqual("com.jstest.featureabilitytest"); + done() + } + ); + }) +}) diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7ab743a6a0147d1b4ef61ed58439a2b783c151e8 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./GetCallingBundle.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d0cb7a9773b8dded625a387f1cb9a83eec7d5b7b --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "GetCallingBundle" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/getcallingbundle/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/package.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..6faa3df02e6216915f159d1a392977a76b27d110 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilityforresulttest1", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilityforresulttest1", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilityforresulttest1.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f4d106b40bbb97ac2d541ad1f25fba6fc20919f9 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityForResultTest1') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..9f2da2b7c11f1d3a6c33d05c8345e4492722ecf6 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbilityForResult_0100 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbilityForResult_0100', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..5f5ce3e4b00ba3b3a6fba7f0a1fe105058f0e50a --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityForResultTest1" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest1/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/package.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..69c65315f1b963e8fd5edf490378e0c646008c98 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilityforresulttest2", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilityforresulttest2", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilityforresulttest2.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..e9e5b91e1051d6d54ccff4daa0c46cee8cc00441 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityForResultTest2') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..963f7091ee18c976d70a0d58a3a577214b62742d --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbilityForResult_0200 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbilityForResult_0200', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..27b9c8306a7063fe42a1d4a95ef58d144049927f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityForResultTest2" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest2/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/package.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..9cf277ec948f43c7910801931ceb6591b2deab52 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilityforresulttest3", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilityforresulttest3", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilityforresulttest3.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..3596d4bae620d493f13495e3593324f867e5df86 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityForResultTest3') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2028d404812bdda3b188aec64ef1a353ef95fb1a --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbilityForResult_0300 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbilityForResult_0300', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..942cd4ada3665cd90e376cb99c060ea5d24ed909 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityForResultTest3" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest3/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/package.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7cbcc78c6547c358d17b5711039276c61aeb8b82 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilityforresulttest5", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilityforresulttest5", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilityforresulttest5.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..7b96bca8d717b5afd9c828fb6f2ab80876a13827 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityForResultTest5') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..476958ab90d7009e7bdb533f2ba11153d55f511d --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbilityForResult_0700 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbilityForResult_0700', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..2608fa64e9ad2c52c9448174989373a5d3372172 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityForResultTest5" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest5/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/package.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b93efb10030415c568f23cd27e84dc6ac56f7618 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilityforresulttest6", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilityforresulttest6", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilityforresulttest6.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..5e0ca2713c0c680aade92e3857078cb6f35d57d6 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityForResultTest6') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..a2c9603990a009eef17eb5f7c4557f466af05f89 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbilityForResult_0800 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbilityForResult_0800', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f3293242ed6cee263f41ec520dafbc12437a1f5d --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityForResultTest6" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest6/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/package.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..5fa5ea4d79a26fa996820f6338bbfc945fee85c0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilityforresulttest7", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilityforresulttest7", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilityforresulttest7.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..74c6ca9d8eb77d757c7a5f3040cc99b4acd823b4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityForResultTest7') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..78dd4fa87532f2c87a6d151b27ce07a715652a4e --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbilityForResult_0900 + // @tc.name: StartAbilityForResult : Start other ability for result. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_StartAbilityForResult_0900', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..6b968e934deb5a2cc94848e22d4d6286f297fa96 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityForResultTest7" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilityforresulttest7/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/package.json b/aafwk/aafwk_standard/featureability/project/startabilitytest1/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..35061d57c3a86e4477b3a6fe8dc7adebadc3ad84 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilitytest1", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilitytest1", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilitytest1.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..4bd1ebf7f0f4e7948fb316fd01a2f7649295f64a --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityTest1') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..aba4c6b8e7a4e6c152e1f1cf607ab05ced79cff2 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbility_0100 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbility_0100', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e3386857ee6a5c97a3fa6b9824f9232b0cc8e61b --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityTest1" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilitytest1/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/package.json b/aafwk/aafwk_standard/featureability/project/startabilitytest2/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..8d79994e20049a86c7b6a41f325f893437b80fcf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilitytest2", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilitytest2", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilitytest2.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..3d4e49d8432059b07279e9dc1140ab721021331c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityTest2') }} {{title}} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..84c4ba977f3bcbe123a778b026c5af04c0bd842e --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbility_0200 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbility_0200', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..ca55425d59e827eef8aac175ac23d39d39d4462d --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityTest2" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilitytest2/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/package.json b/aafwk/aafwk_standard/featureability/project/startabilitytest3/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c6437913344b553d997e42e1452ebf59f20f6e2a --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilitytest3", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilitytest3", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilitytest3.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..19a87f79332fa6d542ce3a80843fbba7cdc66a1d --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityTest3') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..d0c33a740fa2ac020b52ce8eaad74c0482111718 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbility_0300 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbility_0300', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d0b359fc3fea7857fbe5e912f751f518e13092fa --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityTest3" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilitytest3/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/package.json b/aafwk/aafwk_standard/featureability/project/startabilitytest5/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..ca3199928216a07ebd48123958d222d22ed006e8 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilitytest5", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilitytest5", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilitytest5.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..1872df2f0ab181b4d66efba6ce3764f1f283ff19 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityTest5') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6db443d58c09fba46e6d10bb832060f7edbce710 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbility_0700 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbility_0700', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..3338109896130efb03e00e9c278f84905ef77be9 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityTest5" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilitytest5/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/package.json b/aafwk/aafwk_standard/featureability/project/startabilitytest6/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..9219b2dd866c800d15efff4db7a727408e8dc15b --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilitytest6", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilitytest6", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilitytest6.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..3cee238df375cfb3975a3e978327e813bb9e2c50 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityTest6') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ef905ab393a815d855df7b8f1b441bb0570990ed --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbility_0800 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_StartAbility_0800', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..e0a432f501c8d20d9151ce568ef908dbd6c6a153 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityTest6" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilitytest6/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/package.json b/aafwk/aafwk_standard/featureability/project/startabilitytest7/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/config.json b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2122e774941d9adad9b7da97a76d2028f96e5819 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.startabilitytest7", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "startabilitytest7", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.startabilitytest7.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..b04472cbee55fd17f9be185b0091337f8e8c1bca --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('startAbilityTest7') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bfd78b425314f5553ddca0b4158b63419d6da8ac --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,25 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_StartAbility_0900 + // @tc.name: StartAbility : A Page or Service ability uses this method to start a specific ability. + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_StartAbility_0900', 0, async function (done) { + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..a8c9b96904138e584c96861478fd029c0c763d8a --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "StartAbilityTest7" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/startabilitytest7/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/package.json b/aafwk/aafwk_standard/featureability/project/terminateability1/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/config.json b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..4e5b3478f3ca6fc0add9145d0bee1bf3a9457baf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.terminateability1", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "terminateability1", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.terminateability1.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..125e428512bbfe86442c59a9b7c17b9469344a73 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('terminateAbilityTest1') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..6978c5a9181e648d61fb152fbe28cbe944f8e8e7 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,27 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_TerminateAbility_0100 + // @tc.name: TerminateAbility : Destroys ability + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_TerminateAbility_0100', 0, async function (done) { + var promise = featureAbility.terminateAbility(); + expect(typeof(promise)).assertEqual("object"); + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..9113f9c8c3ccf2ee22418eafb2a60102b989882b --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "TerminateAbility1" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/terminateability1/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/package.json b/aafwk/aafwk_standard/featureability/project/terminateability2/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/config.json b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0f6de1a11b04a14038d84ff799e3be9e83402055 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.jstest.featureabilitytest", + "vendor": "jstest", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.jstest.terminateability2", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "terminateability2", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.jstest.terminateability2.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/app.js b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..88209e72f1173c7a4906b45580e2a0158c127067 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('terminateAbilityTest2') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..97055c6f9e2efb18b83f82feb258a9ad8c5ebc26 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/default/pages/index/index.js @@ -0,0 +1,44 @@ +/* + * 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 app from '@system.app' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/test/FeatureAbilityJsunit.test.js b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c25ef05bc72ba83936681c425479033b0c41614b --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,32 @@ +/* + * 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 featureAbility from '@ohos.ability.featureAbility' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsFeatureAbilityTest', function () { + // @tc.number: ACTS_TerminateAbility_0200 + // @tc.name: TerminateAbility : Destroys ability + // @tc.desc: Check the return value of the interface (by AsyncCallback) + it('ACTS_TerminateAbility_0200', 0, async function (done) { + var result = featureAbility.terminateAbility( + (data) => { + done(); + }, + (error) => { + done(); + } + ); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/test/List.test.js b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..de0ede245b645420fd60667f54206e75d3d4fcf0 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..289878642daecaf77025a7b542e468d37fd5e965 --- /dev/null +++ b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "TerminateAbility2" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/featureability/project/terminateability2/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/want/BUILD.gn b/aafwk/aafwk_standard/want/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..04f32263dd725e090471d8507fe4413e1e48ddf6 --- /dev/null +++ b/aafwk/aafwk_standard/want/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSetWantTest") { + test_hap_name = "ActsSetWantTest" + hap_source_path = "hap/setWantJSUnit.hap" +} diff --git a/aafwk/aafwk_standard/want/Test.json b/aafwk/aafwk_standard/want/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..049d12f7caab1dc07914799bb58f1f00f397c3d0 --- /dev/null +++ b/aafwk/aafwk_standard/want/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.aafwk.aafwk_standard.want" + }, + "kits": [ + { + "test-file-name": [ + "setWantJSUnit.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/aafwk/aafwk_standard/want/hap/getWant1JSUnit.hap b/aafwk/aafwk_standard/want/hap/getWant1JSUnit.hap new file mode 100644 index 0000000000000000000000000000000000000000..8e08b3928ff6aeee66750d8c3f75b3d92ba47977 Binary files /dev/null and b/aafwk/aafwk_standard/want/hap/getWant1JSUnit.hap differ diff --git a/aafwk/aafwk_standard/want/hap/getWant2JSUnit.hap b/aafwk/aafwk_standard/want/hap/getWant2JSUnit.hap new file mode 100644 index 0000000000000000000000000000000000000000..a91fb4852dd27c8bcd9f9bfd9f70aa225d45451f Binary files /dev/null and b/aafwk/aafwk_standard/want/hap/getWant2JSUnit.hap differ diff --git a/aafwk/aafwk_standard/want/hap/setWantJSUnit.hap b/aafwk/aafwk_standard/want/hap/setWantJSUnit.hap new file mode 100644 index 0000000000000000000000000000000000000000..fd2a909fccd38ed1fdf136ee9a1d0cd8fabff387 Binary files /dev/null and b/aafwk/aafwk_standard/want/hap/setWantJSUnit.hap differ diff --git a/aafwk/aafwk_standard/want/project/GetWant/package.json b/aafwk/aafwk_standard/want/project/GetWant/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/config.json b/aafwk/aafwk_standard/want/project/GetWant/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c82abcb6a9209b86326cb122ea7174b3d4fc8fb3 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.want.test", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example1.getwant", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "GetWant", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.getwant0100.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/app.js b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..175d95cefa078d12b0ace7c4319fef3b225b70c4 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + getWant1启动 + + +
diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..78f11b244e17563608f2e1da2773739776901aef --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/default/pages/index/index.js @@ -0,0 +1,46 @@ +/* + * 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 app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/js/test/GetWantTest_0100.js b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/test/GetWantTest_0100.js new file mode 100644 index 0000000000000000000000000000000000000000..da7b861ebc395f20a3342e51a15015c9eeb4359a --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/test/GetWantTest_0100.js @@ -0,0 +1,156 @@ +/* + * 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 featureAbility from '@ohos.ability.featureability' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsWantATest', function () { + const ary_entities = ["entity1"]; + const ary_int = [1, 2, 3]; + const ary_bool = [false, true, false]; + const ary_string = ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"]; + + function CompareArray(ary1, ary2) { + expect(ary1.length).assertEqual(ary2.length); + if (ary1.length == ary2.length) { + for (let i=0;i { + expect(typeof(data)).assertEqual("object"); + expect(data.deviceId).assertEqual("deviceId"); + expect(data.bundleName).assertEqual("com.want.test"); + expect(data.abilityName).assertEqual("com.example.getwant0100.MainAbility"); + expect(data.action).assertEqual("action1"); + CompareArray(data.entities, ary_entities); + expect(data.type).assertEqual("MIMETYPE"); + expect(data.uri).assertEqual("key={true,true,false}"); + expect(data.options.authReadUriPermission).assertEqual(true); + expect(data.options.authWriteUriPermission).assertEqual(true); + expect(data.options.abilityForwardResult).assertEqual(false); + expect(data.options.abilityContinuation).assertEqual(false); + expect(data.options.notOhosComponent).assertEqual(true); + expect(data.options.abilityFormEnabled).assertEqual(true); + expect(data.options.authPersistableUriPermission).assertEqual(true); + expect(data.options.authPrefixUriPermission).assertEqual(false); + expect(data.options.abilitySliceMultiDevice).assertEqual(false); + expect(data.options.startForegroundAbility).assertEqual(true); + expect(data.options.installOnDemand).assertEqual(false); + expect(data.options.abilitySliceForwardResult).assertEqual(true); + expect(data.options.installWithBackgroundMode).assertEqual(true); + expect(data.parameters.mykey0).assertEqual(2222); + CompareArray(data.parameters.mykey1, ary_int); + expect(data.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.parameters.mykey3).assertEqual("ssssssssssssssssssssssssss"); + CompareArray(data.parameters.mykey4, ary_bool); + CompareArray(data.parameters.mykey5, ary_string); + expect(data.parameters.mykey6).assertEqual(true); + + done(); + } + ).catch(error => + console.log("featureAbility getWant::catch : " + error) + ); + }) + + // @tc.number: ACTS_GetWant_0200 + // @tc.name: getWant : get want in current ability + // @tc.desc: get want in current ability (by callback) + it('ACTS_GetWant_0200', 0, async function (done) { + var want = featureAbility.getWant( + (err, data) => { + expect(typeof(data)).assertEqual("object"); + expect(data.deviceId).assertEqual("deviceId"); + expect(data.bundleName).assertEqual("com.want.test"); + expect(data.abilityName).assertEqual("com.example.getwant0100.MainAbility"); + expect(data.action).assertEqual("action1"); + CompareArray(data.entities, ary_entities); + expect(data.type).assertEqual("MIMETYPE"); + expect(data.uri).assertEqual("key={true,true,false}"); + expect(data.options.authReadUriPermission).assertEqual(true); + expect(data.options.authWriteUriPermission).assertEqual(true); + expect(data.options.abilityForwardResult).assertEqual(false); + expect(data.options.abilityContinuation).assertEqual(false); + expect(data.options.notOhosComponent).assertEqual(true); + expect(data.options.abilityFormEnabled).assertEqual(true); + expect(data.options.authPersistableUriPermission).assertEqual(true); + expect(data.options.authPrefixUriPermission).assertEqual(false); + expect(data.options.abilitySliceMultiDevice).assertEqual(false); + expect(data.options.startForegroundAbility).assertEqual(true); + expect(data.options.installOnDemand).assertEqual(false); + expect(data.options.abilitySliceForwardResult).assertEqual(true); + expect(data.options.installWithBackgroundMode).assertEqual(true); + expect(data.parameters.mykey0).assertEqual(2222); + CompareArray(data.parameters.mykey1, ary_int); + expect(data.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.parameters.mykey3).assertEqual("ssssssssssssssssssssssssss"); + CompareArray(data.parameters.mykey4, ary_bool); + CompareArray(data.parameters.mykey5, ary_string); + expect(data.parameters.mykey6).assertEqual(true); + + done(); + }); + }) + + // @tc.number: ACTS_GetWant_0300 + // @tc.name: getWant : get want in current ability + // @tc.desc: get want in current ability,private error param (by callback) + it('ACTS_GetWant_0300', 0, async function (done) { + var want = featureAbility.getWant("error_param", + (err, data) => { + expect(typeof(data)).assertEqual("object"); + expect(data.deviceId).assertEqual("deviceId"); + expect(data.bundleName).assertEqual("com.want.test"); + expect(data.abilityName).assertEqual("com.example.getwant0100.MainAbility"); + expect(data.action).assertEqual("action1"); + CompareArray(data.entities, ary_entities); + expect(data.type).assertEqual("MIMETYPE"); + expect(data.uri).assertEqual("key={true,true,false}"); + expect(data.options.authReadUriPermission).assertEqual(true); + expect(data.options.authWriteUriPermission).assertEqual(true); + expect(data.options.abilityForwardResult).assertEqual(false); + expect(data.options.abilityContinuation).assertEqual(false); + expect(data.options.notOhosComponent).assertEqual(true); + expect(data.options.abilityFormEnabled).assertEqual(true); + expect(data.options.authPersistableUriPermission).assertEqual(true); + expect(data.options.authPrefixUriPermission).assertEqual(false); + expect(data.options.abilitySliceMultiDevice).assertEqual(false); + expect(data.options.startForegroundAbility).assertEqual(true); + expect(data.options.installOnDemand).assertEqual(false); + expect(data.options.abilitySliceForwardResult).assertEqual(true); + expect(data.options.installWithBackgroundMode).assertEqual(true); + expect(data.parameters.mykey0).assertEqual(2222); + CompareArray(data.parameters.mykey1, ary_int); + expect(data.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.parameters.mykey3).assertEqual("ssssssssssssssssssssssssss"); + CompareArray(data.parameters.mykey4, ary_bool); + CompareArray(data.parameters.mykey5, ary_string); + expect(data.parameters.mykey6).assertEqual(true); + + done(); + }); + expect(want).assertEqual(null); + done(); + }) + + console.log("AceApplication : ActsWantATest end"); +}) diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/js/test/List.test.js b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c4570fa8cd59530b7dc5b4016c8ae6d6068336fc --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./GetWantTest_0100.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/want/project/GetWant/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d405647b90183b99fb4e15025a9fe12c85c495d4 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/want/project/GetWant/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/want/project/GetWant/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/want/project/GetWant2/package.json b/aafwk/aafwk_standard/want/project/GetWant2/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/config.json b/aafwk/aafwk_standard/want/project/GetWant2/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..84d3f9916dbb1f858fe16106fb487268a368b36b --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/config.json @@ -0,0 +1,52 @@ +{ + "app": { + "bundleName": "com.want.test", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example2.getwant", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "GetWant", + "moduleType": "feature", + "installationFree": true + }, + "abilities": [ + { + "visible": true, + "name": "com.example.getwant0200.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/app.js b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..175d95cefa078d12b0ace7c4319fef3b225b70c4 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + getWant1启动 + + +
diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..78f11b244e17563608f2e1da2773739776901aef --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/default/pages/index/index.js @@ -0,0 +1,46 @@ +/* + * 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 app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/test/GetWantTest_0200.js b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/test/GetWantTest_0200.js new file mode 100644 index 0000000000000000000000000000000000000000..d03376bd9130de77848683364a62810c82c2bda8 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/test/GetWantTest_0200.js @@ -0,0 +1,83 @@ +/* + * 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 featureAbility from '@ohos.ability.featureability' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsWantBTest', function () { + const ary_entities = ["entity1"]; + const ary_int = [1, 2, 3]; + const ary_bool = [false, true, false]; + const ary_string = ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"]; + + function CompareArray(ary1, ary2) { + expect(ary1.length).assertEqual(ary2.length); + if (ary1.length == ary2.length) { + for (let i=0;i { + expect(typeof(data)).assertEqual("object"); + expect(data.deviceId).assertEqual("deviceId"); + expect(data.bundleName).assertEqual("com.want.test"); + expect(data.abilityName).assertEqual("com.example.getwant0200.MainAbility"); + expect(data.action).assertEqual("action1"); + + CompareArray(data.parameters.mykey1, ary_int); + expect(data.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.parameters.mykey3).assertEqual("ssssssssssssssssssssssssss"); + CompareArray(data.parameters.mykey4, ary_bool); + CompareArray(data.parameters.mykey5, ary_string); + expect(data.parameters.mykey6).assertEqual(true); + + done(); + } + ).catch(error => + console.log("featureAbility getWant::catch : " + error) + ); + }) + + // @tc.number: ACTS_GetWant_0500 + // @tc.name: getWant : get want in current ability + // @tc.desc: get want in current ability (by callback) + it('ACTS_GetWant_0500', 0, async function (done) { + var want = featureAbility.getWant( + (err, data) => { + expect(typeof(data)).assertEqual("object"); + expect(data.deviceId).assertEqual("deviceId"); + expect(data.bundleName).assertEqual("com.want.test"); + expect(data.abilityName).assertEqual("com.example.getwant0200.MainAbility"); + expect(data.action).assertEqual("action1"); + + CompareArray(data.parameters.mykey1, ary_int); + expect(data.parameters.mykey2).assertEqual("[1, 2, 3]"); + expect(data.parameters.mykey3).assertEqual("ssssssssssssssssssssssssss"); + CompareArray(data.parameters.mykey4, ary_bool); + CompareArray(data.parameters.mykey5, ary_string); + expect(data.parameters.mykey6).assertEqual(true); + + done(); + }); + }) + + console.log("AceApplication : ActsWantBTest end"); +}) diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/test/List.test.js b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bd314eda85bdd4fb926f51e457ea23574ff18ca8 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./GetWantTest_0200.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/want/project/GetWant2/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..d405647b90183b99fb4e15025a9fe12c85c495d4 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/GetWant2/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "MyApplication" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/GetWant2/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/want/project/GetWant2/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/want/project/GetWant2/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/want/project/entry/package.json b/aafwk/aafwk_standard/want/project/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/config.json b/aafwk/aafwk_standard/want/project/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c07cc12ef792c2969e57348a477f51a894c24708 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.want.test", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.want.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.want.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..3ee099f58926b1a7c42f02bb88ebb4998f9e4ac4 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/app.js @@ -0,0 +1,22 @@ +/* + * 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 { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..175d95cefa078d12b0ace7c4319fef3b225b70c4 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + getWant1启动 + + +
diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..78f11b244e17563608f2e1da2773739776901aef --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,46 @@ +/* + * 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 app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/want/project/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..408552a6f69c7506fb95a56078d494ba888a9343 --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/js/test/List.test.js @@ -0,0 +1,15 @@ +/* + * 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. + */ +require('./WantTest.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/js/test/WantTest.js b/aafwk/aafwk_standard/want/project/entry/src/main/js/test/WantTest.js new file mode 100644 index 0000000000000000000000000000000000000000..2b4428750b517a1d4f7afc9040660c3f03e426ed --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/js/test/WantTest.js @@ -0,0 +1,110 @@ +/* + * 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 featureAbility from '@ohos.ability.featureability' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSetWantTest', function () { + // @tc.number: ACTS_SetWant_0100 + // @tc.name: startAbility + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_SetWant_0100', 0, async function (done) { + var promise = await featureAbility.startAbility( + { + want: + { + deviceId: "deviceId", + bundleName: "com.want.test", + abilityName: "com.example.getwant0100.MainAbility", + action: "action1", + entities: ["entity1"], + type: "MIMETYPE", + uri: "key={true,true,false}", + options: + { + authReadUriPermission: true, + // indicates the grant to perform write operations on the URI + authWriteUriPermission: true, + // support forward intent result to origin ability + abilityForwardResult: false, + // used for marking the ability start-up is triggered by continuation + abilityContinuation: false, + // specifies whether a component does not belong to ohos + notOhosComponent: true, + // specifies whether an ability is started + abilityFormEnabled: true, + // indicates the grant for possible persisting on the URI. + authPersistableUriPermission: true, + // indicates the grant for possible persisting on the URI. + authPrefixUriPermission: false, + // support distributed scheduling system start up multiple devices + abilitySliceMultiDevice: false, + // indicates that an ability using the service template is started regardless of whether the + // host application has been started. + startForegroundAbility: true, + // install the specified ability if it's not installed. + installOnDemand: false, + // return result to origin ability slice + abilitySliceForwardResult: true, + // install the specified ability with background mode if it's not installed. + installWithBackgroundMode: true, + }, + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + }, + }, + }, + ); + done(); + }) + + // @tc.number: ACTS_SetWant_0200 + // @tc.name: startAbility + // @tc.desc: Check the return value of the interface (by Promise) + it('ACTS_SetWant_0200', 0, async function (done) { + var callback = featureAbility.startAbility( + { + want: + { + deviceId: "deviceId", + bundleName: "com.want.test", + abilityName: "com.example.getwant0200.MainAbility", + action: "action1", + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: "[1, 2, 3]", + mykey3: "ssssssssssssssssssssssssss", + mykey4: [false, true, false], + mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"], + mykey6: true, + }, + }, + }, + (err, data) => { + done(); + } + ); + }) + + +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/want/project/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/aafwk/aafwk_standard/want/project/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/want/project/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/want/project/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/want/project/entry/src/main/resources/base/media/icon.png differ diff --git a/appexecfwk/bundle_standard/bmsJstest1/BUILD.gn b/appexecfwk/bundle_standard/bmsJstest1/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..6f77ff6bf305cee2987f0435620728694d217a82 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("hjs_demo_test1") { + test_hap_name = "bmsJstest1.hap" + hap_source_path = "hap/bmsJstest1.hap" +} diff --git a/appexecfwk/bundle_standard/bmsJstest1/Test.json b/appexecfwk/bundle_standard/bmsJstest1/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a66d99d7f1053847908cb526b7abf7424804e960 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "21600000", + "package": "ohos.acts.aafwk.ability", + "shell-timeout": "21600000" + }, + "kits": [ + { + "test-file-name": [ + "AbilityDemo.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/package.json b/appexecfwk/bundle_standard/bmsJstest1/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/config.json b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..bd0e029b31f7a27392eb3383c963b0f4fced9b35 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "bundleName": "com.example.napi_test_suite", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + + + "package": "com.example.napi_test_suite", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.napi_test_suite.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "name": "com.permission.CAMERA", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "CAMERA permission", + "description": "CAMERA permission in detail" + }, + { + "name": "com.permission.music", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "music permission", + "description": "music permission in detail" + }, + { + "name": "com.permission.WeChat", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "WeChat permission", + "description": "WeChat permission in detail" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5790b249d899277488f4267b0a37c150605137ad --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..14fab5d06960191d8decbd7fa2727a2eddaba481 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/test/ExampleJsunit.test.js @@ -0,0 +1,909 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import demo from '@ohos.bundle_mgr' + +describe('appInfoTest', function () { + it('getApplicationInfos_0100', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + it('getApplicationInfos_0600', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + + it('getApplicationInfo_0100', 0, async function (done) { + var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1); + checkgetApplicationInfo(datainfo) + done(); + }) + + function checkgetApplicationInfo(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + + it('getApplicationInfo_0600', 0, async function (done) { + await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + done(); + }) + + + it('getBundleInfos_0100', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + + it('getBundleInfos_0600', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + + + it('getApplicationInfo_0400', 0, async function (done) { + var datainfo = await demo.getApplicationInfo('com.example.napi_test_suitee', 8, 1); + checkgetApplicationInfoe(datainfo) + done(); + }) + + function checkgetApplicationInfoe(datainfo) { + expect(datainfo.name.length).assertEqual(0) + expect(datainfo.bundleName.length).assertEqual(0) + } + + it('getApplicationInfo_0500', 0, async function (done) { + await demo.getApplicationInfo('', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertEqual(0) + expect(datainfo.bundleName.length).assertEqual(0) + } + + done(); + }) + + it('getApplicationInfo_0900', 0, async function (done) { + await demo.getApplicationInfo('com.example.napi_test_suitee', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + done(); + }) + + it('getApplicationInfo_1000', 0, async function (done) { + await demo.getApplicationInfo('', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + done(); + }) + + it('getBundleInfo_0100', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleInfo('com.example.napi_test_suite',1) + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for(var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for(var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for(var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for(var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + done() + }) + it('getBundleInfo_0400', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleInfo('com.example.myapplic',1); + expect(datainfo.installTime).assertEqual(0) + expect(datainfo.updateTime).assertEqual(0) + expect(datainfo.compatibleVersion).assertEqual(0) + expect(datainfo.targetVersion).assertEqual(0) + + done(); + }) + it('getBundleInfo_0500', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleInfo(); + expect(datainfo.installTime).assertEqual(0) + expect(datainfo.updateTime).assertEqual(0) + expect(datainfo.compatibleVersion).assertEqual(0) + expect(datainfo.targetVersion).assertEqual(0) + done(); + }) + it('getBundleInfo_0600', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.getBundleInfo('com.example.myapplicationInstall',1,OnReceiveEvent) + function OnReceiveEvent(datainfo) { +// console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for(var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for(var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for(var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for(var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + } + done() + }) + it('getBundleInfo_0900', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleInfo('com.example.myapplical',1,OnReceiveEvent) + function OnReceiveEvent(datainfo) { + expect(datainfo.installTime).assertEqual(0) + expect(datainfo.updateTime).assertEqual(0) + expect(datainfo.compatibleVersion).assertEqual(0) + expect(datainfo.targetVersion).assertEqual(0) + } + done() + }) + it('getBundleInfo_1000', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleInfo(OnReceiveEvent) + function OnReceiveEvent(datainfo) { + expect(datainfo.installTime).assertEqual(0) + expect(datainfo.updateTime).assertEqual(0) + expect(datainfo.compatibleVersion).assertEqual(0) + expect(datainfo.targetVersion).assertEqual(0) + } + done() + }) + it('getBundleArchiveInfo_0100', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleArchiveInfo('/data/abc.hap',1) + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + expect(datainfo.hapModuleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.hapModuleNames.length; j++) { + // expect(datainfo.hapModuleNames[j].length).assertLarger(0) + // } + // expect(datainfo.moduleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleNames.length; j++) { + // expect(datainfo.moduleNames[j].length).assertLarger(0) + // } + // expect(datainfo.modulePublicDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.modulePublicDirs.length; j++) { + // expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + // } + // expect(datainfo.moduleDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleDirs.length; j++) { + // expect(datainfo.moduleDirs[j].length).assertLarger(0) + // } + done() + }) + it('getBundleArchiveInfo_0400', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleArchiveInfo('/data/test.', 1,OnReceiveEvent) + function OnReceiveEvent(datainfo) { + expect(datainfo.installTime).assertEqual(0) + expect(datainfo.updateTime).assertEqual(0) + expect(datainfo.compatibleVersion).assertEqual(0) + expect(datainfo.targetVersion).assertEqual(0) + } + done() + }) + it('getBundleArchiveInfo_0500', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleArchiveInfo(OnReceiveEvent) + function OnReceiveEvent(datainfo) { + expect(datainfo.installTime).assertEqual(0) + expect(datainfo.updateTime).assertEqual(0) + expect(datainfo.compatibleVersion).assertEqual(0) + expect(datainfo.targetVersion).assertEqual(0) + done() + } + }) + it('queryAbilityByWant_0100', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = + info.queryAbilityByWant({ + want:{ + action: "action.system.home", + entities:["entity.system.home"], + elementName: { + deviceId : "0", + bundleName : "com.example.myapplicationInstall", + abilityName : "com.example.myapplication.MainAbility", + },}},{ + params:{ + flags: 8 , + userId:"0" , + } + }) + console.info('**************************queryAbilityByWant_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for(var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for(var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done(); + }) + it('queryAbilityByWant_0400', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = + info.queryAbilityByWant({ + want:{ + action: "action.system.home", + entities:["entity.system.home"], + elementName: { + deviceId : "0", + bundleName : "com.example.myapplicationInstall", + abilityName : "", + },}},{ + params:{ + flags: 8 , + userId:"0" , + } + }) + console.info('**************************queryAbilityByWant_01********************************') + expect(datainfo.name.length).assertEqual(0) + expect(datainfo.label.length).assertEqual(0) + expect(datainfo.description.length).assertEqual(0) + expect(datainfo.iconPath.length).assertEqual(0) + expect(datainfo.visible.length).assertEqual(0) + expect(datainfo.kind.length).assertEqual(0) + expect(datainfo.package.length).assertEqual(0) + expect(datainfo.bundleName.length).assertEqual(0) + expect(datainfo.moduleName.length).assertEqual(0) + expect(datainfo.applicationName.length).assertEqual(0) + expect(datainfo.resourcePath.length).assertEqual(0) + expect(datainfo.deviceTypes.length).assertEqual(0) + for(var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertEqual(0) + } + expect(datainfo.deviceCapabilities.length).assertEqual(0) + for(var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertEqual(0) + } + expect(datainfo.applicationInfo.name.length).assertEqual(0) + expect(datainfo.applicationInfo.bundleName.length).assertEqual(0) + done(); + }) + it('queryAbilityByWant_0500', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = + info.queryAbilityByWant({ + want:{ + action: "action.system.home", + entities:["entity.system.home"], + elementName: { + deviceId : "0", + bundleName : "", + abilityName : "", + },}},{ + params:{ + flags: 8 , + userId:"0" , + } + }) + console.info('**************************queryAbilityByWant_01********************************') + expect(datainfo.name.length).assertEqual(0) + expect(datainfo.label.length).assertEqual(0) + expect(datainfo.description.length).assertEqual(0) + expect(datainfo.iconPath.length).assertEqual(0) + expect(datainfo.visible.length).assertEqual(0) + expect(datainfo.kind.length).assertEqual(0) + expect(datainfo.package.length).assertEqual(0) + expect(datainfo.bundleName.length).assertEqual(0) + expect(datainfo.moduleName.length).assertEqual(0) + expect(datainfo.applicationName.length).assertEqual(0) + expect(datainfo.resourcePath.length).assertEqual(0) + expect(datainfo.deviceTypes.length).assertEqual(0) + for(var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertEqual(0) + } + expect(datainfo.deviceCapabilities.length).assertEqual(0) + for(var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertEqual(0) + } + expect(datainfo.applicationInfo.name.length).assertEqual(0) + expect(datainfo.applicationInfo.bundleName.length).assertEqual(0) + done(); + }) + + + it('queryAbilityByWant_0600', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for(var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for(var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done() + } + }) + it('queryAbilityByWant_0600', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for(var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for(var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done() + } + }) + it('queryAbilityByWant_0900', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall", + abilityName: "", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertEqual(0) + expect(datainfo.label.length).assertEqual(0) + expect(datainfo.description.length).assertEqual(0) + expect(datainfo.iconPath.length).assertEqual(0) + expect(datainfo.visible.length).assertEqual(0) + expect(datainfo.kind.length).assertEqual(0) + expect(datainfo.package.length).assertEqual(0) + expect(datainfo.bundleName.length).assertEqual(0) + expect(datainfo.moduleName.length).assertEqual(0) + expect(datainfo.applicationName.length).assertEqual(0) + expect(datainfo.resourcePath.length).assertEqual(0) + expect(datainfo.deviceTypes.length).assertEqual(0) + for(var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertEqual(0) + } + expect(datainfo.deviceCapabilities.length).assertEqual(0) + for(var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertEqual(0) + } + expect(datainfo.applicationInfo.name.length).assertEqual(0) + expect(datainfo.applicationInfo.bundleName.length).assertEqual(0) + done(); + } + }) + it('queryAbilityByWant_0900', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "", + abilityName: "", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + },OnReceiveEvent) + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertEqual(0) + expect(datainfo.label.length).assertEqual(0) + expect(datainfo.description.length).assertEqual(0) + expect(datainfo.iconPath.length).assertEqual(0) + expect(datainfo.visible.length).assertEqual(0) + expect(datainfo.kind.length).assertEqual(0) + expect(datainfo.package.length).assertEqual(0) + expect(datainfo.bundleName.length).assertEqual(0) + expect(datainfo.moduleName.length).assertEqual(0) + expect(datainfo.applicationName.length).assertEqual(0) + expect(datainfo.resourcePath.length).assertEqual(0) + expect(datainfo.deviceTypes.length).assertEqual(0) + for(var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertEqual(0) + } + expect(datainfo.deviceCapabilities.length).assertEqual(0) + for(var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertEqual(0) + } + expect(datainfo.applicationInfo.name.length).assertEqual(0) + expect(datainfo.applicationInfo.bundleName.length).assertEqual(0) + done(); + } + }) + it('getPermissionDef_0100', 0, async function (done) { + demo.getPermissionDef('com.permission.CAMERA').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name.length).assertLarger(0); + expect(infos.descriptionId.length).assertLarger(0); + expect(infos.grantMode.length).assertLarger(0); + expect(infos.availableScope.length).assertLarger(0); + }); + done(); + }) + it('getPermissionDef_0400', 0, async function (done) { + demo.getPermissionDef('').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name.length).assertLarger(0); + expect(infos.descriptionId.length).assertEqual(0); + expect(infos.grantMode.length).assertEqual(0); + expect(infos.availableScope.length).assertEqual(0); + }); + done(); + }) + it('getPermissionDef_0500', 0, async function (done) { + demo.getPermissionDef('error').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name.length).assertLarger(0); + expect(infos.descriptionId.length).assertEqual(0); + expect(infos.grantMode.length).assertEqual(0); + expect(infos.availableScope.length).assertEqual(0); + }); + done(); + + }) + it('getPermissionDef_0600', 0, async function (done) { + demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent); + function OnReceiveEvent(data) { + expect(typeof infos).assertEqual("object"); + expect(data.name.length).assertLarger(0); + expect(data.descriptionId.length).assertEqual(0); + expect(data.grantMode.length).assertLarger(0); + expect(data.availableScope.length).assertLarger(0); + } + + done(); + }) + it('getPermissionDef_0900', 0, async function (done) { + demo.getPermissionDef('', OnReceiveEvent); + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.name.length).assertEqual(0); + expect(data.bundleName.length).assertEqual(0); + expect(data.descriptionId.length).assertEqual(0); + expect(data.grantMode.length).assertEqual(0); + expect(data.availableScope.length).assertEqual(0); + } + + done(); + }) + it('getPermissionDef_1000', 0, async function (done) { + demo.getPermissionDef('error', OnReceiveEvent); + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.name.length).assertEqual(0); + expect(data.bundleName.length).assertEqual(0); + expect(data.descriptionId.length).assertEqual(0); + expect(data.grantMode.length).assertEqual(0); + expect(data.availableScope.length).assertEqual(0); + } + + done(); + }) + it('install_0100', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.install(['/data/abc1.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + it('install_0400', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.install(['ERROR'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("STATUS_INSTALL_FAILURE_INVALID"); + } + }); + done(); + }) + it('install_0500', 0, async function (done) { + console.info("neu========================getBundleManager: for begin"); + demo.getBundleInstaller().then((data) => { + data.install([''], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("STATUS_INSTALL_FAILURE_INVALID"); + } + }); + done(); + }) + it('uninstall_0100', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.uninstall('com.example.myapplication1', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + it('uninstall_0400', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.uninstall('', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE_ABORTED"); + } + }); + done(); + }) + it('uninstall_0500', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.uninstall('', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("STATUS_UNINSTALL_FAILURE_ABORTED"); + } + }); + done(); + }) + + + +}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/test/List.test.js b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest1/entry/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest1/hap/bmsJstest1.hap b/appexecfwk/bundle_standard/bmsJstest1/hap/bmsJstest1.hap new file mode 100644 index 0000000000000000000000000000000000000000..e7949b17d46c2456b6c5fd242561a4596206a59a Binary files /dev/null and b/appexecfwk/bundle_standard/bmsJstest1/hap/bmsJstest1.hap differ diff --git a/appexecfwk/bundle_standard/bmsJstest2/BUILD.gn b/appexecfwk/bundle_standard/bmsJstest2/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0b6571eaf5f3eb7302943c0366f7295d2c68c9c0 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("hjs_demo_test2") { + test_hap_name = "bmsJstest2.hap" + hap_source_path = "hap/bmsJstest2.hap" +} diff --git a/appexecfwk/bundle_standard/bmsJstest2/Test.json b/appexecfwk/bundle_standard/bmsJstest2/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a66d99d7f1053847908cb526b7abf7424804e960 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "21600000", + "package": "ohos.acts.aafwk.ability", + "shell-timeout": "21600000" + }, + "kits": [ + { + "test-file-name": [ + "AbilityDemo.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/package.json b/appexecfwk/bundle_standard/bmsJstest2/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/config.json b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..bd0e029b31f7a27392eb3383c963b0f4fced9b35 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "bundleName": "com.example.napi_test_suite", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + + + "package": "com.example.napi_test_suite", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.napi_test_suite.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "name": "com.permission.CAMERA", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "CAMERA permission", + "description": "CAMERA permission in detail" + }, + { + "name": "com.permission.music", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "music permission", + "description": "music permission in detail" + }, + { + "name": "com.permission.WeChat", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "WeChat permission", + "description": "WeChat permission in detail" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5790b249d899277488f4267b0a37c150605137ad --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..f4c3d2a47bfed9f7b457e39db30a941481ba0299 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/test/ExampleJsunit.test.js @@ -0,0 +1,637 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import demo from '@ohos.bundle_mgr' + +describe('appInfoTest', function () { + + + it('getApplicationInfos_0200', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + it('getApplicationInfos_0400', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + + it('getApplicationInfos_0700', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + it('getApplicationInfos_0900', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + it('getApplicationInfo_0200', 0, async function (done) { + var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1); + checkgetApplicationInfo(datainfo) + done(); + }) + + function checkgetApplicationInfo(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + it('getApplicationInfo_0700', 0, async function (done) { + await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + done(); + }) + it('getBundleInfos_0200', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + }) + it('getBundleInfos_0400', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + it('getBundleInfos_0700', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + + it('getBundleInfos_0700', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + it('getBundleInfos_0900', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + it('getBundleInfo_0200', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleInfo('com.example.napi_test_suite', 1) + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + done() + }) + it('getBundleInfo_0700', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.getBundleInfo('com.example.napi_test_suite', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + } + + done() + }) + it('getBundleArchiveInfo_0200', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1) + + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + expect(datainfo.hapModuleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.hapModuleNames.length; j++) { + // expect(datainfo.hapModuleNames[j].length).assertLarger(0) + // } + // expect(datainfo.moduleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleNames.length; j++) { + // expect(datainfo.moduleNames[j].length).assertLarger(0) + // } + // expect(datainfo.modulePublicDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.modulePublicDirs.length; j++) { + // expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + // } + // expect(datainfo.moduleDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleDirs.length; j++) { + // expect(datainfo.moduleDirs[j].length).assertLarger(0) + // } + done() + }) + it('getBundleArchiveInfo_0700', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + done() + } + }) + + it('queryAbilityByWant_0100', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = + info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }) + console.info('**************************queryAbilityByWant_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done(); + }) + it('queryAbilityByWant_0700', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done() + } + }) + it('getPermissionDef_0200', 0, async function (done) { + demo.getPermissionDef('com.permission.music').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name.length).assertLarger(0); + expect(infos.descriptionId.length).assertLarger(0); + expect(infos.grantMode.length).assertLarger(0); + expect(infos.availableScope.length).assertLarger(0); + }); + done(); + }) + it('getPermissionDef_0700', 0, async function (done) { + demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent); + demo.getPermissionDef('com.permission.music', OnReceiveEvent); + + function OnReceiveEvent(data) { + expect(data.name.length).assertLarger(0); + expect(data.descriptionId.length).assertEqual(0); + expect(data.grantMode.length).assertLarger(0); + expect(data.availableScope.length).assertLarger(0); + } + + done(); + }) + it('install_0200', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.install(['/data/abc2.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + data.install(['/data/abc3.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(infos) { + expect(typeof infos).assertEqual("object"); + expect(infos.status).assertEqual(0); + expect(infos.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + it('uninstall_0200', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.uninstall('com.example.myapplication2', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + // data.uninstall('com.example.myapplication2', { + // param: { + // userId: 0, + // isKeepData: false + // } + // }, OnReceiveinstallEvent); + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) +}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/test/List.test.js b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest2/entry/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest2/hap/bmsJstest2.hap b/appexecfwk/bundle_standard/bmsJstest2/hap/bmsJstest2.hap new file mode 100644 index 0000000000000000000000000000000000000000..0c22acef012df016f5890b3395c2ab6954a5808f Binary files /dev/null and b/appexecfwk/bundle_standard/bmsJstest2/hap/bmsJstest2.hap differ diff --git a/appexecfwk/bundle_standard/bmsJstest3/BUILD.gn b/appexecfwk/bundle_standard/bmsJstest3/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0b901de86f4d35a2ee35f8fa78b70c4ae0500efb --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("hjs_demo_test3") { + test_hap_name = "bmsJstest3.hap" + hap_source_path = "hap/bmsJstest3.hap" +} diff --git a/appexecfwk/bundle_standard/bmsJstest3/Test.json b/appexecfwk/bundle_standard/bmsJstest3/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a66d99d7f1053847908cb526b7abf7424804e960 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "21600000", + "package": "ohos.acts.aafwk.ability", + "shell-timeout": "21600000" + }, + "kits": [ + { + "test-file-name": [ + "AbilityDemo.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/package.json b/appexecfwk/bundle_standard/bmsJstest3/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/config.json b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2aaf77cc49bf11395079b80b47beb9a3d40aac3f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "bundleName": "com.example.napi_test_suite", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + + + "package": "com.example.napi_test_suite", + "name": ".MyApplication2", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.napi_test_suite.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "name": "com.permission.CAMERA", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "CAMERA permission", + "description": "CAMERA permission in detail" + }, + { + "name": "com.permission.music", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "music permission", + "description": "music permission in detail" + }, + { + "name": "com.permission.WeChat", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "WeChat permission", + "description": "WeChat permission in detail" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5790b249d899277488f4267b0a37c150605137ad --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..24e6fc796ee07c8adc18211867087dbe654d1f5a --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/test/ExampleJsunit.test.js @@ -0,0 +1,609 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import demo from '@ohos.bundle_mgr' + +describe('appInfoTest', function () { + + + it('getApplicationInfos_0200', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + it('getApplicationInfos_0400', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + + it('getApplicationInfos_0700', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + it('getApplicationInfos_0900', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + + it('getApplicationInfo_0200', 0, async function (done) { + var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1); + checkgetApplicationInfo(datainfo) + done(); + }) + + function checkgetApplicationInfo(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + + it('getApplicationInfo_0700', 0, async function (done) { + await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + done(); + }) + + + it('getBundleInfos_0200', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + it('getBundleInfos_0400', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + + it('getBundleInfos_0700', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + + it('getBundleInfos_0900', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + it('getBundleInfo_0200', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleInfo('com.example.napi_test_suite', 1) + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + done() + }) + it('getBundleInfo_0700', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.getBundleInfo('com.example.napi_test_suite', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + } + + done() + }) + it('getBundleArchiveInfo_0200', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1) + + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + expect(datainfo.hapModuleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.hapModuleNames.length; j++) { + // expect(datainfo.hapModuleNames[j].length).assertLarger(0) + // } + // expect(datainfo.moduleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleNames.length; j++) { + // expect(datainfo.moduleNames[j].length).assertLarger(0) + // } + // expect(datainfo.modulePublicDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.modulePublicDirs.length; j++) { + // expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + // } + // expect(datainfo.moduleDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleDirs.length; j++) { + // expect(datainfo.moduleDirs[j].length).assertLarger(0) + // } + done() + }) + it('getBundleArchiveInfo_0700', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + done() + } + }) + + it('queryAbilityByWant_0100', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = + info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }) + console.info('**************************queryAbilityByWant_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done(); + }) + it('queryAbilityByWant_0700', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done() + } + }) + it('getPermissionDef_0200', 0, async function (done) { + demo.getPermissionDef('com.permission.music').then((infos) => { + expect(typeof infos).assertEqual("object"); + expect(infos.name.length).assertLarger(0); + expect(infos.descriptionId.length).assertLarger(0); + expect(infos.grantMode.length).assertLarger(0); + expect(infos.availableScope.length).assertLarger(0); + }); + done(); + }) + it('getPermissionDef_0700', 0, async function (done) { + demo.getPermissionDef('com.permission.CAMERA', OnReceiveEvent); + demo.getPermissionDef('com.permission.music', OnReceiveEvent); + + function OnReceiveEvent(data) { + expect(data.name.length).assertLarger(0); + expect(data.descriptionId.length).assertEqual(0); + expect(data.grantMode.length).assertLarger(0); + expect(data.availableScope.length).assertLarger(0); + } + + done(); + }) + it('install_0200', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.install(['/data/abc2.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + data.install(['/data/abc3.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(infos) { + expect(typeof infos).assertEqual("object"); + expect(infos.status).assertEqual(0); + expect(infos.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + it('uninstall_0200', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.uninstall('com.example.myapplication2', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + // data.uninstall('com.example.myapplication2', { + // param: { + // userId: 0, + // isKeepData: false + // } + // }, OnReceiveinstallEvent); + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + + +}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/test/List.test.js b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest3/entry/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest3/hap/bmsJstest3.hap b/appexecfwk/bundle_standard/bmsJstest3/hap/bmsJstest3.hap new file mode 100644 index 0000000000000000000000000000000000000000..018943e1efa38ac7fd6115cb7475fa48c6c95524 Binary files /dev/null and b/appexecfwk/bundle_standard/bmsJstest3/hap/bmsJstest3.hap differ diff --git a/appexecfwk/bundle_standard/bmsJstest4/BUILD.gn b/appexecfwk/bundle_standard/bmsJstest4/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..2c0512ca400c025ae2758808cd8c2245f512c330 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("hjs_demo_test4") { + test_hap_name = "bmsJstest4.hap" + hap_source_path = "hap/bmsJstest4.hap" +} diff --git a/appexecfwk/bundle_standard/bmsJstest4/Test.json b/appexecfwk/bundle_standard/bmsJstest4/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a66d99d7f1053847908cb526b7abf7424804e960 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "21600000", + "package": "ohos.acts.aafwk.ability", + "shell-timeout": "21600000" + }, + "kits": [ + { + "test-file-name": [ + "AbilityDemo.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/package.json b/appexecfwk/bundle_standard/bmsJstest4/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/config.json b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..bd0e029b31f7a27392eb3383c963b0f4fced9b35 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "bundleName": "com.example.napi_test_suite", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + + + "package": "com.example.napi_test_suite", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.napi_test_suite.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "name": "com.permission.CAMERA", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "CAMERA permission", + "description": "CAMERA permission in detail" + }, + { + "name": "com.permission.music", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "music permission", + "description": "music permission in detail" + }, + { + "name": "com.permission.WeChat", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "WeChat permission", + "description": "WeChat permission in detail" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5790b249d899277488f4267b0a37c150605137ad --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..11a790b4ae20a5f0ab8d07921124f02c10f29529 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/test/ExampleJsunit.test.js @@ -0,0 +1,597 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import demo from '@ohos.bundle_mgr' + +describe('appInfoTest', function () { + + + it('getApplicationInfos_0300', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + it('getApplicationInfos_0500', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + + it('getApplicationInfos_0800', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + it('getApplicationInfos_1000', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + it('getApplicationInfo_0300', 0, async function (done) { + var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1); + checkgetApplicationInfo(datainfo) + done(); + }) + + function checkgetApplicationInfo(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + + it('getApplicationInfo_0800', 0, async function (done) { + await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + done(); + }) + + + it('getBundleInfos_0300', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + it('getBundleInfos_0500', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + + it('getBundleInfos_0800', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + + it('getBundleInfos_1000', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + it('getBundleInfo_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleInfo('com.example.napi_test_suite', 1) + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + done() + }) + it('getBundleInfo_0800', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.getBundleInfo('com.example.napi_test_suite', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + } + + done() + }) + it('getBundleArchiveInfo_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1) + + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + expect(datainfo.hapModuleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.hapModuleNames.length; j++) { + // expect(datainfo.hapModuleNames[j].length).assertLarger(0) + // } + // expect(datainfo.moduleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleNames.length; j++) { + // expect(datainfo.moduleNames[j].length).assertLarger(0) + // } + // expect(datainfo.modulePublicDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.modulePublicDirs.length; j++) { + // expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + // } + // expect(datainfo.moduleDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleDirs.length; j++) { + // expect(datainfo.moduleDirs[j].length).assertLarger(0) + // } + done() + }) + it('getBundleArchiveInfo_0800', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + done() + } + }) + + it('queryAbilityByWant_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = + info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }) + console.info('**************************queryAbilityByWant_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done(); + }) + it('queryAbilityByWant_0800', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done() + } + }) + it('install_0300', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.install(['/data/abc4.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + data.install(['/data/abc5.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + data.install(['/data/abc6.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(infos) { + expect(typeof infos).assertEqual("object"); + expect(infos.status).assertEqual(0); + expect(infos.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + it('uninstall_0300', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.uninstall('com.example.myapplication4', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + // data.uninstall('com.example.myapplication4', { + // param: { + // userId: 0, + // isKeepData: false + // } + // }, OnReceiveinstallEvent); + data.uninstall('com.example.myapplication5', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + +}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/test/List.test.js b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest4/entry/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest4/hap/bmsJstest4.hap b/appexecfwk/bundle_standard/bmsJstest4/hap/bmsJstest4.hap new file mode 100644 index 0000000000000000000000000000000000000000..2b06147a3722a8c94f28e3ee455f376d1e3fcaf6 Binary files /dev/null and b/appexecfwk/bundle_standard/bmsJstest4/hap/bmsJstest4.hap differ diff --git a/appexecfwk/bundle_standard/bmsJstest5/BUILD.gn b/appexecfwk/bundle_standard/bmsJstest5/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..298668db91f187ac3125c0cf29307b0841286088 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("hjs_demo_test5") { + test_hap_name = "bmsJstest5.hap" + hap_source_path = "hap/bmsJstest5.hap" +} diff --git a/appexecfwk/bundle_standard/bmsJstest5/Test.json b/appexecfwk/bundle_standard/bmsJstest5/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a66d99d7f1053847908cb526b7abf7424804e960 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "21600000", + "package": "ohos.acts.aafwk.ability", + "shell-timeout": "21600000" + }, + "kits": [ + { + "test-file-name": [ + "AbilityDemo.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/package.json b/appexecfwk/bundle_standard/bmsJstest5/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/config.json b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2aaf77cc49bf11395079b80b47beb9a3d40aac3f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "bundleName": "com.example.napi_test_suite", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + + + "package": "com.example.napi_test_suite", + "name": ".MyApplication2", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.napi_test_suite.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "name": "com.permission.CAMERA", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "CAMERA permission", + "description": "CAMERA permission in detail" + }, + { + "name": "com.permission.music", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "music permission", + "description": "music permission in detail" + }, + { + "name": "com.permission.WeChat", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "WeChat permission", + "description": "WeChat permission in detail" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5790b249d899277488f4267b0a37c150605137ad --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..93a01c35a316d82427d5b47ba2411419518c024f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/test/ExampleJsunit.test.js @@ -0,0 +1,598 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import demo from '@ohos.bundle_mgr' + +describe('appInfoTest', function () { + + + it('getApplicationInfos_0300', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + it('getApplicationInfos_0500', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + + it('getApplicationInfos_0800', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + it('getApplicationInfos_1000', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + it('getApplicationInfo_0300', 0, async function (done) { + var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1); + checkgetApplicationInfo(datainfo) + done(); + }) + + function checkgetApplicationInfo(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + + it('getApplicationInfo_0800', 0, async function (done) { + await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + done(); + }) + + + it('getBundleInfos_0300', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + it('getBundleInfos_0500', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + + it('getBundleInfos_0800', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + + it('getBundleInfos_1000', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + + it('getBundleInfo_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleInfo('com.example.napi_test_suite', 1) + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + done() + }) + it('getBundleInfo_0800', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.getBundleInfo('com.example.napi_test_suite', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + } + + done() + }) + it('getBundleArchiveInfo_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1) + + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + expect(datainfo.hapModuleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.hapModuleNames.length; j++) { + // expect(datainfo.hapModuleNames[j].length).assertLarger(0) + // } + // expect(datainfo.moduleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleNames.length; j++) { + // expect(datainfo.moduleNames[j].length).assertLarger(0) + // } + // expect(datainfo.modulePublicDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.modulePublicDirs.length; j++) { + // expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + // } + // expect(datainfo.moduleDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleDirs.length; j++) { + // expect(datainfo.moduleDirs[j].length).assertLarger(0) + // } + done() + }) + it('getBundleArchiveInfo_0800', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + done() + } + }) + + it('queryAbilityByWant_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = + info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }) + console.info('**************************queryAbilityByWant_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done(); + }) + it('queryAbilityByWant_0800', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done() + } + }) + it('install_0300', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.install(['/data/abc4.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + data.install(['/data/abc5.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + data.install(['/data/abc6.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(infos) { + expect(typeof infos).assertEqual("object"); + expect(infos.status).assertEqual(0); + expect(infos.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + it('uninstall_0300', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.uninstall('com.example.myapplication4', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + // data.uninstall('com.example.myapplication4', { + // param: { + // userId: 0, + // isKeepData: false + // } + // }, OnReceiveinstallEvent); + data.uninstall('com.example.myapplication5', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + +}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/test/List.test.js b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest5/entry/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest5/hap/bmsJstest5.hap b/appexecfwk/bundle_standard/bmsJstest5/hap/bmsJstest5.hap new file mode 100644 index 0000000000000000000000000000000000000000..74fd65de7eb3506cd55a1b40e24bcd4f6197802f Binary files /dev/null and b/appexecfwk/bundle_standard/bmsJstest5/hap/bmsJstest5.hap differ diff --git a/appexecfwk/bundle_standard/bmsJstest6/BUILD.gn b/appexecfwk/bundle_standard/bmsJstest6/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..35f1ae7f456b1bd49defbde4da12c81e495bee3b --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("hjs_demo_test6") { + test_hap_name = "bmsJstest6.hap" + hap_source_path = "hap/bmsJstest6.hap" +} diff --git a/appexecfwk/bundle_standard/bmsJstest6/Test.json b/appexecfwk/bundle_standard/bmsJstest6/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a66d99d7f1053847908cb526b7abf7424804e960 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/Test.json @@ -0,0 +1,19 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "21600000", + "package": "ohos.acts.aafwk.ability", + "shell-timeout": "21600000" + }, + "kits": [ + { + "test-file-name": [ + "AbilityDemo.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/package.json b/appexecfwk/bundle_standard/bmsJstest6/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/config.json b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..68a0af66ffa701e4854c43b24c19a42c07b4b7a9 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/config.json @@ -0,0 +1,85 @@ +{ + "app": { + "bundleName": "com.example.napi_test_suite3", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + + + "package": "com.example.napi_test_suite3", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.napi_test_suite3.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard" + } + ], + "defPermissions": [ + { + "name": "com.permission.CAMERA", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "CAMERA permission", + "description": "CAMERA permission in detail" + }, + { + "name": "com.permission.music", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "music permission", + "description": "music permission in detail" + }, + { + "name": "com.permission.WeChat", + "grantMode": "system_grant", + "availableScope": ["signature"], + "label": "WeChat permission", + "description": "WeChat permission in detail" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..5790b249d899277488f4267b0a37c150605137ad --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,40 @@ +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/test/ExampleJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..8fbfc2dc69a5440a06ee18c933a3c52b1a301758 --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/test/ExampleJsunit.test.js @@ -0,0 +1,598 @@ +import app from '@system.app' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import demo from '@ohos.bundle_mgr' + +describe('appInfoTest', function () { + + + it('getApplicationInfos_0300', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + it('getApplicationInfos_0500', 0, async function (done) { + var datainfo = await demo.getApplicationInfos(8, 0); + checkgetApplicationInfos(datainfo) + done(); + }) + + function checkgetApplicationInfos(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + + it('getApplicationInfos_0800', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + it('getApplicationInfos_1000', 0, async function (done) { + await demo.getApplicationInfos(8, 0, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.length).assertLarger(0) + for (var i = 0; i < datainfo.length; i++) { + expect(datainfo[i].name.length).assertLarger(0) + expect(datainfo[i].bundleName.length).assertLarger(0) + expect(datainfo[i].supportedModes).assertEqual(0) + expect(datainfo[i].moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo[i].moduleSourceDirs.length; j++) { + expect(datainfo[i].moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo[i].moduleInfos.length).assertLarger(0) + for (var 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) + } + expect(datainfo[i].entryDir.length).assertLarger(0) + expect(datainfo[i].codePath.length).assertLarger(0) + expect(datainfo[i].dataDir.length).assertLarger(0) + expect(datainfo[i].dataBaseDir.length).assertLarger(0) + expect(datainfo[i].cacheDir.length).assertLarger(0) + } + } + + done(); + }) + + it('getApplicationInfo_0300', 0, async function (done) { + var datainfo = await demo.getApplicationInfo('com.example.napi_test_suite', 8, 1); + checkgetApplicationInfo(datainfo) + done(); + }) + + function checkgetApplicationInfo(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + + it('getApplicationInfo_0800', 0, async function (done) { + await demo.getApplicationInfo('com.example.napi_test_suite3', 8, 1, OnReceiveEvent); + + function OnReceiveEvent(datainfo) { + expect(typeof datainfo).assertEqual("object") + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.supportedModes).assertEqual(0) + expect(datainfo.moduleSourceDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleSourceDirs.length; j++) { + expect(datainfo.moduleSourceDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleInfos.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleInfos.length; j++) { + expect(datainfo.moduleInfos[j].moduleName.length).assertLarger(0) + expect(datainfo.moduleInfos[j].moduleSourceDir.length).assertLarger(0) + } + expect(datainfo.entryDir.length).assertLarger(0) + expect(datainfo.codePath.length).assertLarger(0) + expect(datainfo.dataDir.length).assertLarger(0) + expect(datainfo.dataBaseDir.length).assertLarger(0) + expect(datainfo.cacheDir.length).assertLarger(0) + } + + done(); + }) + + + it('getBundleInfos_0300', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + it('getBundleInfos_0500', 0, async function () { + var data = await demo.getBundleInfos(8) + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + + + }) + + + it('getBundleInfos_0800', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + + it('getBundleInfos_1000', 0, async function () { + await demo.getBundleInfos(8, OnReceiveEvent) + + function OnReceiveEvent(data) { + expect(typeof data).assertEqual("object") + expect(data.length).assertLarger(0) + for (var i = 0; i < data.length; i++) { + expect(data[i].name.length).assertLarger(0) + expect(data[i].applicationInfo.name.length).assertLarger(0) + expect(data[i].applicationInfo.bundleName.length).assertLarger(0) + + expect(data[i].hapModuleNames.length).assertLarger(0) + for (var j = 0; j < data[i].hapModuleNames.length; j++) { + expect(data[i].hapModuleNames[j].length).assertLarger(0) + } + expect(data[i].moduleNames.length).assertLarger(0) + for (var j = 0; j < data[i].moduleNames.length; j++) { + expect(data[i].moduleNames[j].length).assertLarger(0) + } + expect(data[i].modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < data[i].modulePublicDirs.length; j++) { + expect(data[i].modulePublicDirs[j].length).assertLarger(0) + } + expect(data[i].moduleDirs.length).assertLarger(0) + for (var j = 0; j < data[i].moduleDirs.length; j++) { + expect(data[i].moduleDirs[j].length).assertLarger(0) + } + expect(data[i].moduleResPaths.length).assertLarger(0) + for (var j = 0; j < data[i].moduleResPaths.length; j++) { + expect(data[i].moduleResPaths[j].length).assertLarger(0) + } + expect(data[i].abilityInfos.length).assertLarger(0) + for (var j = 0; j < data[i].abilityInfos.length; j++) { + expect(data[i].abilityInfos[j].name.length).assertLarger(0) + expect(data[i].abilityInfos[j].package.length).assertLarger(0) + } + } + } + + }) + it('getBundleInfo_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleInfo('com.example.napi_test_suite3', 1) + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + done() + }) + it('getBundleInfo_0800', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.getBundleInfo('com.example.napi_test_suite3', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.vendor.length).assertLarger(0) + expect(datainfo.versionCode).assertEqual(1) + expect(datainfo.versionName).assertEqual(1.0) + expect(datainfo.minSdkVersion).assertEqual(0) + expect(datainfo.maxSdkVersion).assertEqual(0) + expect(datainfo.hapModuleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.hapModuleNames.length; j++) { + expect(datainfo.hapModuleNames[j].length).assertLarger(0) + } + expect(datainfo.moduleNames.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleNames.length; j++) { + expect(datainfo.moduleNames[j].length).assertLarger(0) + } + expect(datainfo.modulePublicDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.modulePublicDirs.length; j++) { + expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + } + expect(datainfo.moduleDirs.length).assertLarger(0) + for (var j = 0; j < datainfo.moduleDirs.length; j++) { + expect(datainfo.moduleDirs[j].length).assertLarger(0) + } + } + + done() + }) + it('getBundleArchiveInfo_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = await info.getBundleArchiveInfo('/data/abc2.hap', 1) + + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + expect(datainfo.hapModuleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.hapModuleNames.length; j++) { + // expect(datainfo.hapModuleNames[j].length).assertLarger(0) + // } + // expect(datainfo.moduleNames.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleNames.length; j++) { + // expect(datainfo.moduleNames[j].length).assertLarger(0) + // } + // expect(datainfo.modulePublicDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.modulePublicDirs.length; j++) { + // expect(datainfo.modulePublicDirs[j].length).assertLarger(0) + // } + // expect(datainfo.moduleDirs.length).assertLarger(0) + // for(var j = 0; j < datainfo.moduleDirs.length; j++) { + // expect(datainfo.moduleDirs[j].length).assertLarger(0) + // } + done() + }) + it('getBundleArchiveInfo_0800', 0, async function (done) { + var info = await demo.getBundleManager() + await info.getBundleArchiveInfo('/data/abc2.hap', 1, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + console.info('**************************getBundleInfo_01********************************') + expect(datainfo.entryModuleName.length).assertLarger(0) + expect(datainfo.compatibleVersion).assertEqual(5) + expect(datainfo.targetVersion).assertEqual(5) + expect(datainfo.isKeepAlive).assertEqual(false) + expect(datainfo.isNativeApp).assertEqual(false) + done() + } + }) + + it('queryAbilityByWant_0300', 0, async function (done) { + var info = await demo.getBundleManager() + var datainfo = + info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }) + console.info('**************************queryAbilityByWant_01********************************') + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done(); + }) + it('queryAbilityByWant_0800', 0, async function (done) { + + var info = await demo.getBundleManager() + await info.queryAbilityByWant({ + want: { + action: "action.system.home", + entities: ["entity.system.home"], + elementName: { + deviceId: "0", + bundleName: "com.example.myapplicationInstall2", + abilityName: "com.example.myapplication.MainAbility", + }, + } + }, { + params: { + flags: 8, + userId: "0", + } + }, OnReceiveEvent) + + function OnReceiveEvent(datainfo) { + expect(datainfo.name.length).assertLarger(0) + expect(datainfo.label.length).assertLarger(0) + expect(datainfo.description.length).assertLarger(0) + expect(datainfo.iconPath.length).assertLarger(0) + expect(datainfo.visible.length).assertLarger(0) + expect(datainfo.kind.length).assertLarger(0) + expect(datainfo.package.length).assertLarger(0) + expect(datainfo.bundleName.length).assertLarger(0) + expect(datainfo.moduleName.length).assertLarger(0) + expect(datainfo.applicationName.length).assertLarger(0) + expect(datainfo.resourcePath.length).assertLarger(0) + expect(datainfo.deviceTypes.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceTypes.length; j++) { + expect(datainfo.deviceTypes[j].length).assertLarger(0) + } + expect(datainfo.deviceCapabilities.length).assertLarger(0) + for (var j = 0; j < datainfo.deviceCapabilities.length; j++) { + expect(datainfo.deviceCapabilities[j].length).assertLarger(0) + } + expect(datainfo.applicationInfo.name.length).assertLarger(0) + expect(datainfo.applicationInfo.bundleName.length).assertLarger(0) + done() + } + }) + it('install_0300', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.install(['/data/abc4.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + data.install(['/data/abc5.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + data.install(['/data/abc6.hap'], { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(infos) { + expect(typeof infos).assertEqual("object"); + expect(infos.status).assertEqual(0); + expect(infos.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + it('uninstall_0300', 0, async function (done) { + demo.getBundleInstaller().then((data) => { + data.uninstall('com.example.myapplication4', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + // data.uninstall('com.example.myapplication4', { + // param: { + // userId: 0, + // isKeepData: false + // } + // }, OnReceiveinstallEvent); + data.uninstall('com.example.myapplication5', { + param: { + userId: 0, + isKeepData: false + } + }, OnReceiveinstallEvent); + + function OnReceiveinstallEvent(data) { + expect(typeof data).assertEqual("object"); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual("SUCCESS"); + } + }); + done(); + }) + + +}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/test/List.test.js b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..305eb5bb254cd4802afaffebe68fca2f9436159f --- /dev/null +++ b/appexecfwk/bundle_standard/bmsJstest6/entry/src/main/js/test/List.test.js @@ -0,0 +1 @@ +require('./ExampleJsunit.test.js') \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bmsJstest6/hap/bmsJstest6.hap b/appexecfwk/bundle_standard/bmsJstest6/hap/bmsJstest6.hap new file mode 100644 index 0000000000000000000000000000000000000000..493d6d7b3b937daa193c2874ad0de66ef0f1341c Binary files /dev/null and b/appexecfwk/bundle_standard/bmsJstest6/hap/bmsJstest6.hap differ diff --git a/notification/ces_standard/BUILD.gn b/notification/ces_standard/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..eb3530a89212c1eaeb0ebda0bd212ccb3e5bc02c --- /dev/null +++ b/notification/ces_standard/BUILD.gn @@ -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. +import("//build/ohos_var.gni") + +group("subscribeandpublish") { + testonly = true + if (is_standard_system) { + deps = [ "subscribeandpublish:ActsSubscriberTest" ] + } +} diff --git a/notification/ces_standard/subscribeandpublish/BUILD.gn b/notification/ces_standard/subscribeandpublish/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..0ca99183218e007a3e9298f25e503f3a22a24a99 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/contextJSUnit.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_01/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_01/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_01/Test.json b/notification/ces_standard/subscribeandpublish/hap_01/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fa321eabcc346e12a24db3d53f127b85929db916 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_01" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_01/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2735dcdbc7d7b747cb09ca009a66fea960676936 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test0100", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..bd1346ba6e7b5e5701229af13b5a8eb9eb844311 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,64 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + var CommonEventSubscriber0100; + + function PublishCallBack0100() { + console.info("==========================>PublishCallBack0100=======================>"); + } + + function CommonEventSubscribeInfoCallBack0100(data) { + console.info("==========================>CommonEventSubscribeInfoCallBack0100=======================>"); + expect(Array.isArray(data.events)).assertEqual(true); + expect(data.events[0]).assertEqual("publish_event0100"); + console.info("===============CommonEventSubscribeInfoCallBack0100 data.events[0] = " + data.events[0]); + } + + function SubscriberCallBack0100(data) { + console.info("==========================>SubscriberCallBack0100=======================>"); + expect(data.event).assertEqual("publish_event0100"); + console.info("==========================>SubscriberCallBack0100 event = " + data.event); + CommonEventSubscriber0100.getSubscribeInfo(CommonEventSubscribeInfoCallBack0100); + } + + function CreateSubscriberCallBack0100(data) { + console.info("==========================>CreateSubscriberCallBack0100=======================>"); + CommonEventSubscriber0100 = data; + } + + // @tc.number: ActsSubscriber_test_0100 + // @tc.name: verify subscribe and publish : Check subscribe and publish common event data + // @tc.desc: Check the subscriber can receive event "publish_event0100" type of the interface (by CallBack) + it('ActsSubscriber_test_0100', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["publish_event0100"], + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo, + CreateSubscriberCallBack0100 + ) + + await Subscriber.subscribe(CommonEventSubscriber0100, SubscriberCallBack0100); + + Subscriber.publish("publish_event0100", PublishCallBack0100); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_01/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_01/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_01/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..4e2bacdffa9f38b06f556b2133330f8349aa72e9 Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_01/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_02/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_02/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_02/Test.json b/notification/ces_standard/subscribeandpublish/hap_02/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..513a154228bf652c46774e8d1975cb86bfa18bc9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_02" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_02/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..bec20737fcc6e8d8ab33188eb8039ed1740e40fa --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test0200", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2121a6dacb288f6e20c39eff9568c4abce81482e --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,63 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + + var CommonEventSubscriber0200; + + function PublishCallBack0200() { + console.info("==========================>PublishCallBack0200=======================>"); + } + + function CommonEventSubscribeInfoCallBack0200(data) { + console.info("==========================>CommonEventSubscribeInfoCallBack0200=======================>"); + expect(Array.isArray(data.events)).assertEqual(true); + expect(data.events[0]).assertEqual("@#¥#3243adsafdf_中文"); + } + + function SubscriberCallBack0200(data) { + console.info("==========================>SubscriberCallBack0200=======================>"); + expect(data.event).assertEqual("@#¥#3243adsafdf_中文"); + CommonEventSubscriber0200.getSubscribeInfo(CommonEventSubscribeInfoCallBack0200); + } + + function CreateSubscriberCallBack0200(data) { + console.info("==========================>CreateSubscriberCallBack0200=======================>"); + CommonEventSubscriber0200 = data; + } + + // @tc.number: ActsSubscriber_test_0200 + // @tc.name: verify subscribe and publish : Check subscribe and publish common event data + // @tc.desc: Check the subscriber can receive event "@#¥#3243adsafdf_中文" type of the interface (by CallBack) + it('ActsSubscriber_test_0200', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["@#¥#3243adsafdf_中文"], + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo, + CreateSubscriberCallBack0200 + ) + + await Subscriber.subscribe(CommonEventSubscriber0200, SubscriberCallBack0200); + + Subscriber.publish("@#¥#3243adsafdf_中文", PublishCallBack0200); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_02/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_02/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_02/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..54ff7e3d93b4a0fc791a8dae8f9cf492ba8fcb5e Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_02/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_03/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_03/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_03/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_03/Test.json b/notification/ces_standard/subscribeandpublish/hap_03/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fa321eabcc346e12a24db3d53f127b85929db916 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_03/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_01" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_03/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_03/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..511274a8002e95f2b7013ea355ab38b0a4b7e930 Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_03/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_04/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_04/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_04/Test.json b/notification/ces_standard/subscribeandpublish/hap_04/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..632f2db29cbdd4115537ce4448a71df316ff10ff --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_04" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_04/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..fa34eac86222c5177f5d3b4b89f2620b0166c095 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test0400", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..72b6f1e6af17b4b2eca6d13cd3e63874e9d07471 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,81 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + + var CommonEventSubscriber0400; + + function PublishCallBack0400() { + console.info("==========================>PublishCallBack0400=======================>"); + } + + function CommonEventSubscribeInfoCallBack0400(data) { + console.info("==========================>CommonEventSubscribeInfoCallBack0400=======================>"); + expect(Array.isArray(data.events)).assertEqual(true); + expect(data.events[0]).assertEqual("PublishData0700"); + } + + function SubscriberCallBack0400(data) { + console.info("==========================>SubscriberCallBack0400=======================>"); + expect(data.event).assertEqual("publish_event0400"); + console.info("==========================>SubscriberCallBack0400 event = "+ data.event); + expect(data.bundleName).assertEqual("PublishBundleName0400"); + console.info("==========================>SubscriberCallBack0400 bundleName = "+ data.bundleName); + expect(data.code).assertEqual(55); + console.info("==========================>SubscriberCallBack0400 code = "+ data.code); + expect(data.data).assertEqual("PublishBundleName0400"); + console.info("==========================>SubscriberCallBack0100 data = " + data.data); + CommonEventSubscriber0400.getSubscribeInfo(CommonEventSubscribeInfoCallBack0400); + console.info("==========================>after call getSubscribeInfo=======================>"); + } + + function CreateSubscriberCallBack0400(data) { + console.info("==========================>CreateSubscriberCallBack0400=======================>"); + CommonEventSubscriber0400 = data; + } + + // @tc.number: ActsSubscriber_test_0400 + // @tc.name: verify subscribe and publish : Check subscribe and publish common event data with commoneventdata + // @tc.desc: Check the subscriber can receive event "publish_event0400" type of the interface (by CallBack) + it('ActsSubscriber_test_0400', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["publish_event0400"], + publisherDeviceId: "PublishDeviceId0100", + priority: 10, + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo, + CreateSubscriberCallBack0400 + ) + + await Subscriber.subscribe(CommonEventSubscriber0400, SubscriberCallBack0400); + + var CommonEventPublishData = { + isOrdered: false, + isSticky: false, + bundleName: "PublishBundleName0400", + code: 55, + data: "PublishData0700", + } + + Subscriber.publish("publish_event0400", CommonEventPublishData, PublishCallBack0400); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_04/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_04/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_04/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..b9f31cff9f041a7f74c5245fd31f466091290a9a Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_04/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_05/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_05/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_05/Test.json b/notification/ces_standard/subscribeandpublish/hap_05/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..9ba687d72987aa7e2ea14f09bc330266306c5bed --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_05" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_05/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..eef832a18339a064e4ac05b21591ba6423a8f212 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test0500", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..2a393ef5e4c20ff262f7e211e28a894b7a18587d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,67 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + + var CommonEventSubscriber0500; + + function PublishCallBack0500() { + console.info("==========================>PublishCallBack0500=======================>"); + } + + function OrderedCommonEventCallBack0500(data) { + console.info("==========================>OrderedCommonEventCallBack0500=======================>"); + expect(data).assertEqual(false); + } + + function SubscriberCallBack0500(data) { + console.info("==========================>SubscriberCallBack0500=======================>"); + expect(data.event).assertEqual("publish_event0500"); + CommonEventSubscriber0500.isOrderedCommonEvent(OrderedCommonEventCallBack0500); + } + + function CreateSubscriberCallBack0500(data) { + console.info("==========================>CreateSubscriberCallBack0500=======================>"); + CommonEventSubscriber0500 = data; + } + + // @tc.number: ActsSubscriber_test_0500 + // @tc.name: verify subscribe and publish : Check subscribe and publish sticky event + // @tc.desc: Check the subscriber can receive event "publish_event0500" type of the interface (by CallBack) + it('ActsSubscriber_test_0500', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["publish_event0500"] + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo, + CreateSubscriberCallBack0500 + ) + + await Subscriber.subscribe(CommonEventSubscriber0500, SubscriberCallBack0500); + + var CommonEventPublishData = { + isOrdered: false, + isSticky: true, + } + + Subscriber.publish("publish_event0500", CommonEventPublishData, PublishCallBack0500); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_05/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_05/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_05/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..98d24a0d8f5cf6925a3c9a89b6388ea3b00c1e73 Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_05/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_06/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_06/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_06/Test.json b/notification/ces_standard/subscribeandpublish/hap_06/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..9e01d6c73a1d6b8d383a0678d5ce8738b41558e8 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_06" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_06/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..7d3c6bbd5da07931bc755126c40a9bc74691cca0 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test0600", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..7795321714bab55f50df864f1249319b430b84b3 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,74 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + + var CommonEventSubscriber0600; + + function PublishCallBack0600() { + console.info("==========================>PublishCallBack0600=======================>"); + } + + function StickyCommonEventCallBack0600(data) { + console.info("==========================>StickyCommonEventCallBack0600=======================>"); + expect(data).assertEqual(true); + } + + + function SubscriberCallBack0600(data) { + console.info("==========================>SubscriberCallBack0600=======================>"); + } + + function SubscriberCallBack20600(data) { + console.info("==========================>SubscriberCallBack20600=======================>"); + expect(data.event).assertEqual("@#¥#3243adsafdf_"); + CommonEventSubscriber0600.isStickyCommonEvent(StickyCommonEventCallBack0600); + } + + function CreateSubscriberCallBack0600(data) { + console.info("==========================>CreateSubscriberCallBack0600=======================>"); + CommonEventSubscriber0600 = data; + } + + // @tc.number: ActsSubscriber_test_0600 + // @tc.name: verify subscribe and publish : Check the same subscribe and different callback, and Check publish sticky event + // @tc.desc: Check the subscriber can receive event "@#¥#3243adsafdf_" type of the interface (by CallBack) + it('ActsSubscriber_test_0600', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["@#¥#3243adsafdf_"] + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo, + CreateSubscriberCallBack0600 + ) + + await Subscriber.subscribe(CommonEventSubscriber0600, SubscriberCallBack0600); + await Subscriber.subscribe(CommonEventSubscriber0600, SubscriberCallBack20600); + + var CommonEventPublishData = { + isOrdered: false, + isSticky: true, + + } + + Subscriber.publish("@#¥#3243adsafdf_", CommonEventPublishData, PublishCallBack0600); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_06/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_06/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_06/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..90e8ad37595975ca4c0f59e46768cdf32ec993e3 Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_06/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_07/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_07/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_07/Test.json b/notification/ces_standard/subscribeandpublish/hap_07/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..09537906f3d7f61ee750108a4adbf375022fc19a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_07" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_07/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..2a9234b7939d647509ba03a9d6d4440dddea798d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test0700", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..21ff7299013f6424b99aee13432aff2ebf72cb65 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,62 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + + var CommonEventSubscriber0700; + + function PublishCallBack0700() { + console.info("==========================>PublishCallBack0700=======================>"); + } + + function SubscriberCallBack0700(data) { + console.info("==========================>SubscriberCallBack0700=======================>"); + expect(data.event).assertEqual("@#¥#3243adsafdf_中文"); + } + + // @tc.number: ActsSubscriber_test_0700 + // @tc.name: verify subscribe and publish : Check subscribe and publish sticky event + // @tc.desc: Check the subscriber can receive event "@#¥#3243adsafdf_中文" type of the interface (by CallBack) + function CreateSubscriberCallBack0700(data) { + console.info("==========================>CreateSubscriberCallBack0700=======================>"); + CommonEventSubscriber0700 = data; + } + + it('ActsSubscriber_test_0700', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["@#¥#3243adsafdf_中文"] + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo, + CreateSubscriberCallBack0700 + ) + + await Subscriber.subscribe(CommonEventSubscriber0700, SubscriberCallBack0700); + + var CommonEventPublishData = { + isOrdered: false, + isSticky: true, + } + + Subscriber.publish("@#¥#3243adsafdf_中文", CommonEventPublishData, PublishCallBack0700); + Subscriber.publish("@#¥#3243adsafdf_中文", CommonEventPublishData, PublishCallBack0700); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_07/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_07/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_07/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..7fa03ee337203b5d3c0afdee117f9bd43e0a70f4 Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_07/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_08/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_08/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_08/Test.json b/notification/ces_standard/subscribeandpublish/hap_08/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..e1c9f2ae3e8b5163d746d20b80de897002c94dd5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_08" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_08/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..dff7759903dda992b1c1b68bb47c7392bcaaec61 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test0800", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ce48f02c171499e7f3b77beb521bc4b2b569d256 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,58 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + + var CommonEventSubscriber0800; + + function PublishCallBack0800() { + console.info("==========================>PublishCallBack0800=======================>"); + } + + function SubscriberCallBack0800(data) { + console.info("==========================>SubscriberCallBack0800=======================>"); + expect(data.event).assertEqual("publish_event0800"); + CommonEventSubscriber0800.getSubscribeInfo().then((data) => { + console.info("==========================>getSubscribeInfoPromise0900=======================>"); + expect(Array.isArray(data.events)).assertEqual(true); + expect(data.events[0]).assertEqual("publish_event0900"); + }); + } + + // @tc.number: ActsSubscriber_test_0800 + // @tc.name: verify subscribe and publish : Check subscribe and publish common event + // @tc.desc: Check the subscriber can receive event "publish_event0800" type of the interface (by Promise) + it('ActsSubscriber_test_0800', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["publish_event0800"] + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo + ).then((data) => { + console.info("==========================>createSubscriberPromise0800=======================>"); + CommonEventSubscriber0800 = data; + }); + + await Subscriber.subscribe(CommonEventSubscriber0800, SubscriberCallBack0800); + + Subscriber.publish("publish_event0800", PublishCallBack0800); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_08/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_08/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_08/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..689f3d28561b79d985b1adc77cfa9735604e53c4 Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_08/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_09/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_09/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_09/Test.json b/notification/ces_standard/subscribeandpublish/hap_09/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fda6bf0fd484b8b3615d3120f48faee8494381fc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_09" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_09/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..683d0d8641b37cd8be65087fe6258b07614b2d0b --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test0900", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..5cd8d4400c7a581c9a1ca4198f581c728cfcfc2f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,62 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + + var CommonEventSubscriber0900; + + function PublishCallBack0900() { + console.info("==========================>PublishCallBack0900=======================>"); + } + + function SubscriberCallBack0900(data) { + console.info("==========================>SubscriberCallBack0900=======================>"); + expect(data.event).assertEqual("publish_event0900"); + CommonEventSubscriber0900.isStickyCommonEvent().then((data) => { + console.info("==========================>StickyCommonEventPromise0900=======================>"); + expect(data).assertEqual(false); + }); + } + + // @tc.number: ActsSubscriber_test_0900 + // @tc.name: verify subscribe and publish : Check subscribe and publish common event with common event data + // @tc.desc: Check the subscriber can receive event "publish_event0900" type of the interface (by Promise) + it('ActsSubscriber_test_0900', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["publish_event0900"] + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo + ).then((data) => { + console.info("==========================>createSubscriberPromise0900=======================>"); + CommonEventSubscriber0900 = data; + }); + + await Subscriber.subscribe(CommonEventSubscriber0900, SubscriberCallBack0900); + + var CommonEventPublishData = { + isOrdered: false, + isSticky: false + } + + Subscriber.publish("publish_event0900", CommonEventPublishData, PublishCallBack0900); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_09/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_09/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_09/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..73bdc5340c601124edaa4e191ae2d57597f15e32 Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_09/hap/entry-debug-rich-signed.hap differ diff --git a/notification/ces_standard/subscribeandpublish/hap_10/BUILD.gn b/notification/ces_standard/subscribeandpublish/hap_10/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3878d9cd75640c1f7fdf7f6bd725487caf7b72a5 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/BUILD.gn @@ -0,0 +1,19 @@ +# 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("//build/config/ohos/rules.gni") +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsSubscriberTest") { + test_hap_name = "ActsSubscriberTest" + hap_source_path = "hap/entry-debug-rich-signed.hap" +} diff --git a/notification/ces_standard/subscribeandpublish/hap_10/Test.json b/notification/ces_standard/subscribeandpublish/hap_10/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..fda6bf0fd484b8b3615d3120f48faee8494381fc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/Test.json @@ -0,0 +1,17 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "package": "ohos.acts.notification.ces_standard.hap_09" + }, + "kits": [ + { + "test-file-name": [ + "entry-debug-rich-signed.hap", + "$module.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/package.json b/notification/ces_standard/subscribeandpublish/hap_10/entry/package.json new file mode 100644 index 0000000000000000000000000000000000000000..69a88e3b65423624fe7ea8b0f8beefcc62cc3d5f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/package.json @@ -0,0 +1 @@ +{} diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/config.json b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..29e57def67fb96b53786c4372f27fbf2fb1b7916 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.test1000", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 5, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.test", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.test.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "isVisible": "true", + "launchType": "standard" + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/app.js b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..394207eb5460c4907b53b15a6d4f1a1a535916cc --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/app.js @@ -0,0 +1,8 @@ +export default { + onCreate() { + console.info('AceApplication onCreate'); + }, + onDestroy() { + console.info('AceApplication onDestroy'); + } +}; diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/i18n/en-US.json b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/i18n/en-US.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "Hello", + "world": "World" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/i18n/zh-CN.json b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/i18n/zh-CN.json @@ -0,0 +1,6 @@ +{ + "strings": { + "hello": "您好", + "world": "世界" + } +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.css b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,9 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 100px; +} diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.hml b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..794e7a821251294b64992d05da282bee4211221a --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 您好,地球1111 + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.js b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..480d03feebc4910d86df09bc2899f31252db677d --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,58 @@ +//import device from '@system.device'; +//import {Core} from 'deccjsunit/lite' +//const core = Core.getInstance() +//core.init() +//require('../../../test/List.test.js') +//core.execute() +// +//export default { +// data: { +// title: "Test" +// }, +// onInit() { +// this.title = this.$t('strings.world'); +// console.log("napi test for app"); +// } +//} + +import file from '@system.file' +import app from '@system.app' +import device from '@system.device' +import router from '@system.router' +import {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +export default { + data: { + title: "" + }, + onInit() { + this.title = this.$t('strings.world'); + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + // const instrumentLog = new InstrumentLog({ + // 'id': 'report' + // }) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + // core.addService('report', instrumentLog) + core.init() + // core.subscribeEvent('spec', instrumentLog) + // core.subscribeEvent('suite', instrumentLog) + // core.subscribeEvent('task', instrumentLog) + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/test/FeatureAbilityJsunit.test.js b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/test/FeatureAbilityJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..c7ee51b87cb5c4206eec3ee6f3b08e72811709e3 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/test/FeatureAbilityJsunit.test.js @@ -0,0 +1,62 @@ +/* + * 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 Subscriber from '@ohos.commonevent' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('ActsSubscriberTest', function () { + + var CommonEventSubscriber1000; + + function PublishCallBack1000() { + console.info("==========================>PublishCallBack1000=======================>"); + } + + function SubscriberCallBack1000(data) { + console.info("==========================>SubscriberCallBack1000=======================>"); + expect(data.event).assertEqual("publish_event1000"); + CommonEventSubscriber1000.isOrderedCommonEvent().then((data) => { + console.info("==========================>OrderedCommonEventCallBack0900=======================>"); + expect(data).assertEqual(false); + }); + } + + // @tc.number: ActsSubscriber_test_1000 + // @tc.name: verify subscribe and publish : Check subscribe and publish sticky event + // @tc.desc: Check the subscriber can receive event "publish_event1000" type of the interface (by Promise) + it('ActsSubscriber_test_1000', 0, async function (done) { + + var CommonEventSubscribeInfo = { + events: ["publish_event1000"] + }; + + await Subscriber.createSubscriber( + CommonEventSubscribeInfo + ).then((data) => { + console.info("==========================>createSubscriberPromise1000=======================>"); + CommonEventSubscriber1000 = data; + }); + + Subscriber.subscribe(CommonEventSubscriber1000, SubscriberCallBack1000); + + var CommonEventPublishData = { + isOrdered: false, + isSticky: true + } + + Subscriber.publish("publish_event1000", CommonEventPublishData, PublishCallBack1000); + done(); + }) +}) + diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/test/List.test.js b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..dd952c19e9b7ec3b4d6b248b8a2a2ece4d4230d9 --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/js/test/List.test.js @@ -0,0 +1,2 @@ +//require('./ExampleJsunit.test.js') +require('./FeatureAbilityJsunit.test.js') \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/resources/base/element/string.json b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b9b988c2160e50e2ea2daa51af3f82d74c773beb --- /dev/null +++ b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Test" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/resources/base/media/icon.png b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_10/entry/src/main/resources/base/media/icon.png differ diff --git a/notification/ces_standard/subscribeandpublish/hap_10/hap/entry-debug-rich-signed.hap b/notification/ces_standard/subscribeandpublish/hap_10/hap/entry-debug-rich-signed.hap new file mode 100644 index 0000000000000000000000000000000000000000..2cbd890c9ae847cb632d62bcefa2e7464bedad47 Binary files /dev/null and b/notification/ces_standard/subscribeandpublish/hap_10/hap/entry-debug-rich-signed.hap differ