diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/BUILD.gn b/aafwk/aafwk_standard/getactiveprocessinfos/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5a5bc71663d75769b2bda52abbe16d3410dda3eb --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/BUILD.gn @@ -0,0 +1,24 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +group("getactiveprocessinfos") { + testonly = true + if (is_standard_system) { + deps = [ + "getactiveprocessinfo:getactiveprocessinfo", + "setshowonlocka:setshowonlocka", + ] + } +} diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/BUILD.gn b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..9e6ed6875c43327e4519a34d14b0ec68d4146a73 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("getactiveprocessinfo") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "getactiveprocessinfo" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/Test.json b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..8784b9386cf8227890a64b9c20f0cebf3a95bdb1 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/Test.json @@ -0,0 +1,24 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "30000", + "package": "com.example.getactiveprocessinfo", + "shell-timeout": "30000" + }, + "kits": [ + { + "test-file-name": [ + "getactiveprocessinfo.hap", + "setshowonlock.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + + + + + ] +} + diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/config.json b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..bb15a458fda7b4f7520613b9b6a34888a94c4f80 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.getactiveprocessinfo", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.getactiveprocessinfo", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.getactiveprocessinfo.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/app.js new file mode 100755 index 0000000000000000000000000000000000000000..2a68c1992145a976957d7dcdd69a7e9c2e8e9877 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/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/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/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/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/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/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/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/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..faab4fe2b0f105f5aae4322e2337523caf0bcaaf --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,6 @@ +
+ + 测试zlib-1515-test + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..005dbb30347728dc892ec17dfe7bcee1ad8e5685 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/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 {Core, ExpectExtend, ReportExtend} from 'deccjsunit/index' + +const injecttRef = Object.getPrototypeOf(global) || global +injecttRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +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' + }) + core.addService('expect', expectExtend) + core.init() + + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, +} + diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..b586cc29b27e344557a2fe7513c834f50cc56081 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "app_name", + "value": "amsZipfileUnzipfileST" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "serviceability_description", + "value": "hap sample empty service" + }, + { + "name": "serviceability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/test/Getactive.test.js b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/test/Getactive.test.js new file mode 100644 index 0000000000000000000000000000000000000000..4922dac38b43ef0956a5a8d5615f3819b4a1fcb2 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/test/Getactive.test.js @@ -0,0 +1,166 @@ +/* +* 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 appmgr from '@ohos.app.abilityManager' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe('Getacitve', function () { + +/* +* @tc.number: FWK_ProcessInfo_0100 +* @tc.name: getActiveProcessInfos +* @tc.desc: A process retrieves information +*/ +it('FWK_ProcessInfo_0100', 0, async function (done) { + console.log('FWK_ProcessInfo_0100 start'); + try{ + appmgr.getActiveProcessInfos( + (error, data) => { + expect(data[0].uid > 0).assertTrue(); + expect(data[0].pid > 0).assertTrue(); + expect(data[0].processName != null).assertTrue(); + expect(data[0].bundleNames != null).assertTrue(); + done(); + }); + }catch(err){ + console.log('FWK_ProcessInfo_0100 err' + err); + done(); +} + +}) + +/* +* @tc.number: FWK_ProcessInfo_0200 +* @tc.name: getActiveProcessInfos +* @tc.desc: Two processes get the information +*/ +it('FWK_ProcessInfo_0200', 0, async function (done) { + console.log('FWK_ProcessInfo_0200 start'); + try{ + appmgr.getActiveProcessInfos( + (error, data) => { + var len = data.length; + for(var i =1; i 0).assertTrue(); + expect(data[i].pid > 0).assertTrue(); + expect(data[i].processName != null).assertTrue(); + expect(data[i].bundleNames != null).assertTrue(); + } + done(); + }) + }catch(err){ + console.log('FWK_ProcessInfo_0200 err' + err); + done(); + } + +}) + +/* +* @tc.number: FWK_ProcessInfo_0300 +* @tc.name: getActiveProcessInfos +* @tc.desc: A process retrieves information +*/ +it('FWK_ProcessInfo_0300', 0, async function (done) { + console.log('FWK_ProcessInfo_0300 Begin'); + try{ + appmgr.getActiveProcessInfos().then((data) => { + expect(data[0].uid > 0).assertTrue(); + expect(data[0].pid > 0).assertTrue(); + expect(data[0].processName != null).assertTrue(); + expect(data[0].bundleNames != null).assertTrue(); + done(); + }).catch((error) => { + console.log('FWK_ProcessInfo_0300 error code is ' + error.code); + done(); + }); + }catch(err){ + console.log('FWK_ProcessInfo_0300 err' + err); + done(); +} +}) + +/* +* @tc.number: FWK_ProcessInfo_0400 +* @tc.name: getActiveProcessInfos +* @tc.desc: Two processes get the information +*/ +it('FWK_ProcessInfo_0400', 0, async function (done) { + console.log('FWK_ProcessInfo_0400 Begin'); + try{ + appmgr.getActiveProcessInfos().then((data) => { + var len = data.length; + for(var i =1; i 0).assertTrue(); + expect(data[i].pid > 0).assertTrue(); + expect(data[i].processName != null).assertTrue(); + expect(data[i].bundleNames != null).assertTrue(); + } + done(); + }).catch((error) => { + console.log('FWK_ProcessInfo_0400 error code is ' + error.code); + done(); + }); + }catch(err){ + console.log('FWK_ProcessInfo_0400 err' + err); + done(); +} +}) + +/* +* @tc.number: FWK_MemoryInfo_0100 +* @tc.name: getSystemMemoryAttr +* @tc.desc: Anapplication memory information +*/ +it('FWK_MemoryInfo_0100', 0, async function (done) { + console.log('FWK_MemoryInfo_0100 start'); + try{ + appmgr.getSystemMemoryAttr( + (error, data) => { + expect(data.availSysMem > 0).assertTrue(); + expect(data.totalSysMem > 0).assertTrue(); + expect(data.threshold > 0).assertTrue(); + expect(data.isSysInlowMem == (data.availSysMem < data.threshold)).assertTrue(); + done(); + }); + }catch(err){ + console.log('FWK_ProcessInfo_0400 err' + err); + } + console.log('ZLM-----onClick1 End'); +}) + +/* +* @tc.number: FWK_MemoryInfo_0200 +* @tc.name: getSystemMemoryAttr +* @tc.desc: Anapplication memory information +*/ +it('FWK_MemoryInfo_0200', 0, async function (done) { + console.log('FWK_MemoryInfo_0200 Begin'); + try{ + appmgr.getSystemMemoryAttr().then((data) => { + expect(data.availSysMem > 0).assertTrue(); + expect(data.totalSysMem > 0).assertTrue(); + expect(data.threshold > 0).assertTrue(); + expect(data.isSysInlowMem == (data.availSysMem < data.threshold)).assertTrue(); + done(); + }).catch((error) => { + console.log('FWK_MemoryInfo_0200 error code is ' + error.code); + done(); + }); + }catch(err){ + console.log('FWK_ProcessInfo_0400 err' + err); + } + console.log('FWK_MemoryInfo_0200 End'); +}) +}) diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ac53860b5771a8e5b52dde3688bbf00b1185c000 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/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('./Getactive.test.js') diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/getactiveprocessinfos/getactiveprocessinfo/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/BUILD.gn b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..828d0750c67d42c3c4227c8b25eca0bb1fb2d656 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("setshowonlock") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "setshowonlock" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/Test.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..2098bb50023c88a432803ba9836248e355e29192 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/Test.json @@ -0,0 +1,5 @@ +{ + "description": "Configuration for hjunit demo Tests" + +} + diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/.gitignore b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/config.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..360ce6d06366bb4b27f9ce7b9f782a3e2792803f --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.setshowonlock", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.setshowonlock", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.setshowonlock.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/app.js new file mode 100755 index 0000000000000000000000000000000000000000..a66a245b33514363f81b281b0471ca426479e717 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* +* 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/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/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/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/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/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/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/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/pages/index/index.js new file mode 100755 index 0000000000000000000000000000000000000000..03eb127016e1721d588b9a22082c974a25f4c2c2 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,29 @@ +/* +* 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'); + }, + onShow() { + console.info('onShow finish') + + }, + onReady() { + }, +} diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..7d05253caf78df35bca24351d536c15da41334ab --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "setShowOnLock" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlock/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/BUILD.gn b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..fd934c83e1426473ad9a7f234971b1a3d766948d --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("setshowonlocka") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "setshowonlocka" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/Test.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..2098bb50023c88a432803ba9836248e355e29192 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/Test.json @@ -0,0 +1,5 @@ +{ + "description": "Configuration for hjunit demo Tests" + +} + diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/.gitignore b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..3543521e9fef8e7322940a87c2b45dd0061b0f45 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/.gitignore @@ -0,0 +1 @@ +/build diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/config.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/config.json new file mode 100755 index 0000000000000000000000000000000000000000..360ce6d06366bb4b27f9ce7b9f782a3e2792803f --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/config.json @@ -0,0 +1,61 @@ +{ + "app": { + "bundleName": "com.example.setshowonlock", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.setshowonlock", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.setshowonlock.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/app.js new file mode 100755 index 0000000000000000000000000000000000000000..a66a245b33514363f81b281b0471ca426479e717 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/app.js @@ -0,0 +1,23 @@ +/* +* 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/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/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/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/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/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/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/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..f64b040a5ae394dbaa5e185e1ecd4f4556b92184 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ $t('strings.hello') }} {{ title }} + +
diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/pages/index/index.js new file mode 100755 index 0000000000000000000000000000000000000000..03eb127016e1721d588b9a22082c974a25f4c2c2 --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,29 @@ +/* +* 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'); + }, + onShow() { + console.info('onShow finish') + + }, + onReady() { + }, +} diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/resources/base/element/string.json b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/resources/base/element/string.json new file mode 100755 index 0000000000000000000000000000000000000000..7d05253caf78df35bca24351d536c15da41334ab --- /dev/null +++ b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "setShowOnLock" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/resources/base/media/icon.png b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/entry/src/main/js/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/getactiveprocessinfos/setshowonlocka/signature/openharmony_sx.p7b differ diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/BUILD.gn b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..a1729101d8cff2d0b0fefef3ff4680eb86e957f7 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/BUILD.gn @@ -0,0 +1,31 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsBmsGetInfosTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsBmsGetInfosTest" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/js/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/Test.json b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..1d9cacfff355ccfe54f9b006e8efcd396b0522ac --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/Test.json @@ -0,0 +1,45 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "180000", + "package": "com.example.actsbmsgetinfostest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "bmsSystemBundleTest1.hap", + "bmsVendorBundleTest1.hap", + "ActsBmsGetInfosTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "remount", + "mkdir /data/test" + ] + }, + { + "type": "PushKit", + "push": [ + "bmsThirdBundleTest1.hap->/data/test/bmsThirdBundleTest1.hap", + "bmsThirdBundleTest2.hap->/data/test/bmsThirdBundleTest2.hap", + "bmsThirdBundleTest3.hap->/data/test/bmsThirdBundleTest3.hap", + "bmsThirdBundleTest4.hap->/data/test/bmsThirdBundleTest4.hap", + "bmsThirdBundleTest5.hap->/data/test/bmsThirdBundleTest5.hap", + "bmsThirdBundleTest6.hap->/data/test/bmsThirdBundleTest6.hap", + "bmsThirdBundleTestA1.hap->/data/test/bmsThirdBundleTestA1.hap" + ] + }, + { + "type": "ShellKit", + "run-command": [ + "chmod 644 /data/test/*.hap" + ] + } + ] +} diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/config.json b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..da3fa2d5048457e04eb774105a52efbcb8b3fa96 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/config.json @@ -0,0 +1,62 @@ +{ + "app": { + "bundleName": "com.example.actsbmsgetinfostest", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsbmsgetinfostest", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home", + "flag.home.intent.from.system" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.example.actsbmsgetinfostest.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/app.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..2a68c1992145a976957d7dcdd69a7e9c2e8e9877 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/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/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/i18n/en-US.json b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/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/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/i18n/zh-CN.json b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/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/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/pages/index/index.css b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..6fda792753f2e15f22b529c7b90a82185b2770bf --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/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/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/pages/index/index.hml b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..13ae33e07e3a90032d5fb5589183072449422c77 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,5 @@ +
+ + {{ title }} + +
diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/pages/index/index.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b67e242e7922a6064c7dc39d2142e9aa8f9dc216 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/default/pages/index/index.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 {Core, ExpectExtend} from 'deccjsunit' + +const injectRef = Object.getPrototypeOf(global) || global +injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') + +export default { + data: { + title: 'Test actsbmsgetinfostest' + }, + onInit() { + this.title = 'Test actsbmsgetinfostest'; + }, + onShow() { + console.info('onShow finish') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + onReady() { + }, + onBackPress(){ + } +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/resources/base/element/string.json b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..916251a83549463450716f32eb8e4b0e32ede0a2 --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "actsbmsgetinfostest" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/resources/base/media/icon.png b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/resources/base/media/icon.png differ diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsFormsInfoTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsFormsInfoTest.test.js new file mode 100644 index 0000000000000000000000000000000000000000..256b04107ea8aa06d93796aefb9d0c78627254ac --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsFormsInfoTest.test.js @@ -0,0 +1,1816 @@ +/* + * 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 bundle from '@ohos.bundle' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +const BUNDLE_NAME1 = 'com.example.third1'; +const BUNDLE_NAME2 = 'com.example.third2'; +const BUNDLE_NAME4 = 'com.example.third4'; +const BUNDLE_NAME5 = 'com.example.third5'; +const SYSTEM_BUNDLE = 'com.example.system1'; +const VENDOR_BUNDLE = 'com.example.vendor1'; +const DESIGHN_WIDTH = 770; +const DEFAULT_DESIGHN_WIDTH = 750; +describe('ActsBmsFormsInfoTest', function () { + + /** + * @tc.number: bms_getAllFormsInfo_0100 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check forms information include system and vendor apps (by promise) + */ + it('bms_getAllFormsInfo_0100', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0100=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + let formsInfo = await bundle.getAllFormsInfo(); + console.debug('======all form======' + JSON.stringify(formsInfo)); + expect(formsInfo.length).assertEqual(4); + checkFormIsExist('Form_JS1', formsInfo, '1'); + checkFormIsExist('Form_JS1S', formsInfo, '1S', true); + checkFormIsExist('Form_JS1V', formsInfo, '1V', false, true); + checkFormIsExist('Form_JS1V2', formsInfo, '1V2'); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + function checkSystemHapForm(dataInfo) { + console.debug('===system formInfo is ' + JSON.stringify(dataInfo)) + expect(dataInfo.name).assertEqual('Form_JS1S'); + expect(dataInfo.bundleName).assertEqual(SYSTEM_BUNDLE); + expect(dataInfo.moduleName).assertEqual('entry'); + expect(dataInfo.abilityName).assertEqual(SYSTEM_BUNDLE + '.MainAbility'); + expect(dataInfo.description).assertEqual('JS1S Form'); + expect(dataInfo.descriptionId >= 0).assertTrue(); + expect(dataInfo.type).assertEqual(bundle.FormType.JS); + expect(dataInfo.colorMode).assertEqual(bundle.ColorMode.AUTO_MODE); + expect(dataInfo.defaultFlag).assertTrue(); + expect(dataInfo.jsComponentName).assertEqual('JS_name1S'); + expect(dataInfo.formVisibleNotify).assertFalse(); + expect(dataInfo.formConfigAbility).assertEqual('ability://com.example.system1.MainAbility'); + expect(dataInfo.updateDuration).assertEqual(1); + expect(dataInfo.defaultDimension).assertEqual(4); + expect(JSON.stringify(dataInfo.supportDimensions)).assertEqual('[1,2,3,4]'); + expect(dataInfo.relatedBundleName).assertEqual(''); + expect(JSON.stringify(dataInfo.customizeDatas)) + .assertEqual('[{"name":"originWidgetName1S","value":"com.openharmony.weather.testWidget1S"}]'); + expect(dataInfo.customizeDatas[0].name).assertEqual('originWidgetName1S'); + expect(dataInfo.customizeDatas[0].value).assertEqual('com.openharmony.weather.testWidget1S'); + expect(dataInfo.src).assertEqual('/pages/card/index'); + expect(dataInfo.window.designWidth).assertEqual(DESIGHN_WIDTH); + expect(dataInfo.window.autoDesignWidth).assertEqual(true); + } + + function checkVendorHapForm(dataInfo) { + console.debug('===vendor formInfo is ' + JSON.stringify(dataInfo)) + expect(dataInfo.name).assertEqual('Form_JS1V'); + expect(dataInfo.bundleName).assertEqual(VENDOR_BUNDLE); + expect(dataInfo.moduleName).assertEqual('entry'); + expect(dataInfo.abilityName).assertEqual(VENDOR_BUNDLE + '.MainAbility'); + expect(dataInfo.description).assertEqual('JS1V Form'); + expect(dataInfo.descriptionId >= 0).assertTrue(); + expect(dataInfo.type).assertEqual(bundle.FormType.JAVA); + expect(dataInfo.colorMode).assertEqual(bundle.ColorMode.DARK_MODE); + expect(dataInfo.defaultFlag).assertFalse(); + expect(dataInfo.jsComponentName).assertEqual('JS_name1V'); + expect(dataInfo.formVisibleNotify).assertFalse(); + expect(dataInfo.formConfigAbility).assertEqual(''); + expect(dataInfo.updateDuration).assertEqual(1); + expect(dataInfo.defaultDimension).assertEqual(0); + expect(JSON.stringify(dataInfo.supportDimensions)).assertEqual('[1,2,3]'); + expect(dataInfo.relatedBundleName).assertEqual(''); + expect(JSON.stringify(dataInfo.customizeDatas)) + .assertEqual('[{"name":"originWidgetName1V","value":"com.openharmony.weather.testWidget1V"}]'); + expect(dataInfo.src).assertEqual(''); + expect(dataInfo.window.designWidth).assertEqual(DEFAULT_DESIGHN_WIDTH); + expect(dataInfo.window.autoDesignWidth).assertEqual(true); + } + + /** + * @tc.number: bms_getAllFormsInfo_0200 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check forms information include system and vendor apps (by callback) + */ + it('bms_getAllFormsInfo_0200', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0200=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getAllFormsInfo((err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertLarger(0); + checkFormIsExist('Form_JS1', formsInfo, '1'); + checkFormIsExist('Form_JS1S', formsInfo, '1S', true); + checkFormIsExist('Form_JS1V', formsInfo, '1V', false, true); + checkFormIsExist('Form_JS1V2', formsInfo, '1V2'); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getAllFormsInfo_0300 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check whether the form information of the update app is updated (by promise) + */ + it('bms_getAllFormsInfo_0300', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0300=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.install(['/data/test/bmsThirdBundleTestA1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getAllFormsInfo(); + expect(formsInfo.length).assertLarger(0); + checkFormNoExist(formsInfo, 'Form_JS1'); + checkFormIsExist('Form_JSA1', formsInfo, 'A1') + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getAllFormsInfo_0400 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check whether the form information of the update app is updated (by callback) + */ + it('bms_getAllFormsInfo_0400', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0400=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.install(['/data/test/bmsThirdBundleTestA1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getAllFormsInfo((err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertLarger(0); + checkFormNoExist(formsInfo, 'Form_JS1'); + checkFormIsExist('Form_JSA1', formsInfo, 'A1'); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + }); + } + }) + + /** + * @tc.number: bms_getAllFormsInfo_0500 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check whether the form information of the uninstall app is removed (by promise) + */ + it('bms_getAllFormsInfo_0500', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0500=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getAllFormsInfo(); + checkFormNoExist(formsInfo, 'Form_JS1'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getAllFormsInfo_0600 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check whether the form information of the uninstall app is removed (by callback) + */ + it('bms_getAllFormsInfo_0600', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0600=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getAllFormsInfo((err, formsInfo) => { + expect(err.code).assertEqual(0); + checkFormNoExist(formsInfo, 'Form_JS1'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getAllFormsInfo_0700 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check form information of all apps which include one app have two forms (by promise) + */ + it('bms_getAllFormsInfo_0700', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0700=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest4.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getAllFormsInfo(); + expect(formsInfo.length).assertLarger(0); + checkFormIsExist('Form_JS4A', formsInfo, '4A'); + checkFormIsExist('Form_JS4B', formsInfo, '4B'); + installer.uninstall(BUNDLE_NAME4, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getAllFormsInfo_0800 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check form information of all apps which include one app have two forms (by callback) + */ + it('bms_getAllFormsInfo_0800', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0800=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest4.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getAllFormsInfo((err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertLarger(0); + checkFormIsExist('Form_JS4A', formsInfo, '4A'); + checkFormIsExist('Form_JS4B', formsInfo, '4B'); + installer.uninstall(BUNDLE_NAME4, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getAllFormsInfo_0900 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check form information of all apps which include one app have two abilities, + * and each ability has forms (by promise) + */ + it('bms_getAllFormsInfo_0900', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_0900=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest5.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getAllFormsInfo(); + expect(formsInfo.length).assertLarger(0); + checkFormIsExist('Form_JS5A', formsInfo, '5A'); + checkFormIsExist('Form_JS5B', formsInfo, '5B'); + installer.uninstall(BUNDLE_NAME5, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getAllFormsInfo_1000 + * @tc.name: getAllFormsInfo : get forms information for all apps + * @tc.desc: check form information of all apps which include one app have two abilities, + * and each ability has forms (by callback) + */ + it('bms_getAllFormsInfo_1000', 0, async function (done) { + console.info('=====================bms_getAllFormsInfo_1000=================='); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest5.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getAllFormsInfo((err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertLarger(0); + checkFormIsExist('Form_JS5A', formsInfo, '5A'); + checkFormIsExist('Form_JS5B', formsInfo, '5B'); + installer.uninstall(BUNDLE_NAME5, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_0100 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which doesn't exist (by promise) + */ + it('bms_getFormsInfo_0100', 0, async function (done) { + console.info('==============bms_getFormsInfo_0100============'); + var data = await bundle.getFormsInfo(''); + expect(data.length).assertEqual(0); + done(); + }) + + /** + * @tc.number: bms_getFormsInfo_0200 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which doesn't exist (by callback) + */ + it('bms_getFormsInfo_0200', 0, async function (done) { + console.info('==============bms_getFormsInfo_0200============'); + bundle.getFormsInfo('', (err, data) => { + expect(err.code).assertEqual(-1); + expect(data.length).assertEqual(0); + done(); + }); + }) + + /** + * @tc.number: bms_getFormsInfo_0300 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which doesn't have forms (by promise) + */ + it('bms_getFormsInfo_0300', 0, async function (done) { + console.info('==============bms_getFormsInfo_0300============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest2.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfo(BUNDLE_NAME2); + expect(formsInfo.length).assertEqual(0); + installer.uninstall(BUNDLE_NAME2, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_0400 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which doesn't have forms (by callback) + */ + it('bms_getFormsInfo_0400', 0, async function (done) { + console.info('==============bms_getFormsInfo_0400============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest2.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfo(BUNDLE_NAME2, (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(0); + installer.uninstall(BUNDLE_NAME2, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_0500 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which has two haps (by promise) + */ + it('bms_getFormsInfo_0500', 0, async function (done) { + console.info('==============bms_getFormsInfo_0500============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfo(BUNDLE_NAME1); + expect(formsInfo.length).assertEqual(2); + checkFormIsExist('Form_JS1', formsInfo, '1'); + checkFormIsExist('Form_JS3', formsInfo, '3') + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_0600 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which has two haps (by callback) + */ + it('bms_getFormsInfo_0600', 0, async function (done) { + console.info('==============bms_getFormsInfo_0600============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfo(BUNDLE_NAME1, (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(2); + checkFormIsExist('Form_JS1', formsInfo, '1') + checkFormIsExist('Form_JS3', formsInfo, '3') + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_0700 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check whether the form information of the update app is updated (by promise) + */ + it('bms_getFormsInfo_0700', 0, async function (done) { + console.info('==============bms_getFormsInfo_0700============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.install(['/data/test/bmsThirdBundleTestA1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + let formsInfo = await bundle.getFormsInfo(BUNDLE_NAME1) + expect(formsInfo.length).assertEqual(1); + checkFormIsExist('Form_JSA1', formsInfo, 'A1') + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_0800 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check whether the form information of the update app is updated (by callback) + */ + it('bms_getFormsInfo_0800', 0, async function (done) { + console.info('==============bms_getFormsInfo_0800============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.install(['/data/test/bmsThirdBundleTestA1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfo(BUNDLE_NAME1, (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(1); + checkFormIsExist('Form_JSA1', formsInfo, 'A1'); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_0900 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which have two forms(by promise) + */ + it('bms_getFormsInfo_0900', 0, async function (done) { + console.info('==============bms_getFormsInfo_0900============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest4.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfo(BUNDLE_NAME4); + expect(formsInfo.length).assertEqual(2); + checkFormByName(formsInfo[0], '4A'); + checkFormByName(formsInfo[1], '4B'); + installer.uninstall(BUNDLE_NAME4, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_1000 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which have two forms(by callback) + */ + it('bms_getFormsInfo_1000', 0, async function (done) { + console.info('==============bms_getFormsInfo_1000============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest4.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfo(BUNDLE_NAME4, (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(2); + checkFormByName(formsInfo[0], '4A'); + checkFormByName(formsInfo[1], '4B'); + installer.uninstall(BUNDLE_NAME4, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_1100 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which have two abilities, + * and each ability has one forms (by promise) + */ + it('bms_getFormsInfo_1100', 0, async function (done) { + console.info('==============bms_getFormsInfo_1100============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest5.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfo(BUNDLE_NAME5); + expect(formsInfo.length).assertEqual(2); + checkFormIsExist('Form_JS5A', formsInfo, '5A'); + checkFormIsExist('Form_JS5B', formsInfo, '5B'); + installer.uninstall(BUNDLE_NAME5, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_1200 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for a third app which have two abilities, + * and each ability has one forms (by callback) + */ + it('bms_getFormsInfo_1200', 0, async function (done) { + console.info('==============bms_getFormsInfo_1200============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest5.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfo(BUNDLE_NAME5, (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(2); + checkFormIsExist('Form_JS5A', formsInfo, '5A'); + checkFormIsExist('Form_JS5B', formsInfo, '5B'); + installer.uninstall(BUNDLE_NAME5, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_1300 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for vendor and system app (by promise) + */ + it('bms_getFormsInfo_1300', 0, async function (done) { + console.info('==============bms_getFormsInfo_1300============'); + var data = await bundle.getFormsInfo('com.example.vendor1'); + expect(data.length).assertEqual(2); + checkFormIsExist('Form_JS1V', data, '1V', false, true); + checkFormIsExist('Form_JS1V2', data, '1V2'); + data = await bundle.getFormsInfo('com.example.system1'); + expect(data.length).assertEqual(1); + checkFormIsExist('Form_JS1S', data, '1S', true); + done(); + }) + + /** + * @tc.number: bms_getFormsInfo_1400 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check forms information for vendor and system app(by callback) + */ + it('bms_getFormsInfo_1400', 0, async function (done) { + console.info('==============bms_getFormsInfo_1400============'); + bundle.getFormsInfo('com.example.vendor1', (err, data) => { + expect(err.code).assertEqual(0); + expect(data.length).assertEqual(2); + checkFormIsExist('Form_JS1V', data, '1V', false, true); + checkFormIsExist('Form_JS1V2', data, '1V2'); + }); + bundle.getFormsInfo('com.example.system1', (err, data) => { + expect(err.code).assertEqual(0); + expect(data.length).assertEqual(1); + checkFormIsExist('Form_JS1S', data, '1S', true); + done(); + }); + }) + + /** + * @tc.number: bms_getFormsInfo_1500 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check whether the form information of the uninstall app is removed (by promise) + */ + it('bms_getFormsInfo_1500', 0, async function (done) { + console.info('==============bms_getFormsInfo_1500============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest4.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.uninstall(BUNDLE_NAME4, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfo(BUNDLE_NAME4); + expect(formsInfo.length).assertEqual(0); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfo_1600 + * @tc.name: getFormsInfo : get forms information for one app + * @tc.desc: check whether the form information of the uninstall app is removed (by callback) + */ + it('bms_getFormsInfo_1600', 0, async function (done) { + console.info('==============bms_getFormsInfo_1600============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest4.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.uninstall(BUNDLE_NAME4, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfo(BUNDLE_NAME4, (err, formsInfo) => { + expect(err.code).assertEqual(-1); + expect(formsInfo.length).assertEqual(0); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0100 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app by bundle name and module name (by promise) + */ + it('bms_getFormsInfoByModule_0100', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0100============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfoByModule(BUNDLE_NAME1, 'entry'); + expect(formsInfo.length).assertEqual(1); + checkFormIsExist('Form_JS1', formsInfo, '1'); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0200 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app by bundle name and module name (by callback) + */ + it('bms_getFormsInfoByModule_0200', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0200============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfoByModule(BUNDLE_NAME1, 'entry', (err, data) => { + expect(err.code).assertEqual(0); + expect(data.length).assertEqual(1); + checkFormIsExist('Form_JS1', data, '1') + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0300 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app by wrong module name (by promise) + */ + it('bms_getFormsInfoByModule_0300', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0300============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + let formsInfo = await bundle.getFormsInfoByModule(BUNDLE_NAME1, ''); + expect(formsInfo.length).assertEqual(0); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0400 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app by wrong module name (by callback) + */ + it('bms_getFormsInfoByModule_0400', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0400============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfoByModule(BUNDLE_NAME1, '', (err, data) => { + expect(err.code).assertEqual(-1); + expect(data.length).assertEqual(0); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0500 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app by wrong bundle name (by promise) + */ + it('bms_getFormsInfoByModule_0500', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0500============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + let formsInfo = await bundle.getFormsInfoByModule('', 'bmsThirdBundle1'); + expect(formsInfo.length).assertEqual(0); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0600 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app by wrong bundle name (by callback) + */ + it('bms_getFormsInfoByModule_0600', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0600============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfoByModule('', 'bmsThirdBundle1', (err, data) => { + expect(err.code).assertEqual(-1); + expect(data.length).assertEqual(0); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0700 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app which has two haps (by promise) + */ + it('bms_getFormsInfoByModule_0700', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0700============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfoByModule(BUNDLE_NAME1, 'bmsThirdBundle3'); + expect(formsInfo.length).assertEqual(1); + checkFormIsExist('Form_JS3', formsInfo, '3') + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0800 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app which has two haps (by callback) + */ + it('bms_getFormsInfoByModule_0800', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0800============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap', '/data/test/bmsThirdBundleTest3.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfoByModule(BUNDLE_NAME1, 'bmsThirdBundle3', (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(1); + checkFormIsExist('Form_JS3', formsInfo, '3') + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_0900 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app which have two forms (by promise) + */ + it('bms_getFormsInfoByModule_0900', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_0900============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest4.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfoByModule(BUNDLE_NAME4, 'entry'); + expect(formsInfo.length).assertEqual(2); + checkFormIsExist('Form_JS4A', formsInfo, '4A'); + checkFormIsExist('Form_JS4B', formsInfo, '4B'); + installer.uninstall(BUNDLE_NAME4, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1000 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app which have two forms (by callback) + */ + it('bms_getFormsInfoByModule_1000', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1000============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest4.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfoByModule(BUNDLE_NAME4, 'entry', (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(2); + checkFormIsExist('Form_JS4A', formsInfo, '4A'); + checkFormIsExist('Form_JS4B', formsInfo, '4B'); + installer.uninstall(BUNDLE_NAME4, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1100 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app which have two abilities, + * and each ability has one forms (by promise) + */ + it('bms_getFormsInfoByModule_1100', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1100============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest5.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfoByModule(BUNDLE_NAME5, 'entry'); + expect(formsInfo.length).assertEqual(2); + checkFormIsExist('Form_JS5A', formsInfo, '5A'); + checkFormIsExist('Form_JS5B', formsInfo, '5B'); + installer.uninstall(BUNDLE_NAME5, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1200 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for a third app which have two abilities, + * and each ability has one forms (by callback) + */ + it('bms_getFormsInfoByModule_1200', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1200============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest5.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + async function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfoByModule(BUNDLE_NAME5, 'entry', (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(2); + checkFormIsExist('Form_JS5A', formsInfo, '5A'); + checkFormIsExist('Form_JS5B', formsInfo, '5B'); + installer.uninstall(BUNDLE_NAME5, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1300 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for system and vendor app (by promise) + */ + it('bms_getFormsInfoByModule_1300', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1300============'); + var data = await bundle.getFormsInfoByModule('com.example.vendor1', 'entry'); + expect(data.length).assertEqual(2); + checkFormIsExist('Form_JS1V', data, '1V', false, true); + checkFormIsExist('Form_JS1V2', data, '1V2'); + data = await bundle.getFormsInfoByModule('com.example.system1', 'entry'); + expect(data.length).assertEqual(1); + checkFormIsExist('Form_JS1S', data, '1S', true); + done(); + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1400 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check forms information for system and vendor app (by callback) + */ + it('bms_getFormsInfoByModule_1400', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1400============'); + bundle.getFormsInfoByModule('com.example.vendor1', 'entry', (err, data) => { + expect(err.code).assertEqual(0); + expect(data.length).assertEqual(2); + checkFormIsExist('Form_JS1V', data, '1V', false, true); + checkFormIsExist('Form_JS1V2', data, '1V2'); + }); + bundle.getFormsInfoByModule('com.example.system1', 'entry', (err, data) => { + expect(err.code).assertEqual(0); + expect(data.length).assertEqual(1); + checkFormIsExist('Form_JS1S', data, '1S', true); + done(); + }); + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1500 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check whether the form information of the uninstall app is removed (by promise) + */ + it('bms_getFormsInfoByModule_1500', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1500============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest5.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.uninstall(BUNDLE_NAME5, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var formsInfo = await bundle.getFormsInfoByModule(BUNDLE_NAME5, 'entry'); + expect(formsInfo.length).assertEqual(0); + done(); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1600 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check whether the form information of the uninstall app is removed (by callback) + */ + it('bms_getFormsInfoByModule_1600', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1600============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest5.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.uninstall(BUNDLE_NAME5, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfoByModule(BUNDLE_NAME5, 'entry', (err, formsInfo) => { + expect(err.code).assertEqual(-1); + expect(formsInfo.length).assertEqual(0); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1700 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check whether the form information of the update app is updated (by promise) + */ + it('bms_getFormsInfoByModule_1700', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1700============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.install(['/data/test/bmsThirdBundleTestA1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + let formsInfo = await bundle.getFormsInfoByModule(BUNDLE_NAME1, 'entry') + expect(formsInfo.length).assertEqual(1); + checkFormIsExist('Form_JSA1', formsInfo, 'A1') + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + } + }) + + /** + * @tc.number: bms_getFormsInfoByModule_1800 + * @tc.name: getFormsInfoByModule : get forms information for one app + * @tc.desc: check whether the form information of the update app is updated (by callback) + */ + it('bms_getFormsInfoByModule_1800', 0, async function (done) { + console.info('==============bms_getFormsInfoByModule_1800============'); + let installer = await bundle.getBundleInstaller(); + installer.install(['/data/test/bmsThirdBundleTest1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, onReceiveinstallEvent); + + function onReceiveinstallEvent(err, data) { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + installer.install(['/data/test/bmsThirdBundleTestA1.hap'], { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + bundle.getFormsInfoByModule(BUNDLE_NAME1, 'entry', (err, formsInfo) => { + expect(err.code).assertEqual(0); + expect(formsInfo.length).assertEqual(1); + checkFormIsExist('Form_JSA1', formsInfo, 'A1'); + installer.uninstall(BUNDLE_NAME1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }); + }); + } + }) + + function checkFormIsExist(formName, dataInfo, name, system = false, vendor = false) { + let info = new Map(); + for (let i = 0, len = dataInfo.length; i < len; i++) { + info.set(dataInfo[i].name, dataInfo[i]); + } + expect(info.has(formName)).assertTrue(); + if (info.has(formName)) { + if (system) { + checkSystemHapForm(info.get(formName)); + return; + } + if (vendor) { + checkVendorHapForm(info.get(formName)); + return; + } + checkFormByName(info.get(formName), name); + } + } + + function checkFormNoExist(dataInfo, formName) { + let info = new Map(); + for (var i = 0, len = dataInfo.length; i < len; i++) { + info.set(dataInfo[i].name, 0) + } + expect(info.has(formName)).assertFalse(); + } + + function checkFormByName(dataInfo, name) { + console.info('=======Form Info========' + JSON.stringify(dataInfo)) + expect(dataInfo.name).assertEqual('Form_JS' + name); + console.info('=============ModuleName is=========' + dataInfo.moduleName); + console.info('=============supportDimensions==============' + JSON.stringify(dataInfo.supportDimensions)); + console.info('=============abilityName==============' + JSON.stringify(dataInfo.abilityName)); + expect(dataInfo.jsComponentName).assertEqual('JS_name' + name); + expect(dataInfo.formVisibleNotify).assertFalse(); + expect(typeof dataInfo.name).assertEqual('string'); + expect(typeof dataInfo.bundleName).assertEqual('string'); + expect(typeof dataInfo.moduleName).assertEqual('string'); + expect(typeof dataInfo.abilityName).assertEqual('string'); + expect(typeof dataInfo.description).assertEqual('string'); + expect(typeof dataInfo.descriptionId).assertEqual('number'); + expect(typeof dataInfo.type).assertEqual('number'); + expect(typeof dataInfo.colorMode).assertEqual('number'); + expect(typeof dataInfo.defaultFlag).assertEqual('boolean'); + expect(typeof dataInfo.jsComponentName).assertEqual('string'); + expect(typeof dataInfo.formVisibleNotify).assertEqual('boolean'); + expect(typeof dataInfo.formConfigAbility).assertEqual('string'); + expect(typeof dataInfo.updateDuration).assertEqual('number'); + expect(typeof dataInfo.defaultDimension).assertEqual('number'); + expect(typeof dataInfo.supportDimensions).assertEqual('object'); + expect(typeof dataInfo.relatedBundleName).assertEqual('string'); + console.debug('====dataInfo.scheduledUpdateTime====' + dataInfo.scheduledUpdateTime) + expect(typeof dataInfo.customizeDatas).assertEqual('object'); + for (var j = 0, len = dataInfo.customizeDatas.length; j < len; j++) { + console.info('======customizeDatasName======' + JSON.stringify(dataInfo.customizeDatas[j].name)); + expect(dataInfo.customizeDatas[j].name).assertEqual('originWidgetName' + name); + expect(typeof dataInfo.customizeDatas[j].name).assertEqual('string'); + console.info('======customizeDatasValue=====' + JSON.stringify(dataInfo.customizeDatas[j].value)); + expect(dataInfo.customizeDatas[j].value).assertEqual('com.openharmony.weather.testWidget' + name); + expect(typeof dataInfo.customizeDatas[j].value).assertEqual('string'); + } + expect(typeof dataInfo.src).assertEqual('string'); + expect(typeof dataInfo.window).assertEqual('object'); + expect(typeof dataInfo.window.designWidth).assertEqual('number'); + expect(typeof dataInfo.window.autoDesignWidth).assertEqual('boolean'); + expect(dataInfo.window.designWidth).assertEqual(DEFAULT_DESIGHN_WIDTH); + expect(dataInfo.window.autoDesignWidth).assertEqual(false); + } + +}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js new file mode 100644 index 0000000000000000000000000000000000000000..11c3eebdbc591eebfc7f51b76fa97dee49039a1b --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/ActsBmsGetBackGroundModes.test.js @@ -0,0 +1,378 @@ +/* + * 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 bundle from '@ohos.bundle' +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit' + +const BUNDLE_PATH1 = '/data/test/bmsThirdBundleTest1.hap'; +const BUNDLE_PATH2 = '/data/test/bmsThirdBundleTest2.hap'; +const BUNDLE_PATH3 = '/data/test/bmsThirdBundleTest3.hap'; +const BUNDLE_PATH4 = '/data/test/bmsThirdBundleTest4.hap'; +const BUNDLE_PATH5 = '/data/test/bmsThirdBundleTest5.hap'; +const BUNDLE_PATH6 = '/data/test/bmsThirdBundleTest6.hap'; +const BUNDLE_PATHUPDATE = '/data/test/bmsThirdBundleTestA1.hap'; +const NUM_TWO = 2; +const NUM_NINE = 9; +let dataTransfer = 1; +let audioPlayback = 2; +let audioRecording = 4; +let location = 8; +let bluetoothInteraction = 16; +let multiDeviceConnection = 32; +let wifiInteraction = 64; +let voip = 128; +let taskKeeping = 256; + +describe('ActsBmsGetBackGroundModes', function () { + + /* + * @tc.number: bms_backGroundModes_0100 + * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.desc: Get the information of the background modes from multi-ability application + */ + it('bms_backGroundModes_0100', 0, async function (done) { + console.info('=====================bms_backGroundModes_0100=================='); + var bundlePath = [BUNDLE_PATH5] + var installer = await bundle.getBundleInstaller(); + installer.install(bundlePath, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var dataInfos = await bundle.queryAbilityByWant({ + want: { + action: 'action.system.home', + entities: ['entity.system.home'], + elementName: { + deviceId: '0', + bundleName: 'com.example.third5', + abilityName: 'com.example.third5.AMainAbility', + }, + } + }, 0, 0) + expect(dataInfos.length).assertEqual(NUM_TWO); + if (dataInfos.length == NUM_TWO) { + expect(dataInfos[0].name).assertEqual("com.example.third5.AMainAbility"); + expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording + + location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping); + expect(dataInfos[1].name).assertEqual("com.example.third5.BMainAbility"); + expect(dataInfos[1].backgroundModes).assertEqual(dataTransfer + voip); + } + installer.uninstall('com.example.third5', { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }) + }) + + /* + * @tc.number: bms_backGroundModes_0200 + * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.desc: Get all background modes information, and each ability of the application + * contains one of the background mode + */ + it('bms_backGroundModes_0200', 0, async function (done) { + console.info('=====================bms_backGroundModes_0200=================='); + var bundlePath = [BUNDLE_PATH6] + var installer = await bundle.getBundleInstaller(); + installer.install(bundlePath, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var dataInfos = await bundle.queryAbilityByWant({ + want: { + action: 'action.system.home', + entities: ['entity.system.home'], + elementName: { + deviceId: '0', + bundleName: 'com.example.third6', + abilityName: '', + }, + } + }, 0, 0) + expect(dataInfos.length).assertEqual(NUM_NINE); + for (let i = 0, len = dataInfos.length; i < len; i++) { + expect(dataInfos[i].backgroundModes).assertEqual(1 << i); + console.info("==========dataInfos[i].backgroundModes=========" + dataInfos[i].backgroundModes); + console.info("==========dataInfos[1].name=========" + dataInfos[i].name); + } + installer.uninstall('com.example.third6', { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }) + }) + + /* + * @tc.number: bms_backGroundModes_0300 + * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.desc: Read the backgroundModes information of the app's ability and replace invalid attributes + */ + it('bms_backGroundModes_0300', 0, async function (done) { + console.info('=====================bms_backGroundModes_0300=================='); + var bundlePath = [BUNDLE_PATH2] + var installer = await bundle.getBundleInstaller(); + installer.install(bundlePath, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var dataInfos = await bundle.queryAbilityByWant({ + want: { + action: 'action.system.home', + entities: ['entity.system.home'], + elementName: { + deviceId: '0', + bundleName: 'com.example.third2', + abilityName: 'com.example.third2.MainAbility', + }, + } + }, 0, 0) + expect(dataInfos.length).assertEqual(1); + if (dataInfos.length == 1) { + expect(dataInfos[0].name).assertEqual("com.example.third2.MainAbility") + expect(dataInfos[0].backgroundModes).assertEqual(audioPlayback + audioRecording + location + + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping) + } + installer.uninstall('com.example.third2', { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }) + }) + + /* + * @tc.number: bms_backGroundModes_0400 + * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.desc: Read the backgroundModes information of the app's ability and replace invalid attributes + */ + it('bms_backGroundModes_0400', 0, async function (done) { + console.info('=====================bms_backGroundModes_0400=================='); + var bundlePath1 = [BUNDLE_PATH4] + var installer = await bundle.getBundleInstaller(); + installer.install(bundlePath1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var dataInfos = await bundle.queryAbilityByWant({ + want: { + action: 'action.system.home', + entities: ['entity.system.home'], + elementName: { + deviceId: '0', + bundleName: 'com.example.third4', + abilityName: 'com.example.third4.MainAbility', + }, + } + }, 0, 0) + expect(dataInfos.length).assertEqual(1); + if (dataInfos.length == 1) { + expect(dataInfos[0].name).assertEqual("com.example.third4.MainAbility") + expect(dataInfos[0].backgroundModes).assertEqual(0) + } + installer.uninstall('com.example.third4', { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }) + }) + + /* + * @tc.number: bms_backGroundModes_0500 + * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.desc: Get the backgroundModes information of the multi-hap package of the application + */ + it('bms_backGroundModes_0500', 0, async function (done) { + console.info('=====================bms_backGroundModes_0500=================='); + var bundlePath = [BUNDLE_PATH1, BUNDLE_PATH3]; + var installer = await bundle.getBundleInstaller(); + installer.install(bundlePath, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var dataInfos = await bundle.queryAbilityByWant({ + want: { + action: 'action.system.home', + entities: ['entity.system.home'], + elementName: { + deviceId: '0', + bundleName: 'com.example.third1', + abilityName: 'com.example.third1.AMainAbility', + }, + } + }, 0, 0) + expect(dataInfos.length).assertEqual(NUM_TWO); + if (dataInfos.length == NUM_TWO) { + expect(dataInfos[0].name).assertEqual("com.example.third1.MainAbility") + expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording + + location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping) + } + console.info("========dataInfos[0].backgroundModes=======>" + dataInfos[0].backgroundModes) + installer.uninstall('com.example.third1', { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }) + }) + + /* + * @tc.number: bms_backGroundModes_0600 + * @tc.name: Get the backgroundModes information of the application through queryAbilityByWant + * @tc.desc: Get the backgroundModes information of the upgraded application's ability + */ + it('bms_backGroundModes_0600', 0, async function (done) { + console.info('=====================bms_backGroundModes_0600=================='); + var bundlePath1 = [BUNDLE_PATH1] + var bundlePath2 = [BUNDLE_PATHUPDATE] + var installer = await bundle.getBundleInstaller(); + installer.install(bundlePath1, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var dataInfos = await bundle.queryAbilityByWant({ + want: { + action: 'action.system.home', + entities: ['entity.system.home'], + elementName: { + deviceId: '0', + bundleName: 'com.example.third1', + abilityName: 'com.example.third1.MainAbility', + }, + } + }, 0, 0) + expect(dataInfos.length).assertEqual(1); + if (dataInfos.length == 1) { + expect(dataInfos[0].name).assertEqual("com.example.third1.MainAbility") + expect(dataInfos[0].backgroundModes).assertEqual(dataTransfer + audioPlayback + audioRecording + + location + bluetoothInteraction + multiDeviceConnection + wifiInteraction + voip + taskKeeping) + } + installer.install(bundlePath2, { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, async (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + var dataInfos = await bundle.queryAbilityByWant({ + want: { + action: 'action.system.home', + entities: ['entity.system.home'], + elementName: { + deviceId: '0', + bundleName: 'com.example.third1', + abilityName: 'com.example.third1.AMainAbility', + }, + } + }, 0, 0) + expect(dataInfos.length).assertEqual(1); + if (dataInfos.length == 1) { + expect(dataInfos[0].name).assertEqual("com.example.third1.AMainAbility"); + expect(dataInfos[0].backgroundModes).assertEqual(audioRecording + location + bluetoothInteraction + + multiDeviceConnection + wifiInteraction + voip + taskKeeping); + } + console.info("========dataInfos[0].backgroundModes=======>" + dataInfos[0].backgroundModes) + installer.uninstall('com.example.third1', { + param: { + userId: 0, + installFlag: 1, + isKeepData: false + } + }, (err, data) => { + expect(err.code).assertEqual(0); + expect(data.status).assertEqual(0); + expect(data.statusMessage).assertEqual('SUCCESS'); + done(); + }); + }) + }) + }) +}) \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/List.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..673e2c7e6eabd1127771ed3d9038fc55936d502d --- /dev/null +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/entry/src/main/js/test/List.test.js @@ -0,0 +1,16 @@ +/* + * 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('./ActsBmsGetBackGroundModes.test.js') +require('./ActsBmsFormsInfoTest.test.js') \ No newline at end of file diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/signature/openharmony_sx.p7b b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/signature/openharmony_sx.p7b new file mode 100755 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/appexecfwk/bundle_standard/bundlemanager/actsbmsgetinfostest/signature/openharmony_sx.p7b differ