diff --git a/customization/BUILD.gn b/customization/BUILD.gn deleted file mode 100755 index 16f0c0c12e242e65956918230fb1f938f8373799..0000000000000000000000000000000000000000 --- a/customization/BUILD.gn +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos_var.gni") - -group("edm_test_grop") { - testonly = true - if (is_standard_system) { - deps = [ - "TestExtensionAbility_001:ExtensionZeroTest", - "edm_xts_stage:ActsEdmTest", - ] - } -} - -group("customization") { - testonly = true - if (is_standard_system) { - deps = [ ":edm_test_grop" ] - } -} diff --git a/customization/TestExtensionAbility_001/AppScope/app.json b/customization/TestExtensionAbility_001/AppScope/app.json deleted file mode 100644 index dca2f75e903360471499cee66e51cf04c45b9e98..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.extensionzerotest", - "vendor": "huawei", - "versionCode": 1000000, - "versionName": "1.0.0", - "debug": false, - "icon" : "$media:icon", - "label" : "$string:app_name", - "description" : "$string:description_application", - "distributedNotificationEnabled": true, - "keepAlive" : true, - "singleUser": true, - "minAPIVersion": 8, - "targetAPIVersion": 8, - "car": { - "apiCompatibleVersion": 8, - "singleUser": false - } - } -} \ No newline at end of file diff --git a/customization/TestExtensionAbility_001/AppScope/resources/base/element/string.json b/customization/TestExtensionAbility_001/AppScope/resources/base/element/string.json deleted file mode 100644 index be09cccde1bc7369ef47a5cd45d2b06884c88602..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "ohosProject" - } - ] -} diff --git a/customization/TestExtensionAbility_001/AppScope/resources/base/media/app_icon.png b/customization/TestExtensionAbility_001/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/customization/TestExtensionAbility_001/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/customization/TestExtensionAbility_001/BUILD.gn b/customization/TestExtensionAbility_001/BUILD.gn deleted file mode 100644 index 468dd66ea400cb150dcb22ff015e45dbcf36236e..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) 2022 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//test/xts/tools/build/suite.gni") - -ohos_hap_assist_suite("ExtensionZeroTest") { - hap_profile = "entry/src/main/module.json" - js_build_mode = "debug" - deps = [ - ":extensionZeroTest_js_assets", - ":extensionZeroTest_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ExtensionZeroTest" - subsystem_name = "customization" - part_name = "enterprise_device_management" -} - -ohos_app_scope("extensionZeroTest_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("extensionZeroTest_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("extensionZeroTest_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":extensionZeroTest_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/customization/TestExtensionAbility_001/entry/src/main/ets/Application/AbilityStage.ts b/customization/TestExtensionAbility_001/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index a51e07cc17f5fde64cd0b85de4ca6b5c6c63c2a7..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import AbilityStage from "@ohos.application.AbilityStage" - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("MyAbilityStage onCreate") - globalThis.stageContext = this.context; - console.log("MyAbilityStage finish") - } -} \ No newline at end of file diff --git a/customization/TestExtensionAbility_001/entry/src/main/ets/EnterpriseAdminAbility/EnterpriseAdminAbility.ts b/customization/TestExtensionAbility_001/entry/src/main/ets/EnterpriseAdminAbility/EnterpriseAdminAbility.ts deleted file mode 100644 index 07426f68d4a25f3d67e3eb27d54931244e8eef57..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/entry/src/main/ets/EnterpriseAdminAbility/EnterpriseAdminAbility.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import EnterpriseAdminExtensionAbility from '@ohos.EnterpriseAdminExtensionAbility' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" - -export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility { - onAdminEnabled() { - console.log('EnterpriseAdminExtensionAbility onAdminEnabled'); - } - onAdminDisabled(){ - console.log('EnterpriseAdminExtensionAbility onAdminDisabled'); - } -} \ No newline at end of file diff --git a/customization/TestExtensionAbility_001/entry/src/main/ets/MainAbility/MainAbility.ts b/customization/TestExtensionAbility_001/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index 56d78ede1a7d850b8f84f17745fb6228fba64f89..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import Ability from '@ohos.application.Ability' - -export default class MainAbility extends Ability { - onCreate(want, launchParam) { - // Ability is creating, initialize resources for this ability - console.log("MainAbility onCreate"); - globalThis.abilityWant = want; - globalThis.abilityContext = this.context - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("MainAbility onDestroy"); - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("MainAbility onWindowStageCreate"); - windowStage.setUIContent(this.context, "pages/index/index", null); - } - - onWindowStageDestroy() { - // Main window is destroyed, release UI related resources - console.log("MainAbility onWindowStageDestroy"); - } - - onForeground() { - // Ability has brought to foreground - console.log("MainAbility onForeground"); - } - - onBackground() { - // Ability has back to background - console.log("MainAbility onBackground"); - } -}; diff --git a/customization/TestExtensionAbility_001/entry/src/main/ets/pages/index/index.ets b/customization/TestExtensionAbility_001/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index b0958581f15c3f9b21316eec8e58ecf2ec9df6d2..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import file from '@system.file'; -import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index" -@Entry -@Component -struct Index { - aboutToAppear() { - console.info("start run testcase!!!!") - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - const reportExtend = new ReportExtend(file) - - core.addService('report', reportExtend) - core.init() - core.subscribeEvent('task', reportExtend) - console.info("subscribeEvent run !!!!") - const configService = core.getDefaultService('config') - console.info('parameters---->' + JSON.stringify(globalThis.abilityWant.parameters)) - configService.setConfig(globalThis.abilityWant.parameters) - core.execute() - } - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('MainAbility') - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/customization/TestExtensionAbility_001/entry/src/main/ets/pages/second/second.ets b/customization/TestExtensionAbility_001/entry/src/main/ets/pages/second/second.ets deleted file mode 100644 index 2c768edb999b1b54fef3268922817734b1f1c954..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/entry/src/main/ets/pages/second/second.ets +++ /dev/null @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2022 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -import router from '@system.router'; - -@Entry -@Component -struct Second { - private content: string = "Second Page" - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text(`${this.content}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('back to index') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - router.back() - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/customization/TestExtensionAbility_001/entry/src/main/module.json b/customization/TestExtensionAbility_001/entry/src/main/module.json deleted file mode 100644 index eba9c2393e3d40cc92dd7975086814b60fe9dbfb..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/entry/src/main/module.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "tablet", - "default", - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [ - { - "name": "com.example.extensionzerotest.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "skills": [ - { - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - } - ] - } - ], - "extensionAbilities": [ - { - "srcEntrance": "./ets/EnterpriseAdminAbility/EnterpriseAdminAbility.ts", - "name": "com.example.extensionzerotest.EnterpriseAdminAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "enterpriseAdmin", - "visible": true - } - ], - "requestPermissions": [ - { - "name":"ohos.permission.GET_BUNDLE_INFO_PRIVILEGED", - "reason":"need use ohos.permission.GET_BUNDLE_INFO_PRIVILEGED" - }, - { - "name":"ohos.permission.GET_BUNDLE_INFO", - "reason":"need use ohos.permission.GET_BUNDLE_INFO" - }, - { - "name":"ohos.permission.CHANGE_ABILITY_ENABLED_STATE", - "reason":"need use ohos.permission.CHANGE_ABILITY_ENABLED_STATE" - }, - { - "name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS", - "reason": "ceshi" - }, - { - "name": "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS_EXTENSION", - "reason": "ceshi" - }, - { - "name":"ohos.permission.REMOVE_CACHE_FILES", - "reason":"need use ohos.permission.REMOVE_CACHE_FILES" - }, - { - "name":"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", - "reason":"need use ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS" - }, - { - "name":"ohos.permission.LISTEN_BUNDLE_CHANGE", - "reason":"need use ohos.permission.LISTEN_BUNDLE_CHANGE" - }, - { - "name":"ohos.permission.INSTALL_BUNDLE", - "reason":"need use ohos.permission.INSTALL_BUNDLE" - }, - { - "name":"ohos.permission.MANAGE_MISSIONS", - "reason":"need use ohos.permission.MANAGE_MISSIONS" - }, - { - "name":"ohos.permission.GET_RUNNING_INFO", - "reason":"need use ohos.permission.GET_RUNNING_INFO" - }, - { - "name":"ohos.permission.CLEAN_BACKGROUND_PROCESSES", - "reason":"need use ohos.permission.CLEAN_BACKGROUND_PROCESSES" - }, - { - "name":"ohos.permission.CLEAN_APPLICATION_DATA", - "reason":"need use ohos.permission.CLEAN_APPLICATION_DATA" - } - ] - } -} diff --git a/customization/TestExtensionAbility_001/entry/src/main/resources/base/element/string.json b/customization/TestExtensionAbility_001/entry/src/main/resources/base/element/string.json deleted file mode 100644 index d75325f3cf0a50c1dfe4dbc5162c8737276c3dd9..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "string": [ - { - "name": "phone_entry_dsc", - "value": "i am an entry for phone" - }, - { - "name": "phone_entry_main", - "value": "the phone entry ability" - }, - { - "name": "entry_label", - "value": "ActsContextTest" - }, - { - "name": "form_description", - "value": "my form" - }, - { - "name": "serviceability_description", - "value": "my whether" - }, - { - "name": "description_application", - "value": "demo for test" - }, - { - "name": "app_name", - "value": "Demo" - } - ] -} \ No newline at end of file diff --git a/customization/TestExtensionAbility_001/entry/src/main/resources/base/media/icon.png b/customization/TestExtensionAbility_001/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/customization/TestExtensionAbility_001/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/customization/TestExtensionAbility_001/entry/src/main/resources/base/profile/main_pages.json b/customization/TestExtensionAbility_001/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 6898b31d2085f478ee1ed9d933a5910cbf901d92..0000000000000000000000000000000000000000 --- a/customization/TestExtensionAbility_001/entry/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "src": [ - "pages/index/index", - "pages/second/second" - ] -} \ No newline at end of file diff --git a/customization/TestExtensionAbility_001/signature/openharmony_sx.p7b b/customization/TestExtensionAbility_001/signature/openharmony_sx.p7b deleted file mode 100644 index cc53179a48f88f20acc379c138a001e9a15838f6..0000000000000000000000000000000000000000 Binary files a/customization/TestExtensionAbility_001/signature/openharmony_sx.p7b and /dev/null differ diff --git a/customization/edm_xts_stage/AppScope/app.json b/customization/edm_xts_stage/AppScope/app.json deleted file mode 100644 index 2c223fed485d736ab9906abf778f3d48eeb6c7cf..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/AppScope/app.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "app": { - "bundleName": "com.example.myapplication", - "vendor": "huawei", - "versionCode": 1000000, - "versionName": "1.0.0", - "debug": false, - "icon": "$media:icon", - "label": "$string:app_name", - "description": "$string:description_application", - "distributedNotificationEnabled": true, - "keepAlive": true, - "singleUser": true, - "minAPIVersion": 9, - "targetAPIVersion": 9, - "car": { - "apiCompatibleVersion": 9, - "singleUser": false - } - } -} \ No newline at end of file diff --git a/customization/edm_xts_stage/AppScope/resources/base/element/string.json b/customization/edm_xts_stage/AppScope/resources/base/element/string.json deleted file mode 100644 index ee69f9a861d9dc269ed6638735d52674583498e1..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/AppScope/resources/base/element/string.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "string":[ - { - "name":"app_name", - "value":"ohosProject" - } - ] -} \ No newline at end of file diff --git a/customization/edm_xts_stage/AppScope/resources/base/media/app_icon.png b/customization/edm_xts_stage/AppScope/resources/base/media/app_icon.png deleted file mode 100644 index 474a55588fd7216113dd42073aadf254d4dba023..0000000000000000000000000000000000000000 Binary files a/customization/edm_xts_stage/AppScope/resources/base/media/app_icon.png and /dev/null differ diff --git a/customization/edm_xts_stage/BUILD.gn b/customization/edm_xts_stage/BUILD.gn deleted file mode 100644 index 6611cff4e8d55f998fac2d5bd86087f36525ee97..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/BUILD.gn +++ /dev/null @@ -1,43 +0,0 @@ -# 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("ActsEdmTest") { - hap_profile = "entry/src/main/module.json" - js_build_mode = "debug" - deps = [ - ":edm_js_assets", - ":edm_resources", - ] - ets2abc = true - certificate_profile = "signature/openharmony_sx.p7b" - hap_name = "ActsEdmTest" - subsystem_name = "customization" - part_name = "enterprise_device_management" -} - -ohos_app_scope("edm_app_profile") { - app_profile = "AppScope/app.json" - sources = [ "AppScope/resources" ] -} - -ohos_js_assets("edm_js_assets") { - source_dir = "entry/src/main/ets" -} - -ohos_resources("edm_resources") { - sources = [ "entry/src/main/resources" ] - deps = [ ":edm_app_profile" ] - hap_profile = "entry/src/main/module.json" -} diff --git a/customization/edm_xts_stage/Test.json b/customization/edm_xts_stage/Test.json deleted file mode 100644 index bf9adadfadb2eac1636dd053ec416af422bdf843..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/Test.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "OHJSUnitTest", - "test-timeout": "180000", - "bundle-name": "com.example.myapplication", - "module-name": "phone", - "shell-timeout": "600000" - }, - "kits": [ - { - "type": "ShellKit", - "run-command": [ - "acm create -n edmuser -t normal" - ], - "teardown-command": [ - "acm delete -i 101" - ] - }, - { - "test-file-name": [ - "ActsEdmTest.hap", - "ExtensionZeroTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/Application/AbilityStage.ts b/customization/edm_xts_stage/entry/src/main/ets/Application/AbilityStage.ts deleted file mode 100644 index e3fdadfebeeeb676df2ce8f78f4b59e26fae9cf0..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/Application/AbilityStage.ts +++ /dev/null @@ -1,9 +0,0 @@ -import AbilityStage from "@ohos.application.AbilityStage" - -export default class MyAbilityStage extends AbilityStage { - onCreate() { - console.log("[Demo] MyAbilityStage onCreate") - globalThis.stageOnCreateRun = 1; - globalThis.stageContext = this.context; - } -} diff --git a/customization/edm_xts_stage/entry/src/main/ets/EnterpriseAdminAbility/EnterpriseAdminAbility.ts b/customization/edm_xts_stage/entry/src/main/ets/EnterpriseAdminAbility/EnterpriseAdminAbility.ts deleted file mode 100644 index 07426f68d4a25f3d67e3eb27d54931244e8eef57..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/EnterpriseAdminAbility/EnterpriseAdminAbility.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import EnterpriseAdminExtensionAbility from '@ohos.EnterpriseAdminExtensionAbility' -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index" - -export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility { - onAdminEnabled() { - console.log('EnterpriseAdminExtensionAbility onAdminEnabled'); - } - onAdminDisabled(){ - console.log('EnterpriseAdminExtensionAbility onAdminDisabled'); - } -} \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/MainAbility/MainAbility.ts b/customization/edm_xts_stage/entry/src/main/ets/MainAbility/MainAbility.ts deleted file mode 100644 index 8b12c6e3cc0cd9d0bc26d566cf7435e68dc0f581..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/MainAbility/MainAbility.ts +++ /dev/null @@ -1,37 +0,0 @@ -import Ability from '@ohos.application.Ability' - -export default class MainAbility extends Ability { - onCreate(want,launchParam){ - // Ability is creating, initialize resources for this ability - console.log("[Demo] MainAbility onCreate") - globalThis.abilityWant = want; - } - - onDestroy() { - // Ability is destroying, release resources for this ability - console.log("[Demo] MainAbility onDestroy") - } - - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] MainAbility onWindowStageCreate windowStage="+ windowStage) - globalThis.windowStage = windowStage - globalThis.abilityContext = this.context - windowStage.setUIContent(this.context, "pages/index/index", null) - } - - onWindowStageDestroy() { - //Main window is destroyed, release UI related resources - console.log("[Demo] MainAbility onWindowStageDestroy") - } - - onForeground() { - // Ability has brought to foreground - console.log("[Demo] MainAbility onForeground") - } - - onBackground() { - // Ability has back to background - console.log("[Demo] MainAbility onBackground") - } -}; \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/customization/edm_xts_stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts deleted file mode 100644 index adcea6b8e39cffa4d1dc9942a0f712203782942b..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2022 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -import TestRunner from '@ohos.application.testRunner' -import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' - -var abilityDelegator = undefined -var abilityDelegatorArguments = undefined - -function translateParamsToString(parameters) { - const keySet = new Set([ - '-s class', '-s notClass', '-s suite', '-s it', - '-s level', '-s testType', '-s size', '-s timeout' - ]) - let targetParams = ''; - for (const key in parameters) { - if (keySet.has(key)) { - targetParams = `${targetParams} ${key} ${parameters[key]}` - } - } - return targetParams.trim() -} - -async function onAbilityCreateCallback() { - console.log("onAbilityCreateCallback"); -} - -async function addAbilityMonitorCallback(err: any) { - console.info("addAbilityMonitorCallback : " + JSON.stringify(err)) -} - -export default class OpenHarmonyTestRunner implements TestRunner { - constructor() { - } - - onPrepare() { - console.info("OpenHarmonyTestRunner OnPrepare ") - } - - async onRun() { - console.log('OpenHarmonyTestRunner onRun run') - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var MainAbilityName = abilityDelegatorArguments.bundleName + '.MainAbility' - let lMonitor = { - abilityName: MainAbilityName, - onAbilityCreate: onAbilityCreateCallback, - }; - abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) - var cmd = 'aa start -d 0 -a com.example.myapplication.MainAbility' + ' -b ' + abilityDelegatorArguments.bundleName - cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) - console.info('cmd : '+cmd) - abilityDelegator.executeShellCommand(cmd, - (err: any, d: any) => { - console.info('executeShellCommand : err : ' + JSON.stringify(err)); - console.info('executeShellCommand : data : ' + d.stdResult); - console.info('executeShellCommand : data : ' + d.exitCode); - }) - console.info('OpenHarmonyTestRunner onRun end') - } -}; \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/pages/index/index.ets b/customization/edm_xts_stage/entry/src/main/ets/pages/index/index.ets deleted file mode 100644 index 4c26b68c0f0469281c69f04dcec62a5083f40142..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/pages/index/index.ets +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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 AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' -import { Hypium } from '@ohos/hypium' -import testsuite from "../../test/List.test.ets" - -@Entry -@Component -struct Index { - - aboutToAppear(){ - var abilityDelegator: any - abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() - var abilityDelegatorArguments: any - abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() - console.info('start run testcase!!!!') - Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) - } - - build() { - Flex({ direction:FlexDirection.Column, alignItems:ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello World') - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('next page') - .fontSize(25) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/pages/second/second.ets b/customization/edm_xts_stage/entry/src/main/ets/pages/second/second.ets deleted file mode 100644 index 1c1c727ff11ecc97909f482c35268db87ae23bb4..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/pages/second/second.ets +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import router from '@system.router'; - -@Entry -@Component -struct Second { - private content: string = "Second Page" - - build() { - Flex({ direction: FlexDirection.Column,alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text(`${this.content}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - Button() { - Text('back to index') - .fontSize(20) - .fontWeight(FontWeight.Bold) - }.type(ButtonType.Capsule) - .margin({ - top: 20 - }) - .backgroundColor('#0D9FFB') - .onClick(() => { - router.back() - }) - } - .width('100%') - .height('100%') - } -} \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/List.test.ets b/customization/edm_xts_stage/entry/src/main/ets/test/List.test.ets deleted file mode 100644 index d5a2534102f373727e8f85a495bbecec2c2900db..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/test/List.test.ets +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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 edmPromiseTest from './edmPromise.test.ets' -import edmCallbackTest from './edmCallback.test.ets' - -export default function testsuite() { - edmCallbackTest() - edmPromiseTest() -} \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/commom.ets b/customization/edm_xts_stage/entry/src/main/ets/test/commom.ets deleted file mode 100644 index 0aab56c4b1045484495b18d6f3bb868015d944ad..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/test/commom.ets +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager' - -const WANT1 = { - bundleName: "com.example.extensionzerotest", - abilityName: "com.example.extensionzerotest.EnterpriseAdminAbility" -}; -const ENTINFO1 = { - name: "company", - description: "edm demo" -}; - -const SELFWANT = { - bundleName: "com.example.myapplication", - abilityName: "com.example.myapplication.EnterpriseAdminAbility" -}; -const SELFHAPNAME = "com.example.myapplication" -const COMPANYNAME2 = "company2" -const DESCRIPTION2 = "edm demo2" - -const ENTINFO2 = { - name: "company2", - description: "edm demo2" -}; - -const DEFAULT_USER_ID = 100; -const TEST_USER_ID = 101; -const ERR_USER_ID = 102; - -const SUBSCRIBE_EVENTS: Array = [ - enterpriseDeviceManager.ManagedEvent.MANAGED_EVENT_BUNDLE_ADDED, - enterpriseDeviceManager.ManagedEvent.MANAGED_EVENT_BUNDLE_REMOVED -]; -const SUBSCRIBE_INVALID_EVENTS: Array = [20,21]; - -export { - WANT1, ENTINFO1, SELFWANT, SELFHAPNAME, COMPANYNAME2, DESCRIPTION2, ENTINFO2, - DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID, SUBSCRIBE_EVENTS, SUBSCRIBE_INVALID_EVENTS -} \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets b/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets deleted file mode 100644 index 9b438235e79b299a9bfe52a2ec6cf28152390394..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/test/edmCallback.test.ets +++ /dev/null @@ -1,450 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" -import { - WANT1, ENTINFO1, SELFWANT, SELFHAPNAME, COMPANYNAME2, DESCRIPTION2, - ENTINFO2, DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID, SUBSCRIBE_EVENTS, SUBSCRIBE_INVALID_EVENTS -} from "./commom.ets"; -import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager' - -export default function edmCallbackTest() { - - describe('edmCallback_test', function () { - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0001 - * @tc.name test enableAdmin method in callback mode without user id - * @tc.desc enable admin in callback mode - */ - it('enableAdmin_test_002', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, OnReceiveEvent); - async function OnReceiveEvent(err) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - expect(err == null).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableAdmin(WANT1); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0004 - * @tc.name test enableAdmin method in callback mode with ADMIN_TYPE_SUPER param without user id - * @tc.desc enable super admin in callback mode - */ - it('enableAdmin_test_004', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, OnReceiveEvent); - async function OnReceiveEvent(err) { - console.log('enterpriseDeviceManager.enableAdmin.'); - expect(err == null).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin.'); - - isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0008 - * @tc.name test enableAdmin method with user id in callback mode with default user id - * @tc.desc enable admin in multi-user - */ - it('enableAdmin_test_008', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - expect(err == null).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0012 - * @tc.name test enableAdmin method in callback mode with test user id - * @tc.desc enable admin in multi-user - */ - it('enableAdmin_test_012', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - expect(err == null).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0013 - * @tc.name test enableAdmin method in promise mode and query with error user id - * @tc.desc enable admin in multi-user - */ - it('enableAdmin_test_013', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - expect(err == null).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertFalse(); - - await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0014 - * @tc.name test enableAdmin method in callback mode and disable with error user id - * @tc.desc enable and disable admin in multi-user - */ - it('enableAdmin_test_014', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - expect(err == null).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertTrue(); - - try { - await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin over'); - } catch (error) { - expect(error != null).assertTrue(); - console.log("enableAdmin_test_014 throw error code : " + error.code + "message :" + error.message); - } - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0017 - * @tc.name test setEnterpriseInfo method in callback mode - * @tc.desc set enterprise info in callback mode - */ - it('setEnterpriseInfo_test_002', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); - expect(isEnabled).assertTrue(); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - - await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2, OnReceiveEvent); - async function OnReceiveEvent(err) { - console.log('enterpriseDeviceManager.setEnterpriseInfo.'); - expect(err == null).assertTrue(); - - var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT); - expect(entInfo.name).assertEqual(COMPANYNAME2); - expect(entInfo.description).assertEqual(DESCRIPTION2); - - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0018 - * @tc.name test getDeviceSettingsManager method in callback mode - * @tc.desc get the device settings manager in callback mode - */ - it('getDeviceSettingsManager_test_001', 0, async function (done) { - enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => { - expect(mgr !== null).assertTrue(); - }) - console.log('getDeviceSettingsManager_test_001 done'); - done(); - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0021 - * @tc.name test setDateTime method in callback mode - * @tc.desc set system date time in callback mode - */ - it('setDateTime_test_002', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER); - let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager(); - expect(dsmgr !== null).assertTrue(); - console.log('before setDateTime'); - let currentTime = new Date().getTime(); - await dsmgr.setDateTime(SELFWANT, currentTime, OnReceiveEvent); - async function OnReceiveEvent(error) { - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - expect(error === null).assertTrue(); - done(); - } - }) - - /** - * @tc.number subscribeManagedEvent_test_001 - * @tc.desc Test subscribeManagedEvent method in callback mode. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('subscribeManagedEvent_test_001', 0, async function (done) { - console.info('-----------subscribeManagedEvent_test_001 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await new Promise((resolve, reject) => { - enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { - expect(error == null).assertTrue(); - console.log('enterpriseDeviceManager.subscribeManagedEvent. null 1'); - resolve(0); - }); - }); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - done(); - }) - - /** - * @tc.number subscribeManagedEvent_test_003 - * @tc.desc Test subscribeManagedEvent method in callback mode and subscribe invalid managed events. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('subscribeManagedEvent_test_003', 0, async function (done) { - console.info('-----------subscribeManagedEvent_test_003 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await new Promise((resolve, reject) => { - enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_INVALID_EVENTS, error => { - expect(error.code == 9200008).assertTrue(); - console.log('enterpriseDeviceManager.subscribeManagedEvent. 9200008'); - resolve(0); - }); - }); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - done(); - }) - - /** - * @tc.number subscribeManagedEvent_test_005 - * @tc.desc Test subscribeManagedEvent method in callback mode subscribe when disable admin. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('subscribeManagedEvent_test_005', 0, async function (done) { - console.info('-----------subscribeManagedEvent_test_005 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - await new Promise((resolve, reject) => { - enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { - expect(error.code == 9200001).assertTrue(); - console.log('enterpriseDeviceManager.subscribeManagedEvent. 9200001'); - resolve(0); - }); - }); - done(); - }) - - /** - * @tc.number subscribeManagedEvent_test_007 - * @tc.desc Test subscribeManagedEvent method in callback mode and subscribe when enable super admin. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('subscribeManagedEvent_test_007', 0, async function (done) { - console.info('-----------subscribeManagedEvent_test_007 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); - await new Promise((resolve, reject) => { - enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { - expect(error == null).assertTrue(); - console.log('enterpriseDeviceManager.subscribeManagedEvent. null 2'); - resolve(0); - }); - }); - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin ADMIN_TYPE_SUPER.'); - done(); - }) - - /** - * @tc.number unsubscribeManagedEvent_test_001 - * @tc.desc Test unsubscribeManagedEvent method in callback mode. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('unsubscribeManagedEvent_test_001', 0, async function (done) { - console.info('-----------unsubscribeManagedEvent_test_001 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await new Promise((resolve, reject) => { - enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { - expect(error == null).assertTrue(); - console.log('enterpriseDeviceManager.unsubscribeManagedEvent. null 1'); - resolve(0); - }); - }); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - done(); - }) - - /** - * @tc.number unsubscribeManagedEvent_test_003 - * @tc.desc Test unsubscribeManagedEvent method in callback mode and unsubscribe invalid managed events. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('unsubscribeManagedEvent_test_003', 0, async function (done) { - console.info('-----------unsubscribeManagedEvent_test_003 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await new Promise((resolve, reject) => { - enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_INVALID_EVENTS, error => { - expect(error.code == 9200008).assertTrue(); - console.log('enterpriseDeviceManager.unsubscribeManagedEvent. 9200008'); - resolve(0); - }); - }); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - done(); - }) - - /** - * @tc.number unsubscribeManagedEvent_test_005 - * @tc.desc Test unsubscribeManagedEvent method in callback mode and unsubscribe when disable admin. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('unsubscribeManagedEvent_test_005', 0, async function (done) { - console.info('-----------unsubscribeManagedEvent_test_005 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - await new Promise((resolve, reject) => { - enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { - expect(error.code == 9200001).assertTrue(); - console.log('enterpriseDeviceManager.unsubscribeManagedEvent. 9200001'); - resolve(0); - }); - }); - done(); - }) - - /** - * @tc.number unsubscribeManagedEvent_test_007 - * @tc.desc Test unsubscribeManagedEvent method in callback mode and unsubscribe when enable super admin. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('unsubscribeManagedEvent_test_007', 0, async function (done) { - console.info('-----------unsubscribeManagedEvent_test_007 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); - await new Promise((resolve, reject) => { - enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS, error => { - expect(error == null).assertTrue(); - console.log('enterpriseDeviceManager.unsubscribeManagedEvent. null 2'); - resolve(0); - }); - }); - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin ADMIN_TYPE_SUPER.'); - done(); - }) - }) -} diff --git a/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets b/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets deleted file mode 100644 index 0854b5f9ab77ba3710afc657217ca49aac2510e8..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/ets/test/edmPromise.test.ets +++ /dev/null @@ -1,464 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" -import { - WANT1, ENTINFO1, SELFWANT, SELFHAPNAME, COMPANYNAME2, DESCRIPTION2, ENTINFO2, - DEFAULT_USER_ID, TEST_USER_ID, ERR_USER_ID, SUBSCRIBE_EVENTS, SUBSCRIBE_INVALID_EVENTS -} from "./commom.ets"; -import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager' - -export default function edmPromiseTest() { - describe('edmPromise_test', function () { - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0001 - * @tc.name test enableAdmin method in promise mode without user id - * @tc.desc enable admin in promise mode - */ - it('enableAdmin_test_001', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableAdmin(WANT1); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0003 - * @tc.name test enableAdmin method in promise mode with ADMIN_TYPE_SUPER param without user id - * @tc.desc enable super admin in promise mode - */ - it('enableAdmin_test_003', 0, async function (done) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); - - var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin.'); - - isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0007 - * @tc.name test enableAdmin method in promise mode with default user id - * @tc.desc enable admin in multi-user - */ - it('enableAdmin_test_007', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertTrue(); - - - await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0009 - * @tc.name test enableAdmin method with user id in callback mode with error user id - * @tc.desc enable admin in multi-user - */ - it('enableAdmin_test_009', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, TEST_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err) { - expect(err != null).assertTrue(); - if (err) { - // user exsit but super admin can only be enabled in user 100 - console.log("enableAdmin_test_009 throw error code : " + err.code + "message :" + err.message); - } - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0010 - * @tc.name test enableAdmin method with user id in callback mode with error user id - * @tc.desc enable admin in multi-user - */ - it('enableAdmin_test_010', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, ERR_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err) { - expect(err != null).assertTrue(); - if (err) { - // user does not exsit - console.log("enableAdmin_test_010 throw error code : " + err.code + "message :" + err.message); - } - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0011 - * @tc.name test enableAdmin method in promise mode with test user id - * @tc.desc enable admin in multi-user - */ - it('enableAdmin_test_011', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertTrue(); - - - await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0015 - * @tc.name test enableAdmin method in promise mode and disable with test user id - * @tc.desc enable admin in multi-user - */ - it('enableAdmin_test_015', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - await enterpriseDeviceManager.enableAdmin(WANT1, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID, OnReceiveEvent); - async function OnReceiveEvent(err) { - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - expect(err == null).assertTrue(); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertTrue(); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableAdmin(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertTrue(); - - await enterpriseDeviceManager.disableAdmin(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(WANT1, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled :' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - } - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0022 - * @tc.name test enable super admin method in promise mode and enable twice with test user id - * @tc.desc enable and disable admin in multi-user - */ - it('enableAdmin_test_0016', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); - - var isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.isSuperAdmin :' + isEnabled); - expect(isEnabled).assertTrue(); - - try { - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, TEST_USER_ID); - } catch (error) { - expect(error != null).assertTrue(); - console.log("enableAdmin_test_016 throw error code : " + error.code + "message :" + error.message); - } - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT, TEST_USER_ID); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin.'); - - isEnabled = await enterpriseDeviceManager.isSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.isSuperAdmin : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0016 - * @tc.name test setEnterpriseInfo method in promise mode - * @tc.desc set enterprise info in promise mode - */ - it('setEnterpriseInfo_test_001', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - - var isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); - expect(isEnabled).assertTrue(); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - - await enterpriseDeviceManager.setEnterpriseInfo(SELFWANT, ENTINFO2); - console.log('enterpriseDeviceManager.setEnterpriseInfo.'); - - var entInfo = await enterpriseDeviceManager.getEnterpriseInfo(SELFWANT); - expect(entInfo.name).assertEqual(COMPANYNAME2); - expect(entInfo.description).assertEqual(DESCRIPTION2); - - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - - isEnabled = await enterpriseDeviceManager.isAdminEnabled(SELFWANT); - console.log('enterpriseDeviceManager.isAdminEnabled : ' + isEnabled); - expect(isEnabled).assertFalse(); - done(); - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0019 - * @tc.name test getDeviceSettingsManager method in promise mode - * @tc.desc get the device settings manager in promise mode - */ - it('getDeviceSettingsManager_test_002', 0, async function (done) { - enterpriseDeviceManager.getDeviceSettingsManager().then(mgr => { - expect(mgr !== null).assertTrue(); - }) - console.log('getDeviceSettingsManager_test_002 done'); - done(); - }) - - /** - * @tc.number SUB_CUSTOMIZATION_ENTERPRISE_DEVICE_MANAGER_JS_0020 - * @tc.name test setDateTime method in promise mode - * @tc.desc set system date time in promise mode - */ - it('setDateTime_test_001', 0, async function (done) { - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER); - let dsmgr = await enterpriseDeviceManager.getDeviceSettingsManager(); - expect(dsmgr !== null).assertTrue(); - console.log('before setDateTime'); - let currentTime = new Date().getTime(); - await dsmgr.setDateTime(SELFWANT, currentTime).catch((error)=>{ - expect(error === null).assertTrue(); - }) - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - done(); - }) - - /** - * @tc.number subscribeManagedEvent_test_002 - * @tc.desc Test subscribeManagedEvent method in promise mode. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('subscribeManagedEvent_test_002', 0, async function (done) { - console.info('-----------subscribeManagedEvent_test_002 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { - }).catch((error) => { - expect(error == null).assertTrue(); - }); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - done(); - }) - - /** - * @tc.number subscribeManagedEvent_test_004 - * @tc.desc Test subscribeManagedEvent method in promise mode and subscribe invalid managed events. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('subscribeManagedEvent_test_004', 0, async function (done) { - console.info('-----------subscribeManagedEvent_test_004 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_INVALID_EVENTS).then(() => { - }).catch((error) => { - expect(error.code == 9200008).assertTrue(); - }); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - done(); - }) - - /** - * @tc.number subscribeManagedEvent_test_006 - * @tc.desc Test subscribeManagedEvent method in promise mode and subscribe when disable admin. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('subscribeManagedEvent_test_006', 0, async function (done) { - console.info('-----------subscribeManagedEvent_test_006 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - await enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { - }).catch((error) => { - expect(error.code == 9200001).assertTrue(); - }); - done(); - }) - - /** - * @tc.number subscribeManagedEvent_test_008 - * @tc.desc Test subscribeManagedEvent method in promise mode and subscribe when enable super admin. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('subscribeManagedEvent_test_008', 0, async function (done) { - console.info('-----------subscribeManagedEvent_test_008 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); - await enterpriseDeviceManager.subscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { - }).catch((error) => { - expect(error == null).assertTrue(); - }); - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin ADMIN_TYPE_SUPER.'); - done(); - }) - - /** - * @tc.number unsubscribeManagedEvent_test_002 - * @tc.desc Test subscribeManagedEvent method in promise mode. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('unsubscribeManagedEvent_test_002', 0, async function (done) { - console.info('-----------unsubscribeManagedEvent_test_002 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - - await enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { - }).catch((error) => { - expect(error == null).assertTrue(); - }); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - done(); - }) - - /** - * @tc.number unsubscribeManagedEvent_test_004 - * @tc.desc Test subscribeManagedEvent method in promise mode and unsubscribe invalid managed events. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('unsubscribeManagedEvent_test_004', 0, async function (done) { - console.info('-----------unsubscribeManagedEvent_test_004 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_INVALID_EVENTS).then(() => { - }).catch((error) => { - expect(error.code == 9200008).assertTrue(); - }); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - done(); - }) - - /** - * @tc.number unsubscribeManagedEvent_test_006 - * @tc.desc Test subscribeManagedEvent method in promise mode and unsubscribe when disable admin. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('unsubscribeManagedEvent_test_006', 0, async function (done) { - console.info('-----------unsubscribeManagedEvent_test_006 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_NORMAL, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_NORMAL.'); - await enterpriseDeviceManager.disableAdmin(SELFWANT); - console.log('enterpriseDeviceManager.disableAdmin.'); - await enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { - }).catch((error) => { - expect(error.code == 9200001).assertTrue(); - }); - done(); - }) - - /** - * @tc.number unsubscribeManagedEvent_test_008 - * @tc.desc Test subscribeManagedEvent method in promise mode and unsubscribe when enable super admin. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 1 - */ - it('unsubscribeManagedEvent_test_008', 0, async function (done) { - console.info('-----------unsubscribeManagedEvent_test_008 start-------------'); - await enterpriseDeviceManager.enableAdmin(SELFWANT, ENTINFO1, - enterpriseDeviceManager.AdminType.ADMIN_TYPE_SUPER, DEFAULT_USER_ID); - console.log('enterpriseDeviceManager.enableAdmin ADMIN_TYPE_SUPER.'); - await enterpriseDeviceManager.unsubscribeManagedEvent(SELFWANT, SUBSCRIBE_EVENTS).then(() => { - }).catch((error) => { - expect(error == null).assertTrue(); - }); - await enterpriseDeviceManager.disableSuperAdmin(SELFHAPNAME); - console.log('enterpriseDeviceManager.disableSuperAdmin ADMIN_TYPE_SUPER.'); - done(); - }) - }) -} diff --git a/customization/edm_xts_stage/entry/src/main/module.json b/customization/edm_xts_stage/entry/src/main/module.json deleted file mode 100644 index c9d8146b1f57f7c22bc30a694f0e4551b68335f5..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/module.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "module": { - "name": "phone", - "type": "entry", - "srcEntrance": "./ets/Application/AbilityStage.ts", - "description": "$string:phone_entry_dsc", - "mainElement": "MainAbility", - "deviceTypes": [ - "tablet", - "default", - "phone" - ], - "deliveryWithInstall": true, - "installationFree": false, - "uiSyntax": "ets", - "pages": "$profile:main_pages", - "abilities": [{ - "name": "com.example.myapplication.MainAbility", - "srcEntrance": "./ets/MainAbility/MainAbility.ts", - "description": "$string:phone_entry_main", - "icon": "$media:icon", - "label": "$string:entry_label", - "visible": true, - "orientation": "portrait", - "skills": [{ - "actions": [ - "action.system.home" - ], - "entities": [ - "entity.system.home" - ] - }] - }], - "extensionAbilities": [ - { - "srcEntrance": "./ets/EnterpriseAdminAbility/EnterpriseAdminAbility.ts", - "name": "com.example.myapplication.EnterpriseAdminAbility", - "icon": "$media:icon", - "srcLanguage": "ets", - "description": "$string:phone_entry_main", - "type": "enterpriseAdmin", - "visible": true - } - ], - "requestPermissions": [ - { - "name": "ohos.permission.SYSTEM_FLOAT_WINDOW", - "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" - }, - { - "name": "ohos.permission.CAPTURE_SCREEN", - "reason": "need use ohos.permission.SYSTEM_FLOAT_WINDOW" - }, - { - "name": "ohos.permission.GET_BUNDLE_INFO", - "reason": "need use ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.INSTALL_BUNDLE", - "reason": "need use ohos.permission.GET_BUNDLE_INFO" - }, - { - "name": "ohos.permission.ENTERPRISE_SET_DATETIME", - "reason": "need use ENTERPRISE_SET_DATETIME" - }, - { - "name": "ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN", - "reason": "need use MANAGE_ENTERPRISE_DEVICE_ADMIN" - }, - { - "name": "ohos.permission.SET_ENTERPRISE_INFO", - "reason": "need use SET_ENTERPRISE_INFO" - }, - { - "name": "ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT", - "reason": "need use ENTERPRISE_SUBSCRIBE_MANAGED_EVENT" - } - ] - } -} \ No newline at end of file diff --git a/customization/edm_xts_stage/entry/src/main/resources/base/element/string.json b/customization/edm_xts_stage/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 2977b612ec4595b13eaaffe3e8fc578e83c42d48..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "string": [ - { - "name": "phone_entry_dsc", - "value": "i am an entry for phone" - }, - { - "name": "phone_entry_main", - "value": "the phone entry ability" - }, - { - "name": "entry_label", - "value": "ActsContextTest" - }, - { - "name": "form_description", - "value": "my form" - }, - { - "name": "serviceability_description", - "value": "my whether" - }, - { - "name": "description_application", - "value": "demo for test" - }, - { - "name": "app_name", - "value": "Demo" - } - ] -} diff --git a/customization/edm_xts_stage/entry/src/main/resources/base/media/icon.png b/customization/edm_xts_stage/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index 474a55588fd7216113dd42073aadf254d4dba023..0000000000000000000000000000000000000000 Binary files a/customization/edm_xts_stage/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/customization/edm_xts_stage/entry/src/main/resources/base/profile/main_pages.json b/customization/edm_xts_stage/entry/src/main/resources/base/profile/main_pages.json deleted file mode 100644 index 6898b31d2085f478ee1ed9d933a5910cbf901d92..0000000000000000000000000000000000000000 --- a/customization/edm_xts_stage/entry/src/main/resources/base/profile/main_pages.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "src": [ - "pages/index/index", - "pages/second/second" - ] -} \ No newline at end of file diff --git a/customization/edm_xts_stage/signature/openharmony_sx.p7b b/customization/edm_xts_stage/signature/openharmony_sx.p7b deleted file mode 100644 index 7ffcdc78527c5c1aa24520ab7e913c5f47c703f0..0000000000000000000000000000000000000000 Binary files a/customization/edm_xts_stage/signature/openharmony_sx.p7b and /dev/null differ diff --git a/test_packages.gni b/test_packages.gni index e2c8be85f5451ae35de23d79e762717b57aa2e5a..e8b1037a0cdb99dd2c9c59850019c8cfe4f01344 100644 --- a/test_packages.gni +++ b/test_packages.gni @@ -45,7 +45,6 @@ _all_test_packages = [ "${ACTS_ROOT}/location:location", "${ACTS_ROOT}/settingsdata:settingsdata", "${ACTS_ROOT}/barrierfree:barrierfree", - "${ACTS_ROOT}/customization:customization", "${ACTS_ROOT}/applications:applications", ]