diff --git a/aafwk/aafwk_standard/BUILD.gn b/aafwk/aafwk_standard/BUILD.gn index 28cd38fa6f15bec29666b126891fd463a620771f..85ead7f85dedf0821b3ae0da27d37613964c2f4a 100644 --- a/aafwk/aafwk_standard/BUILD.gn +++ b/aafwk/aafwk_standard/BUILD.gn @@ -22,6 +22,8 @@ group("aafwk_standard") { "featureability:featureability", "formmanager:formmanager", "want:want", + + #"verifypermission:verifypermission" ] } } diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js index fcf425e89f99a29a6a5a6094f499e1c8225e8881..2f03d90ffb65985dc27ebf2cfde7e2c99893eef9 100644 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/clearmissionscallback/src/main/js/test/MangerAbilityJsunit.test.js @@ -39,6 +39,12 @@ describe('ActsAmsCallBackSixth Scene', function () { ); sleep(5000) }); + + function sleep(delay) { + var start = (new Date()).getTime(); + while((new Date()).getTime() - start < delay) {} + } + /* * @tc.number : Acts_Ams_test_12200 * @tc.name : clearMissions : Clear Missions diff --git a/aafwk/aafwk_standard/abilitymanager/sceneProject/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js b/aafwk/aafwk_standard/abilitymanager/sceneProject/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js index 3484edca5314a8936964924e288d44aa95a20fb1..209adafcfb4068e11b97dfd885450a39a4581f64 100644 --- a/aafwk/aafwk_standard/abilitymanager/sceneProject/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js +++ b/aafwk/aafwk_standard/abilitymanager/sceneProject/clearmissionspromise/src/main/js/test/MangerAbilityJsunit.test.js @@ -42,9 +42,7 @@ describe('ActsAmsCallBackSixth Scene', function () { function sleep(delay) { var start = (new Date()).getTime(); - while((new Date()).getTime() - start < delay) { - continue; - } + while((new Date()).getTime() - start < delay) {} } /* diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/BUILD.gn b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..bab290c007a4747e61b09f268da51ad15d09f9ac --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/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("AmsJsStMain") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "AmsJsStMain" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/Test.json b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..26909f2889de98a479f076f87725fed805c7a343 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/Test.json @@ -0,0 +1,4 @@ +{ + "description": "Configuration for hjunit demo Tests", +} + diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/config.json b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..0362fcb75be1160b536ac00408b788ca7bbf5bd4 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/config.json @@ -0,0 +1,276 @@ +{ + "app": { + "bundleName": "com.amsst.amsjsstmain", + "vendor": "amsst", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "defPermissions": [ + { + "name": "com.amsst.permission.SYSPERMISSION", + "grantMode": "system_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.GET_NETWORK_INFO", + "grantMode": "system_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.GET_WIFI_INFO", + "grantMode": "system_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.SET_NETWORK_INFO", + "grantMode": "system_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.SET_WIFI_INFO", + "grantMode": "system_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.CAMERA", + "grantMode": "user_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.PERMISSIONA", + "grantMode": "user_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.PERMISSIONB", + "grantMode": "user_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.PERMISSIONC", + "grantMode": "user_grant", + "availableScope": [] + }, + { + "name": "ohos.permission.PERMISSIOND", + "grantMode": "user_grant", + "availableScope": [] + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.CAMERA", + "reason": "$string:permreason_camera", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }, + { + "name": "com.amsst.permission.SYSPERMISSION", + "reason": "$string:permreason_sys", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.PERMISSIONA", + "reason": "NEED ohos.permission.PERMISSIONA", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.PERMISSIONB", + "reason": "NEED ohos.permission.PERMISSIONB", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.PERMISSIONC", + "reason": "NEED ohos.permission.PERMISSIONC", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.PERMISSIOND", + "reason": "NEED ohos.permission.PERMISSIOND", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.GET_NETWORK_INFO", + "reason": "$string:permreason_getnetworkinfo", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.USE_BLUETOOTH" + }, + { + "name": "ohos.permission.DISCOVER_BLUETOOTH" + }, + { + "name": "ohos.permission.SET_NETWORK_INFO" + }, + { + "name": "ohos.permission.SET_WIFI_INFO" + }, + { + "name": "ohos.permission.SPREAD_STATUS_BAR" + }, + { + "name": "ohos.permission.INTERNET" + }, + { + "name": "ohos.permission.MODIFY_AUDIO_SETTINGS" + }, + { + "name": "ohos.permission.RECEIVER_STARTUP_COMPLETED" + }, + { + "name": "ohos.permission.RUNNING_LOCK" + }, + { + "name": "ohos.permission.ACCESS_BIOMETRIC" + }, + { + "name": "ohos.permission.RCV_NFC_TRANSACTION_EVENT" + }, + { + "name": "ohos.permission.COMMONEVENT_STICKY" + }, + { + "name": "ohos.permission.SYSTEM_FLOAT_WINDOW" + }, + { + "name": "ohos.permission.VIBRATE" + }, + { + "name": "ohos.permission.USE_TRUSTCIRCLE_MANAGER" + }, + { + "name": "ohos.permission.USE_WHOLE_SCREEN" + }, + { + "name": "ohos.permission.SET_WALLPAPER" + }, + { + "name": "ohos.permission.SET_WALLPAPER_DIMENSION" + }, + { + "name": "ohos.permission.REARRANGE_MISSIONS" + }, + { + "name": "ohos.permission.CLEAN_BACKGROUND_PROCESSES" + }, + { + "name": "ohos.permission.KEEP_BACKGROUND_RUNNING" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" + }, + { + "name": "ohos.permission.ACCELEROMETER" + }, + { + "name": "ohos.permission.GYROSCOPE" + }, + { + "name": "ohos.permission.MULTIMODAL_INTERACTIVE" + }, + { + "name": "ohos.permission.radio.ACCESS_FM_AM" + }, + { + "name": "ohos.permission.NFC_TAG" + }, + { + "name": "ohos.permission.NFC_CARD_EMULATION" + }, + { + "name": "ohos.permission.DISTRIBUTED_DEVICE_STATE_CHANGE" + }, + { + "name": "ohos.permission.GET_DISTRIBUTED_DEVICE_INFO" + } + ], + "package": "com.amsst.amsjsstmain", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.amsst.amsjsstmain.MainAbility", + "icon": "$media:icon", + "description": "$string:mainability_description", + "label": "$string:app_name", + "type": "page", + "launchType": "standard", + "visible": true + } + ], + "js": [ + { + "pages": [ + "pages/index/index", + "pages/permissionPage/permissionPage" + ], + "name": "default", + "window": { + "designWidth": 720, + "autoDesignWidth": true + } + } + ] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..a66a245b33514363f81b281b0471ca426479e717 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/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/verifypermission/AmsJsStMain/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/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/verifypermission/AmsJsStMain/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/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/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..293dfaacdc0773b3bb469859b0e57609624e9d09 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,56 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 32px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("../../common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +div>div{ + width: 100%; + height: 200px; + flex-direction: column; + align-items: center; + justify-content: center; +} + +.btn{ + margin-bottom: 20px; +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..d58b603dfca48012fe641dcfab7c9e56945de9df --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,11 @@ +
+
+ + {{ title }} + +
+
+ + +
+
diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..92a52660c9b16a44f126f3486182f0f197f100ba --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,52 @@ +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, + +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import file from '@system.file' +import app from '@system.app' +import router from '@system.router'; +import featureAbility from '@ohos.ability.featureability' + +export default { + data: { + title: "AmsJsStMain" + }, + onInit() { + console.debug('====onInit()====<') + this.title = "AmsJsStMain"; + }, + onShow() { + console.debug('====onShow()====<') + }, + onReady() { + console.debug('====onReady finish====<') + }, + onBackPress(){ + console.debug('====onBackPress()====<') + }, + async stopAbility(){ + console.debug('====close====<') + await featureAbility.terminateAbility(); + }, + clickAction(){ + console.debug('====clickAction====<') + router.replace({ + uri: 'pages/permissionPage/permissionPage' + }) + }, + titleAction(){ + console.debug('====titleAction()====<') + this.title += "\nMyTest" + }, +} diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.css b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.css new file mode 100644 index 0000000000000000000000000000000000000000..71b7471f0f06ad7504b403ccc38f7682b62872b7 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.css @@ -0,0 +1,50 @@ +.container { + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 100%; + height: 100%; +} + +.title { + font-size: 30px; + text-align: center; + width: 100%; + height: 80px; +} +div{ + flex-direction: column; + align-items: center; + justify-content: center; +} + +.btn{ + margin-bottom: 10px; + width: 200px; + height: 50px; +} +.log { + font-size: 20px; + text-align: center; + width: 100%; + height: 400px; +} +.todo-wraper { + width: 450px; + height: 450px; + justify-content: center; +} +.todo-item { + width: 450px; + flex-direction: column; + justify-content: center; +} +.text { + margin: 20%; +} +.menu-wraper { + width: 450px; + height: 100px; + justify-content: center; +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.hml b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.hml new file mode 100644 index 0000000000000000000000000000000000000000..6b84e5f39134aae807fe98fdd90cbaa01f36817b --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.hml @@ -0,0 +1,26 @@ +
+
+ + {{ title }} + +
+
+ +
+
+ + + + + + + + + + +
+
diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.js b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.js new file mode 100644 index 0000000000000000000000000000000000000000..fd03997db0e57e153c8c4c979e1dc44da10b5d89 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissionPage.js @@ -0,0 +1,122 @@ +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, + +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import file from '@system.file' +import app from '@system.app' +import router from '@system.router'; +import featureAbility from '@ohos.ability.featureability' +import abilityManager from '@ohos.app.abilitymanager' + +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index' + +export default { + currentCase: "", + data: { + title: "AbilityA1", + logmessage: "this is log message", + testcase: [ + "AppPermission_0100", + "AppPermission_0200", + "AppPermission_0300", + "AppPermission_0400", + "AppPermission_0500", + "AppPermission_0600", + "AppPermission_0700", + "AppPermission_0800", + "AppPermission_0900", + "AppPermission_1000", + "AppPermission_1100", + "AppPermission_1200", + "AppPermission_1300", + "AppPermission_1400", + "AppPermission_1500", + "AppPermission_1600", + "AppPermission_1700", + "AppPermission_1800", + "AppPermission_1900", + "AppPermission_2000", + "AppPermission_2100", + "AppPermission_2200", + "AppPermission_2300", + "AppPermission_2400", + "AppPermission_2500", + "AppPermission_2600_ResPermission", + "AppPermission_2600", + "AppPermission_2700_ResPermission", + "AppPermission_2700", + "AppPermission_2800_ResPermission", + "AppPermission_2800", + ], + }, + onInit() { + this.title = "AbilityA1"; + this.logmessage = "this is log message"; + }, + onShow() { + }, + onReady() { + console.info('====per onReady finish====>') + }, + onBackPress() { + }, + async stopAbility() { + console.info('===========per close===========>') + await featureAbility.terminateAbility(); + await app.killProcessesByBundleName(); + }, + clickAction() { + router.replace({ + uri: 'pages/index/index' + }) + }, + testAction() { + console.info('===========per testAction===========>') + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + const reportExtend = new ReportExtend(file) + core.addService('expect', expectExtend) + core.addService('report', reportExtend) + core.init() + const configService = core.getDefaultService('config') + configService.setConfig(this) + + require('../../../test/List.test') + core.execute() + }, + runCase(caseName) { + console.debug("======per runCase======>:" + JSON.stringify(caseName)) + this.logmessage += caseName + "\n" + console.debug("======per runallcase======<:") + let { runAllCase } = require('./permissioncase.js') + runAllCase(caseName, this) + + }, + CaseChange(newValue) { + let { GetCaseInfo } = require('./permissioncase.js') + this.logmessage = newValue.value + this.logmessage += GetCaseInfo(newValue.value) + this.currentCase = newValue.value + }, + RunSelectCase() { + let { runAllCase } = require('./permissioncase.js') + runAllCase(this.currentCase, this) + }, + ShowMenu() { + this.logmessage = "show" + this.$element("menu-wraper").show({ x: 200, y: 200 }) + } +} diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissioncase.js b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissioncase.js new file mode 100644 index 0000000000000000000000000000000000000000..9ad415e31a5076a651d8b9022c68bcb99a9afd78 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/default/pages/permissionPage/permissioncase.js @@ -0,0 +1,1052 @@ +/* +* 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 featureAbility from '@ohos.ability.featureability' +import abilityManager from '@ohos.app.abilitymanager' + +export function runAllCase(caseName, obj) { + console.debug("====runAllCase1====>:" + JSON.stringify(caseName)) + console.debug("====runAllCase2====>:" + JSON.stringify(allCase)) + allCase[caseName].func(obj) +} +export function GetCaseInfo(caseName) { + console.debug("====GetCaseInfo====>:" + JSON.stringify(caseName)) + return allCase[caseName].info; +} + +var allCase = { + AppPermission_0100: { + func: AppPermission_0100, + info: "Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) is automatically requested during installation." + }, + AppPermission_0200: { + func: AppPermission_0200, + info: "Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) is automatically requested during installation." + }, + AppPermission_0300: { + func: AppPermission_0300, + info: "Verify that a user_grand system`s permission(ohos.permission.CAMERA) is not automatically requested during installation." + }, + AppPermission_0400: { + func: AppPermission_0400, + info: "Verify that a user_grand system`s permission(ohos.permission.CAMERA) is not automatically requested during installation." + }, + AppPermission_0500: { + func: AppPermission_0500, + info: "Verify that a system_grand user`s permission(com.amsst.permission.SYSPERMISSION) is automatically requested during installation." + }, + AppPermission_0600: { + func: AppPermission_0600, + info: "Verify that a system_grand user`s permission(com.amsst.permission.SYSPERMISSION) is automatically requested during installation." + }, + AppPermission_0700: { + func: AppPermission_0700, + info: "Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) is automatically requested during installation." + }, + AppPermission_0800: { + func: AppPermission_0800, + info: "Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) is automatically requested during installation." + }, + AppPermission_0900: { + func: AppPermission_0900, + info: "Verify that a user_grand system`s permission(ohos.permission.CAMERA) is not automatically requested during installation." + }, + AppPermission_1000: { + func: AppPermission_1000, + info: "Verify that a user_grand system`s permission(ohos.permission.CAMERA) is not automatically requested during installation." + }, + AppPermission_1100: { + func: AppPermission_1100, + info: "Verify that a system_grand user`s permission(com.amsst.permission.SYSPERMISSION) is automatically requested during installation." + }, + AppPermission_1200: { + func: AppPermission_1200, + info: "Verify that a system_grand user`s permission(com.amsst.permission.SYSPERMISSION) is automatically requested during installation." + }, + AppPermission_1300: { + func: AppPermission_1300, + info: "Verify that calling application(different application in the same device) is requested the system_grand system`s permission(ohos.permission.GET_NETWORK_INFO)" + }, + AppPermission_1400: { + func: AppPermission_1400, + info: "Verify that calling application(different application in the same device) is requested the system_grand system`s permission(ohos.permission.GET_NETWORK_INFO)" + }, + AppPermission_1500: { + func: AppPermission_1500, + info: "Verify that calling application(different application in the same device) is not requested the user_grand system`s permission(ohos.permission.CAMERA)" + }, + AppPermission_1600: { + func: AppPermission_1600, + info: "Verify that calling application(different application in the same device) is not requested the user_grand system`s permission(ohos.permission.CAMERA)" + }, + AppPermission_1700: { + func: AppPermission_1700, + info: "Verify that calling application(different application in the same device) is requested the system_grand user`s permission(com.amsst.permission.SYSPERMISSION)" + }, + AppPermission_1800: { + func: AppPermission_1800, + info: "Verify that calling application(different application in the same device) is requested the system_grand user`s permission(com.amsst.permission.SYSPERMISSION)" + }, + AppPermission_1900: { + func: AppPermission_1900, + info: "Verify that application without calling application(other device) is requested the system_grand system`s permission(ohos.permission.GET_NETWORK_INFO)" + }, + AppPermission_2000: { + func: AppPermission_2000, + info: "Verify that application without calling application(other device) is requested the system_grand system`s permission(ohos.permission.GET_NETWORK_INFO)" + }, + AppPermission_2100: { + func: AppPermission_2100, + info: "Verify that application without calling application(other device) is not requested the system_grand system`s permission(ohos.permission.GET_WIFI_INFO)" + }, + AppPermission_2200: { + func: AppPermission_2200, + info: "Verify that application without calling application(other device) is not requested the system_grand system`s permission(ohos.permission.GET_WIFI_INFO)" + }, + AppPermission_2300: { + func: AppPermission_2300, + info: "Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) can not requested during runtime." + }, + AppPermission_2400: { + func: AppPermission_2400, + info: "Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) can not requested during runtime." + }, + AppPermission_2500: { + func: AppPermission_2500, + info: "Verify that a user_grand system`s permission(ohos.permission.CAMERA) can requested during runtime." + }, + AppPermission_2600_ResPermission: { + func: AppPermission_2600_ResPermission, + info: "Request Permission CAMERA." + }, + AppPermission_2600: { + func: AppPermission_2600, + info: "Verify that a user_grand system`s permission(ohos.permission.PERMISSIONA) can requested during runtime." + }, + AppPermission_2700_ResPermission: { + func: AppPermission_2700_ResPermission, + info: "Request Permission ohos.permission.PERMISSIONA." + }, + AppPermission_2700: { + func: AppPermission_2700, + info: "Verify that a user_grand system`s permission(ohos.permission.PERMISSIONA) can requested during runtime." + }, + AppPermission_2800_ResPermission: { + func: AppPermission_2800_ResPermission, + info: "Request Permission ohos.permission.PERMISSIONB, ohos.permission.PERMISSIONC." + }, + AppPermission_2800: { + func: AppPermission_2800, + info: "Verify that a user_grand system`s permission(ohos.permission.PERMISSIONB, ohos.permission.PERMISSIONC) can requested during runtime." + }, +} + +async function GetThisProcessInfo() { + console.debug("====GetThisProcessInfo:begin====<"); + var processInfoArray = await abilityManager.getAllRunningProcesses() + console.debug("====processInfoArray====>:" + JSON.stringify(processInfoArray.length) + " , " + JSON.stringify(processInfoArray)) + var thisProcessInfo = processInfoArray[0] + for (let i = 0; i < processInfoArray.length; i++) { + if (processInfoArray[i].processName == "com.amsst.amsjsstmain") { + thisProcessInfo = processInfoArray[i] + break + } + } + console.debug("======GetThisProcessInfo:end======<"); + return thisProcessInfo; +} + + +/* + * @tc.number : AppPermission_0100 + * @tc.name : Verify that ohos.permission.GET_NETWORK_INFO is requested + * @tc.desc : Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + * is automatically requested during installation. + */ +async function AppPermission_0100(thisobj) { + var thisFunctionName = AppPermission_0100.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + await context.verifyPermission("ohos.permission.GET_NETWORK_INFO", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }, + (err, data) => { + console.debug("====verifyPermission:data====>:" + JSON.stringify(data)) + thisobj.logmessage += JSON.stringify(data) + "\n" + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_0200 + * @tc.name : Verify that ohos.permission.GET_NETWORK_INFO is requested + * @tc.desc : Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + * is automatically requested during installation. + */ +async function AppPermission_0200(thisobj) { + var thisFunctionName = AppPermission_0200.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + await context.verifyPermission("ohos.permission.GET_NETWORK_INFO", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }, + (err, data) => { + console.debug("====verifyPermission:data====>:" + JSON.stringify(data)); + + console.debug("======verifyPermission:result======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n" + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }); +} + + +/* + * @tc.number : AppPermission_0300 + * @tc.name : Verify that ohos.permission.CAMERA is not requested + * @tc.desc : Verify that a user_grand system`s permission(ohos.permission.CAMERA) + * is not automatically requested during installation. + */ +async function AppPermission_0300(thisobj) { + var thisFunctionName = AppPermission_0300.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + await context.verifyPermission("ohos.permission.CAMERA", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }, + (err, data) => { + console.debug("======verifyPermission:data======>:" + JSON.stringify(data)) + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == -1) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_0400 + * @tc.name : Verify that ohos.permission.CAMERA is requested + * @tc.desc : Verify that a user_grand system`s permission(ohos.permission.CAMERA) + * is automatically requested during installation. + */ +async function AppPermission_0400(thisobj) { + var thisFunctionName = AppPermission_0400.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + var result = await context.verifyPermission("ohos.permission.CAMERA", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }) + console.debug("======verifyPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n"; + if (result == -1) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_0500 + * @tc.name : Verify that com.amsst.permission.SYSPERMISSION is requested + * @tc.desc : Verify that a system_grand user`s permission(com.amsst.permission.SYSPERMISSION) + * is automatically requested during installation. + */ +async function AppPermission_0500(thisobj) { + var thisFunctionName = AppPermission_0500.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + await context.verifyPermission("com.amsst.permission.SYSPERMISSION", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }, + (err, data) => { + console.debug("======verifyPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == 0) { + ; + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_0600 + * @tc.name : Verify that com.amsst.permission.SYSPERMISSION is requested + * @tc.desc : Verify that a system_grand user`s permission(com.amsst.permission.SYSPERMISSION) + * is automatically requested during installation. + */ +async function AppPermission_0600(thisobj) { + var thisFunctionName = AppPermission_0600.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext(); + var result = await context.verifyPermission("com.amsst.permission.SYSPERMISSION", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }) + console.debug("======verifyPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n"; + if (result == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + + +/* + * @tc.number : AppPermission_0700 + * @tc.name : Verify that ohos.permission.GET_NETWORK_INFO is requested + * @tc.desc : Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + * is automatically requested during installation. + */ +async function AppPermission_0700(thisobj) { + var thisFunctionName = AppPermission_0700.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + await context.verifySelfPermission("ohos.permission.GET_NETWORK_INFO", + (err, data) => { + console.debug("======verifySelfPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_0800 + * @tc.name : Verify that ohos.permission.GET_NETWORK_INFO is requested by self + * @tc.desc : Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + * is automatically requested during installation. + */ +async function AppPermission_0800(thisobj) { + var thisFunctionName = AppPermission_0800.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var result = await context.verifySelfPermission("ohos.permission.GET_NETWORK_INFO") + console.debug("======verifySelfPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n"; + if (result == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_0900 + * @tc.name : Verify that ohos.permission.CAMERA is not requested by self + * @tc.desc : Verify that a user_grand system`s permission(ohos.permission.CAMERA) + * is not automatically requested during installation. + */ +async function AppPermission_0900(thisobj) { + var thisFunctionName = AppPermission_0900.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + await context.verifySelfPermission("ohos.permission.CAMERA", + (err, data) => { + console.debug("======verifySelfPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == -1) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_1000 + * @tc.name : Verify that ohos.permission.CAMERA is requested by self + * @tc.desc : Verify that a user_grand system`s permission(ohos.permission.CAMERA) + * is automatically requested during installation. + */ +async function AppPermission_1000(thisobj) { + var thisFunctionName = AppPermission_1000.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var result = await context.verifySelfPermission("ohos.permission.CAMERA") + console.debug("======verifySelfPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n"; + if (result == -1) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_1100 + * @tc.name : Verify that com.amsst.permission.SYSPERMISSION is requested by self + * @tc.desc : Verify that a system_grand user`s permission(com.amsst.permission.SYSPERMISSION) + * is automatically requested during installation. + */ +async function AppPermission_1100(thisobj) { + var thisFunctionName = AppPermission_1100.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + await context.verifySelfPermission("com.amsst.permission.SYSPERMISSION", + (err, data) => { + console.debug("======verifySelfPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_1200 + * @tc.name : Verify that com.amsst.permission.SYSPERMISSION is requested by self + * @tc.desc : Verify that a system_grand user`s permission(com.amsst.permission.SYSPERMISSION) + * is automatically requested during installation. + */ +async function AppPermission_1200(thisobj) { + var thisFunctionName = AppPermission_1200.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var result = await context.verifySelfPermission("com.amsst.permission.SYSPERMISSION") + console.debug("======verifySelfPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n"; + if (result == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n" + return -1;; + } +} + +/* + * @tc.number : AppPermission_1300 + * @tc.name : Verify that calling application(different application in the same device) have requested ohos.permission.GET_NETWORK_INFO + * @tc.desc : Verify that calling application(different application in the same device) is requested + * the system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + */ +async function AppPermission_1300(thisobj) { + var thisFunctionName = AppPermission_1300.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + featureAbility.startAbility( + { + want: + { + bundleName: "com.amsst.amsjsstsubpermission", + abilityName: "com.amsst.amsjsstsubpermission.MainAbility" + } + } + ); + return 0; +} + +/* + * @tc.number : AppPermission_1400 + * @tc.name : Verify that calling application(different application in the same device) have requested ohos.permission.GET_NETWORK_INFO + * @tc.desc : Verify that calling application(different application in the same device) is requested + * the system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + */ +async function AppPermission_1400(thisobj) { + var thisFunctionName = AppPermission_1400.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + featureAbility.startAbility( + { + want: + { + bundleName: "com.amsst.amsjsstsubpermission", + abilityName: "com.amsst.amsjsstsubpermission.MainAbility" + } + } + ) + return 0; +} + +/* + * @tc.number : AppPermission_1500 + * @tc.name : Verify that calling application(different application in the same device) have not requested ohos.permission.CAMERA + * @tc.desc : Verify that calling application(different application in the same device) + * is not requested the user_grand system`s permission(ohos.permission.CAMERA) + */ +async function AppPermission_1500(thisobj) { + var thisFunctionName = AppPermission_1500.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + featureAbility.startAbility( + { + want: + { + bundleName: "com.amsst.amsjsstsubpermission", + abilityName: "com.amsst.amsjsstsubpermission.MainAbility" + } + } + ) + return 0; +} + +/* + * @tc.number : AppPermission_1600 + * @tc.name : Verify that calling application(different application in the same device) have not requested ohos.permission.CAMERA + * @tc.desc : Verify that calling application(different application in the same device) + * is not requested the user_grand system`s permission(ohos.permission.CAMERA) + */ +async function AppPermission_1600(thisobj) { + var thisFunctionName = AppPermission_1600.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + featureAbility.startAbility( + { + want: + { + bundleName: "com.amsst.amsjsstsubpermission", + abilityName: "com.amsst.amsjsstsubpermission.MainAbility" + } + } + ) + return 0; +} + +/* + * @tc.number : AppPermission_1700 + * @tc.name : Verify that calling application(different application in the same device) have requested com.amsst.permission.SYSPERMISSION + * @tc.desc : Verify that calling application(different application in the same device) + * is requested the system_grand user`s permission(com.amsst.permission.SYSPERMISSION) + */ +async function AppPermission_1700(thisobj) { + var thisFunctionName = AppPermission_1700.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var result = await context.verifySelfPermission("com.amsst.permission.SYSPERMISSION") + await featureAbility.startAbility( + { + want: + { + bundleName: "com.amsst.amsjsstsubpermission", + abilityName: "com.amsst.amsjsstsubpermission.MainAbility" + } + } + ) + return 0; +} + +/* + * @tc.number : AppPermission_1800 + * @tc.name : Verify that calling application(different application in the same device) have requested com.amsst.permission.SYSPERMISSION + * @tc.desc : Verify that calling application(different application in the same device) + * is requested the system_grand user`s permission(com.amsst.permission.SYSPERMISSION) + */ +async function AppPermission_1800(thisobj) { + var thisFunctionName = AppPermission_1800.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + await featureAbility.startAbility( + { + want: + { + bundleName: "com.amsst.amsjsstsubpermission", + abilityName: "com.amsst.amsjsstsubpermission.MainAbility" + } + } + ) + return 0; +} + +/* + * @tc.number : AppPermission_1900 + * @tc.name : Verify that application without calling application(other device) have requested ohos.permission.GET_NETWORK_INFO + * @tc.desc : Verify that application without calling application(other device) + * is requested the system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + */ + +async function AppPermission_1900(thisobj) { + var thisFunctionName = AppPermission_1900.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + await context.verifyCallingOrSelfPermission("ohos.permission.GET_NETWORK_INFO", + (err, data) => { + console.debug("======verifyCallingOrSelfPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_2000 + * @tc.name : Verify that application without calling application(other device) have requested ohos.permission.GET_NETWORK_INFO + * @tc.desc : Verify that application without calling application(other device) + * is requested the system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + */ +async function AppPermission_2000(thisobj) { + var thisFunctionName = AppPermission_2000.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + var result = await context.verifyCallingOrSelfPermission("ohos.permission.GET_NETWORK_INFO") + console.debug("======verifyCallingOrSelfPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n"; + if (result == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_2100 + * @tc.name : Verify that application without calling application(other device) have not requested .GET_WIFI_INFO + * @tc.desc : Verify that application without calling application(other device) + * is requested the system_grand system`s permission(ohos.permission..GET_WIFI_INFO) + */ +async function AppPermission_2100(thisobj) { + var thisFunctionName = AppPermission_2100.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + await context.verifyCallingOrSelfPermission("ohos.permission.GET_WIFI_INFO", + (err, data) => { + console.debug("======verifyCallingOrSelfPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == -1) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_2200 + * @tc.name : Verify that application without calling application(other device) have not requested .GET_WIFI_INFO + * @tc.desc : Verify that application without calling application(other device) + * is requested the system_grand system`s permission(ohos.permission..GET_WIFI_INFO) + */ +async function AppPermission_2200(thisobj) { + var thisFunctionName = AppPermission_2200.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + var result = await context.verifyCallingOrSelfPermission("ohos.permission.GET_WIFI_INFO") + console.debug("======verifyCallingOrSelfPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n"; + if (result == -1) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_2300 + * @tc.name : Verify that ohos.permission.GET_NETWORK_INFO can not requested by user + * @tc.desc : Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + * can not requested during runtime. + */ +async function AppPermission_2300(thisobj) { + var thisFunctionName = AppPermission_2300.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + await context.canRequestPermission("ohos.permission.GET_NETWORK_INFO", + (err, data) => { + console.debug("======canRequestPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n" + if (data == false) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +/* + * @tc.number : AppPermission_2400 + * @tc.name : Verify that ohos.permission.GET_NETWORK_INFO can not requested by user + * @tc.desc : Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) + * can not requested during runtime. + */ +async function AppPermission_2400(thisobj) { + var thisFunctionName = AppPermission_2400.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var result = await context.canRequestPermission("ohos.permission.GET_NETWORK_INFO") + console.debug("======canRequestPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n" + if (result == false) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_2500 + * @tc.name : Verify that ohos.permission.CAMERA can requested by user + * @tc.desc : Verify that a user_grand system`s permission(ohos.permission.CAMERA) + * can requested during runtime. + */ +async function AppPermission_2500(thisobj) { + var thisFunctionName = AppPermission_2500.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + await context.canRequestPermission("ohos.permission.CAMERA", + (err, data) => { + console.debug("======canRequestPermission:data======>:" + JSON.stringify(data));; + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == true) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +async function AppPermission_2600_ResPermission(thisobj) { + var thisFunctionName = AppPermission_2600_ResPermission.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var result = await context.canRequestPermission("ohos.permission.PERMISSIOND") + console.debug("======canRequestPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n"; + if (result == true) { + await context.requestPermissionsFromUser(["ohos.permission.PERMISSIOND"], 1, + (err, data) => { + console.log("RequestPermissionForUser:requestCode=" + data.requestCode); + for (var j = 0; j < data.permissions.length; j++) { + console.log("RequestPermissionForUser permissions : " + data.permissions[j]); + } + + for (var j = 0; j < data.grantResults.length; j++) { + console.log("RequestPermissionForUser grantResults : " + data.grantResults[j]); + } + }); + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_2600 + * @tc.name : Verify that ohos.permission.CAMERA can requested by user + * @tc.desc : Verify that a user_grand system`s permission(ohos.permission.CAMERA) + * can requested during runtime. + */ +async function AppPermission_2600(thisobj) { + var thisFunctionName = AppPermission_2600.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + await context.verifyPermission("ohos.permission.PERMISSIOND", + (err, data) => { + console.debug("====verifyPermission:data====>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n" + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} + +async function AppPermission_2700_ResPermission(thisobj) { + var thisFunctionName = AppPermission_2700_ResPermission.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var result = await context.canRequestPermission("ohos.permission.PERMISSIONA") + console.debug("======canRequestPermission:result======>:" + JSON.stringify(result)); + thisobj.logmessage += JSON.stringify(result) + "\n" + if (result == true) { + await context.requestPermissionsFromUser(["ohos.permission.PERMISSIONA"], 1, + (err, data) => { + console.log("RequestPermissionForUser:requestCode=" + data.requestCode); + for (var j = 0; j < data.permissions.length; j++) { + console.log("RequestPermissionForUser permissions : " + data.permissions[j]); + } + + for (var j = 0; j < data.grantResults.length; j++) { + console.log("RequestPermissionForUser grantResults : " + data.grantResults[j]); + } + }); + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_2700 + * @tc.name : Verify that ohos.permission.PERMISSIONA can requested by user + * @tc.desc : Verify that a user_grand system`s permission(ohos.permission.CAMERA) + * can requested during runtime. + */ +async function AppPermission_2700(thisobj) { + var thisFunctionName = AppPermission_2700.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + var data = await context.verifyPermission("ohos.permission.PERMISSIONA", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }); + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +async function AppPermission_2800_ResPermission(thisobj) { + var thisFunctionName = AppPermission_2800_ResPermission.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var context = await featureAbility.getContext() + var result1 = await context.canRequestPermission("ohos.permission.PERMISSIONB") + var result2 = await context.canRequestPermission("ohos.permission.PERMISSIONC") + console.debug("======canRequestPermission:result1======>:" + JSON.stringify(result1)); + console.debug("======canRequestPermission:result2======>:" + JSON.stringify(result2)); + thisobj.logmessage += JSON.stringify(result1) + "\n"; + thisobj.logmessage += JSON.stringify(result2) + "\n"; + if (result1 && result2) { + await context.requestPermissionsFromUser(["ohos.permission.PERMISSIONB", "ohos.permission.PERMISSIONC"], 1, + (err, data) => { + console.log("RequestPermissionForUser:requestCode=" + data.requestCode); + for (var j = 0; j < data.permissions.length; j++) { + console.log("RequestPermissionForUser permissions : " + data.permissions[j]); + } + + for (var j = 0; j < data.grantResults.length; j++) { + console.log("RequestPermissionForUser grantResults : " + data.grantResults[j]); + } + }); + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } +} + +/* + * @tc.number : AppPermission_2800 + * @tc.name : Verify that ohos.permission.PERMISSIONB, ohos.permission.PERMISSIONB, can requested by user + * @tc.desc : Verify that a user_grand system`s permission(ohos.permission.CAMERA) + * can requested during runtime. + */ +async function AppPermission_2800(thisobj) { + var thisFunctionName = AppPermission_2800.name + thisobj.logmessage = ""; + thisobj.logmessage += "run test case " + thisFunctionName + "\n"; + + var thisProcessInfo = await GetThisProcessInfo() + var context = await featureAbility.getContext() + await context.verifyPermission("ohos.permission.PERMISSIONB", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }, + (err, data) => { + console.debug("====verifyPermission:data====>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n"; + if (data == 0) { + context.verifyPermission("ohos.permission.PERMISSIONC", { + options: { + pid: thisProcessInfo.pid, + uid: thisProcessInfo.uid, + } + }, + (err, data) => { + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n"; + return 0; + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n"; + return -1; + } + }) +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/test/AmsJsunit.test.js b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/test/AmsJsunit.test.js new file mode 100644 index 0000000000000000000000000000000000000000..ad88305702a3c87b042668d2891ddd46eed1244b --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/test/AmsJsunit.test.js @@ -0,0 +1,201 @@ +/* +* 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 featureAbility from '@ohos.ability.featureability' +import abilityManager from '@ohos.app.abilitymanager' + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +describe ('AmsSystemTest_AppPermission', function () { + it('AppPermission_0100', 0, async function (done) { + console.info('=====================AppPermission_0100==================<'); + var dataInfo = await bundle.getBundleInfo('com.amsst.amsjsstmain',1); + console.debug("======dataInfo======>:" + JSON.stringify(dataInfo)); + var processInfoArray = await abilityManager.getAllRunningProcesses(); + console.debug("======processInfoArray======>:" + JSON.stringify(processInfoArray)); + var thisProcessInfo = processInfoArray[0]; + for(let i=0; i:" + JSON.stringify(thisProcessInfo)); + var context = await featureAbility.getContext(); + await context.verifyPermission("ohos.permission.GET_NETWORK_INFO", thisProcessInfo.pid, thisProcessInfo.uid, + (err, data) => { + console.debug("======verifyPermission:data======>:" + JSON.stringify(data)); + expect(err.code).assertEqual(0) + expect(data).assertEqual(0) + done() + }) + done() + }) + it('AppPermission_0200', 0, async function (done) { + console.info('=====================AppPermission_0200==================<'); + var processInfoArray = await abilityManager.getAllRunningProcesses(); + console.debug("======processInfoArray======>:" + JSON.stringify(processInfoArray)); + var thisProcessInfo = processInfoArray[0]; + for(let i=0; i:" + JSON.stringify(thisProcessInfo)); + var context = await featureAbility.getContext(); + var result = await context.verifyPermission("ohos.permission.GET_NETWORK_INFO", thisProcessInfo.pid, thisProcessInfo.uid) + console.debug("======result======>:" + JSON.stringify(result)); + expect(result).assertEqual(0); + done() + }) + it('AppPermission_0300', 0, async function (done) { + console.info('=====================AppPermission_0300==================<'); + var processInfoArray = await abilityManager.getAllRunningProcesses(); + console.debug("======processInfoArray======>:" + JSON.stringify(processInfoArray)); + var thisProcessInfo = processInfoArray[0]; + for(let i=0; i:" + JSON.stringify(thisProcessInfo)); + var context = await featureAbility.getContext(); + await context.verifyPermission("ohos.permission.GET_NETWORK_INFO", thisProcessInfo.pid, thisProcessInfo.uid, + (err, data) => { + expect(err.code).assertEqual(0) + expect(data).assertEqual(0) + done() + }) + done() + }) + it('AppPermission_0400', 0, async function (done) { + console.info('=====================AppPermission_0400==================<'); + var processInfoArray = await abilityManager.getAllRunningProcesses(); + console.debug("======processInfoArray======>:" + JSON.stringify(processInfoArray)); + var thisProcessInfo = processInfoArray[0]; + for(let i=0; i:" + JSON.stringify(thisProcessInfo)); + var context = await featureAbility.getContext(); + var result = await context.verifyPermission("com.amsst.permission.SYSPERMISSION", thisProcessInfo.pid, thisProcessInfo.uid) + console.debug("======result======>:" + JSON.stringify(result)); + expect(result).assertEqual(0); + done() + }) + it('AppPermission_0500', 0, async function (done) { + console.info('=====================AppPermission_0500==================<'); + var processInfoArray = await abilityManager.getAllRunningProcesses(); + console.debug("======processInfoArray======>:" + JSON.stringify(processInfoArray)); + var thisProcessInfo = processInfoArray[0]; + for(let i=0; i:" + JSON.stringify(thisProcessInfo)); + var context = await featureAbility.getContext(); + var result = await context.verifySelfPermission("com.amsst.permission.SYSPERMISSION") + console.debug("======com.amsst.permission.SYSPERMISSION:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.GET_NETWORK_INFO") + console.debug("======ohos.permission.GET_NETWORK_INFO======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.GET_WIFI_INFO") + console.debug("======ohos.permission.GET_WIFI_INFO:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.USE_BLUETOOTH") + console.debug("======ohos.permission.USE_BLUETOOTH:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.DISCOVER_BLUETOOTH") + console.debug("======ohos.permission.DISCOVER_BLUETOOTH:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.SET_NETWORK_INFO") + console.debug("======ohos.permission.SET_NETWORK_INFO:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.SET_WIFI_INFO") + console.debug("======ohos.permission.SET_WIFI_INFO:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.SPREAD_STATUS_BAR") + console.debug("======ohos.permission.SPREAD_STATUS_BAR:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.INTERNET") + console.debug("======ohos.permission.INTERNET:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.MODIFY_AUDIO_SETTINGS") + console.debug("======ohos.permission.MODIFY_AUDIO_SETTINGS:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.RECEIVER_STARTUP_COMPLETED") + console.debug("======ohos.permission.RECEIVER_STARTUP_COMPLETED:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.RUNNING_LOCK") + console.debug("======ohos.permission.RUNNING_LOCK:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.ACCESS_BIOMETRIC") + console.debug("======ohos.permission.ACCESS_BIOMETRIC:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.RCV_NFC_TRANSACTION_EVENT") + console.debug("======ohos.permission.RCV_NFC_TRANSACTION_EVENT:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.COMMONEVENT_STICKY") + console.debug("======ohos.permission.COMMONEVENT_STICKY:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.SYSTEM_FLOAT_WINDOW") + console.debug("======ohos.permission.SYSTEM_FLOAT_WINDOW:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.VIBRATE") + console.debug("======ohos.permission.VIBRATE:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.USE_TRUSTCIRCLE_MANAGER") + console.debug("======ohos.permission.USE_TRUSTCIRCLE_MANAGER:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.USE_WHOLE_SCREEN") + console.debug("======ohos.permission.USE_WHOLE_SCREEN:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.SET_WALLPAPER") + console.debug("======ohos.permission.SET_WALLPAPER:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.SET_WALLPAPER_DIMENSION") + console.debug("======ohos.permission.SET_WALLPAPER_DIMENSION:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.REARRANGE_MISSIONS") + console.debug("======ohos.permission.REARRANGE_MISSIONS:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.CLEAN_BACKGROUND_PROCESSES") + console.debug("======ohos.permission.CLEAN_BACKGROUND_PROCESSES:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.KEEP_BACKGROUND_RUNNING") + console.debug("======ohos.permission.KEEP_BACKGROUND_RUNNING:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.GET_BUNDLE_INFO") + console.debug("======ohos.permission.GET_BUNDLE_INFO:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.ACCELEROMETER") + console.debug("======ohos.permission.ACCELEROMETER:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.GYROSCOPE") + console.debug("======ohos.permission.GYROSCOPE:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.MULTIMODAL_INTERACTIVE") + console.debug("======ohos.permission.MULTIMODAL_INTERACTIVE:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.radio.ACCESS_FM_AM") + console.debug("======ohos.permission.radio.ACCESS_FM_AM:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.NFC_TAG") + console.debug("======ohos.permission.NFC_TAG:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.NFC_CARD_EMULATION") + console.debug("======ohos.permission.NFC_CARD_EMULATION:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.DISTRIBUTED_DEVICE_STATE_CHANGE") + console.debug("======ohos.permission.DISTRIBUTED_DEVICE_STATE_CHANGE:result======>:" + JSON.stringify(result)); + result = await context.verifySelfPermission("ohos.permission.GET_DISTRIBUTED_DEVICE_INFO") + console.debug("======ohos.permission.GET_DISTRIBUTED_DEVICE_INFO:result======>:" + JSON.stringify(result)); + expect(result).assertEqual(0); + done() + }) + it('AppPermission_5000', 0, async function (done) { + console.info('=====================AppPermission_5000==================<'); + var dataInfo = await bundle.getBundleInfo('com.amsst.amsjsstmain',1); + var context = await featureAbility.getContext(); + await context.requestPermissionsFromUser(["ohos.permission.CAMERA"], 580).then( + data => console.log("then : " + data)) + .catch(error => console.log("catch : " + error)); + await context.verifyPermission("ohos.permission.CAMERA",0,dataInfo.uid, + (err, data) => { + expect(err.code).assertEqual(0); + expect(data).assertEqual(0); + done(); + }); + done(); + }) +}) \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/test/List.test.js b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/js/test/List.test.js new file mode 100644 index 0000000000000000000000000000000000000000..e34bc01075e5af97f1764f9e75f36fe9b7c8ea5b --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/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('./AmsJsunit.test.js') \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bba36b83508361433307c42ae3c17d990424f0d4 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "app_name", + "value": "AmsStMain" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + }, + { + "name": "permreason_camera", + "value": "请求使用摄像头" + }, + { + "name": "permreason_sys", + "value": "自定义system_grand权限" + }, + { + "name": "permreason_getnetworkinfo", + "value": "请求访问网络信息" + }, + { + "name": "secondability_description", + "value": "JS_Empty Ability" + }, + { + "name": "entry_SecondAbility", + "value": "entry_SecondAbility" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStMain/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/verifypermission/AmsJsStMain/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/BUILD.gn b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..04df362ab0d2bcd38f8d31e35f81f233f9a9e7ce --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/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("AmsJsStSubPermission") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":hjs_demo_js_assets", + ":hjs_demo_resources", + ] + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "AmsJsStSubPermission" +} +ohos_js_assets("hjs_demo_js_assets") { + source_dir = "./entry/src/main/js/default" +} +ohos_resources("hjs_demo_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/Test.json b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..26909f2889de98a479f076f87725fed805c7a343 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/Test.json @@ -0,0 +1,4 @@ +{ + "description": "Configuration for hjunit demo Tests", +} + diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/config.json b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..6fca0db245a0cd5309f6f592f10f020470fa2d53 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/config.json @@ -0,0 +1,82 @@ +{ + "app": { + "bundleName": "com.amsst.amsjsstsubpermission", + "vendor": "amsst", + "version": { + "code": 1, + "name": "1.0" + }, + "apiVersion": { + "compatible": 4, + "target": 5, + "releaseType": "Beta1" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.amsst.amsjsstsubpermission", + "name": ".MyApplication", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry" + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "name": "com.amsst.amsjsstsubpermission.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": true + } + } + ], + "reqPermissions": [ + { + "name": "com.amsst.permission.SYSPERMISSION", + "reason": "$string:permreason_sys", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }, + { + "name": "ohos.permission.GET_NETWORK_INFO", + "reason": "$string:permreason_getnetworkinfo", + "usedScene": { + "ability": [ + "com.amsst.amsjsstmain.MainAbility" + ], + "when": "always" + } + }] + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/app.js b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/app.js new file mode 100644 index 0000000000000000000000000000000000000000..a66a245b33514363f81b281b0471ca426479e717 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/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/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/i18n/en-US.json b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/i18n/en-US.json new file mode 100644 index 0000000000000000000000000000000000000000..e63c70d978a3a53be988388c87182f81785e170c --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/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/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/i18n/zh-CN.json b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/i18n/zh-CN.json new file mode 100644 index 0000000000000000000000000000000000000000..de6ee5748322f44942c1b003319d8e66c837675f --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/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/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.css b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.css new file mode 100644 index 0000000000000000000000000000000000000000..4ddd1478116ffaa5d077e0de3aaf23e1c4fdb123 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.css @@ -0,0 +1,51 @@ +.container { + flex-direction: column; + justify-content: center; + align-items: center; +} + +.title { + font-size: 40px; + color: #000000; + opacity: 0.9; +} + +@media screen and (device-type: tablet) and (orientation: landscape) { + .title { + font-size: 100px; + } +} + +@media screen and (device-type: wearable) { + .title { + font-size: 28px; + color: #FFFFFF; + } +} + +@media screen and (device-type: tv) { + .container { + background-image: url("../../common/images/Wallpaper.png"); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + } + + .title { + font-size: 100px; + color: #FFFFFF; + } +} + +@media screen and (device-type: phone) and (orientation: landscape) { + .title { + font-size: 60px; + } +} + +.log { + font-size: 20px; + text-align: center; + width: 100%; + height: 400px; +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.hml b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.hml new file mode 100644 index 0000000000000000000000000000000000000000..bbb6ec46657c664c146cac49106f3e667e350526 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.hml @@ -0,0 +1,16 @@ +
+ {{title}} +
+ +
+
+ + + + + + +
+
diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.js b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.js new file mode 100644 index 0000000000000000000000000000000000000000..f4cebca32cebd1e3050f6286a303a8fc7f1ee385 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/index.js @@ -0,0 +1,68 @@ +/* +* Copyright (c) 2021 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, + +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +import file from '@system.file' +import app from '@system.app' +import router from '@system.router'; +import featureAbility from '@ohos.ability.featureability' + +import { Core, ExpectExtend, ReportExtend } from 'deccjsunit/index' + +export default { + currentCase: "", + data: { + title: "AbilityA1", + logmessage: "this is log message", + testcase: [ + "AppPermission_1300", + "AppPermission_1400", + "AppPermission_1500", + "AppPermission_1600", + "AppPermission_1700", + "AppPermission_1800", + ], + }, + onInit() { + this.title = "AbilityA1"; + this.logmessage = "this is log message"; + + }, + onShow() { + }, + onReady() { + console.info('onReady finish') + }, + onBackPress() { + }, + async stopAbility() { + console.info('===========AmsJsStSubPermission close===========<') + await featureAbility.terminateAbility(); + await app.killProcessesByBundleName(); + }, + runCase(caseName) { + console.debug("======runCase======>:" + JSON.stringify(caseName)) + this.logmessage += caseName + "\n" + console.debug("======runallcase======<:") + let { runAllCase } = require('./permissioncase.js') + runAllCase(caseName, this) + + }, + CaseChange(newValue) { + let { GetCaseInfo } = require('./permissioncase.js') + this.logmessage = newValue.value + this.logmessage += GetCaseInfo(newValue.value) + this.currentCase = newValue.value + }, +} diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/permissioncase.js b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/permissioncase.js new file mode 100644 index 0000000000000000000000000000000000000000..6fce68d48bf81f225d696d606249f5aa49c65487 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/js/default/pages/index/permissioncase.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 bundle from '@ohos.bundle' +import featureAbility from '@ohos.ability.featureability' +import abilityManager from '@ohos.app.abilitymanager' + +export function runAllCase(caseName, obj) { + console.debug("======runAllCase1======>:" + JSON.stringify(caseName)) + console.debug("======runAllCase2======>:" + JSON.stringify(allCase)) + allCase[caseName].func(obj) +} + +export function GetCaseInfo(caseName) { + console.debug("======GetCaseInfo======>:" + JSON.stringify(caseName)) + return allCase[caseName].info; +} + +var allCase = { + AppPermission_1300: { + func: AppPermission_1300, + info: "Verify that a system_grand system`s permission(ohos.permission.GET_NETWORK_INFO) is automatically requested during installation." + }, + AppPermission_1400: { + func: AppPermission_1400, + info: "" + }, + AppPermission_1500: { + func: AppPermission_1500, + info: "" + }, + AppPermission_1600: { + func: AppPermission_1600, + info: "" + }, + AppPermission_1700: { + func: AppPermission_1700, + info: "" + }, + AppPermission_1800: { + func: AppPermission_1800, + info: "" + }, + +} + +async function AppPermission_1300(thisobj) { + var thisFunctionName = AppPermission_1300.name + thisobj.logmessage = "" + thisobj.logmessage += "run test case " + thisFunctionName + "\n" + + var context = await featureAbility.getContext() + await context.verifyPermission("ohos.permission.GET_NETWORK_INFO", + (err, data) => { + console.debug("======verifyCallingPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n" + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n" + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n" + } + }) +} + +async function AppPermission_1400(thisobj) { + var thisFunctionName = AppPermission_1400.name + thisobj.logmessage = "" + thisobj.logmessage += "run test case " + thisFunctionName + "\n" + + var context = await featureAbility.getContext() + console.log("<======verfyPermissiom pass=====>") + var result = await context.verifyPermission("ohos.permission.GET_NETWORK_INFO") + console.debug("======verifyCallingPermission:result======>:" + JSON.stringify(result)) + thisobj.logmessage += JSON.stringify(result) + "\n" + if (result == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n" + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n" + } +} + +async function AppPermission_1500(thisobj) { + var thisFunctionName = AppPermission_1500.name + thisobj.logmessage = "" + thisobj.logmessage += "run test case " + thisFunctionName + "\n" + + var context = await featureAbility.getContext() + await context.verifyPermission("ohos.permission.CAMERA", + (err, data) => { + console.debug("======verifyCallingPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n" + if (data == -1) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n" + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n" + } + }) +} + +async function AppPermission_1600(thisobj) { + var thisFunctionName = AppPermission_1600.name + thisobj.logmessage = "" + thisobj.logmessage += "run test case " + thisFunctionName + "\n" + + var context = await featureAbility.getContext() + var result = await context.verifyPermission("ohos.permission.CAMERA") + console.debug("======verifyCallingPermission:result======>:" + JSON.stringify(result)) + thisobj.logmessage += JSON.stringify(result) + "\n" + if (result == -1) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n" + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n" + } +} + +async function AppPermission_1700(thisobj) { + var thisFunctionName = AppPermission_1700.name + thisobj.logmessage = "" + thisobj.logmessage += "run test case " + thisFunctionName + "\n" + + var context = await featureAbility.getContext() + await context.verifyPermission("com.amsst.permission.SYSPERMISSION", + (err, data) => { + console.debug("======verifyCallingPermission:data======>:" + JSON.stringify(data)); + thisobj.logmessage += JSON.stringify(data) + "\n" + if (data == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n" + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n" + } + }) +} + +async function AppPermission_1800(thisobj) { + var thisFunctionName = AppPermission_1800.name + thisobj.logmessage = "" + thisobj.logmessage += "run test case " + thisFunctionName + "\n" + + var context = await featureAbility.getContext() + var result = await context.verifyPermission("com.amsst.permission.SYSPERMISSION") + console.debug("======verifyCallingPermission:result======>:" + JSON.stringify(result)) + thisobj.logmessage += JSON.stringify(result) + "\n" + if (result == 0) { + thisobj.logmessage += "case " + thisFunctionName + " successed\n" + } + else { + thisobj.logmessage += "case " + thisFunctionName + " failed\n" + } +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/resources/base/element/string.json b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..bf48dbf23fb4a7f0d2a824be647f29f5f6130201 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "app_name", + "value": "Permission" + }, + { + "name": "mainability_description", + "value": "JS_Phone_Empty Feature Ability" + } + ] +} \ No newline at end of file diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/resources/base/media/icon.png b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/entry/src/main/resources/base/media/icon.png differ diff --git a/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/signature/openharmony_sx.p7b b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/aafwk/aafwk_standard/verifypermission/AmsJsStSubPermission/signature/openharmony_sx.p7b differ diff --git a/aafwk/aafwk_standard/verifypermission/BUILD.gn b/aafwk/aafwk_standard/verifypermission/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..3887cdcf0b811188103d1957ed62222a7502a492 --- /dev/null +++ b/aafwk/aafwk_standard/verifypermission/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("verifypermission") { + testonly = true + if (is_standard_system) { + deps = [ + "AmsJsStMain:AmsJsStMain", + "AmsJsStSubPermission:AmsJsStSubPermission", + ] + } +} diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/ActsBmsKitTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/ActsBmsKitTest.test.js index c3c5e934955340e2f16044ce67c084abc125f137..00f7704f84853ab88d6549405cbf74ed03a7c8c9 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/ActsBmsKitTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmskittest/entry/src/main/js/test/ActsBmsKitTest.test.js @@ -63,6 +63,7 @@ describe('ActsBmsKitTest', function () { } ) }) + /* * @tc.number: ActsBmsKit_getAllShortcutInfo_0100 * @tc.name: Pressure test interface getAllShortcutInfo by promise diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js index 851ba7342bf9c6f39c7a38fca63de771bfb8cb41..ee7b51733e0c26b007384d464244f25fa0dd5d56 100644 --- a/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbmsmoduleusagerecordtest/entry/src/main/js/test/ActsBmsModuleUsageRecordTest.test.js @@ -104,6 +104,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { } }); }) + /* * @tc.number: bms_getModuleUsageRecordTest_0100 * @tc.name: getModuleUsageRecord(maxNum) @@ -414,6 +415,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { }); }); }) + /* * @tc.number: bms_getModuleUsageRecordTest_1300 * @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback>) @@ -483,6 +485,7 @@ describe('ActsBmsModuleUsageRecordTest', function () { }); }); }) + /* * @tc.number: bms_getModuleUsageRecordTest_1400 * @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback>) @@ -551,10 +554,10 @@ describe('ActsBmsModuleUsageRecordTest', function () { }) /* - * @tc.number: bms_getModuleUsageRecordTest_1500 - * @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback>) - * @tc.desc: test getModuleUsageRecord with the critical value - */ + * @tc.number: bms_getModuleUsageRecordTest_1500 + * @tc.name: getModuleUsageRecord(maxNum, callback: AsyncCallback>) + * @tc.desc: test getModuleUsageRecord with the critical value + */ it('bms_getModuleUsageRecordTest_1500', 0, async function (done) { console.debug('=====================bms_getModuleUsageRecordTest_1500=================='); await bundle.getModuleUsageRecords(1000, (err, records) => { diff --git a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageruninstall/entry/src/main/js/test/ExampleJsunit.test.js b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageruninstall/entry/src/main/js/test/ExampleJsunit.test.js index 5eb33166f9e999f28b83dca6e3b61b39701482cf..f4f1e6236d19e93f5e9a168afc65b1fd413637b2 100755 --- a/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageruninstall/entry/src/main/js/test/ExampleJsunit.test.js +++ b/appexecfwk/bundle_standard/bundlemanager/actsbundlemanageruninstall/entry/src/main/js/test/ExampleJsunit.test.js @@ -305,7 +305,7 @@ describe('ActsBundleManagerTest', function () { done(); } let installData = await demo.getBundleInstaller(); - installData.install([PATH + BMSJSTEST1], { + installData.install([PATH + BMSJSTEST8], { param: { userId: 0, installFlag: 1,